Class: TwitterImages::Requester

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_images/requester.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequester

Returns a new instance of Requester.



6
7
8
9
# File 'lib/twitter_images/requester.rb', line 6

def initialize
  @downloader = Downloader.new
  @parser = Parser.new
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



4
5
6
# File 'lib/twitter_images/requester.rb', line 4

def address
  @address
end

#downloaderObject (readonly)

Returns the value of attribute downloader.



3
4
5
# File 'lib/twitter_images/requester.rb', line 3

def downloader
  @downloader
end

#httpsObject

Returns the value of attribute https.



4
5
6
# File 'lib/twitter_images/requester.rb', line 4

def https
  @https
end

#parserObject (readonly)

Returns the value of attribute parser.



3
4
5
# File 'lib/twitter_images/requester.rb', line 3

def parser
  @parser
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/twitter_images/requester.rb', line 4

def response
  @response
end

#searchObject (readonly)

Returns the value of attribute search.



3
4
5
# File 'lib/twitter_images/requester.rb', line 3

def search
  @search
end

Instance Method Details



17
18
19
20
21
22
23
24
# File 'lib/twitter_images/requester.rb', line 17

def get_links(search, amount)
  loop do
    configure_request(search)
    parse
    break if @parser.parsed_links.count > amount
  end
  trim_links(amount)
end

#start(search, amount) ⇒ Object



11
12
13
14
15
# File 'lib/twitter_images/requester.rb', line 11

def start(search, amount)
  check_env
  get_links(search, amount)
  download
end