Class: Miteru::Feeds::UrlScan

Inherits:
Feed
  • Object
show all
Defined in:
lib/miteru/feeds/urlscan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size = 100) ⇒ UrlScan

Returns a new instance of UrlScan.

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/miteru/feeds/urlscan.rb', line 10

def initialize(size = 100)
  @size = size
  raise ArgumentError, "size must be less than 10,000" if size > 10_000
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



8
9
10
# File 'lib/miteru/feeds/urlscan.rb', line 8

def size
  @size
end

Instance Method Details

#apiObject



15
16
17
# File 'lib/miteru/feeds/urlscan.rb', line 15

def api
  @api ||= ::UrlScan::API.new
end

#urlsObject



19
20
21
22
23
24
# File 'lib/miteru/feeds/urlscan.rb', line 19

def urls
  urls_from_community_feed
rescue ::UrlScan::ResponseError => e
  puts "Failed to load urlscan.io feed (#{e})"
  []
end