Class: TwitterImages::Requester
- Inherits:
-
Object
- Object
- TwitterImages::Requester
- Defined in:
- lib/twitter_images/requester.rb
Instance Attribute Summary collapse
-
#authorizer ⇒ Object
readonly
Returns the value of attribute authorizer.
-
#client ⇒ Object
Returns the value of attribute client.
-
#downloader ⇒ Object
readonly
Returns the value of attribute downloader.
-
#links ⇒ Object
Returns the value of attribute links.
-
#max_id ⇒ Object
Returns the value of attribute max_id.
-
#search ⇒ Object
readonly
Returns the value of attribute search.
-
#tweets ⇒ Object
Returns the value of attribute tweets.
Instance Method Summary collapse
-
#initialize ⇒ Requester
constructor
A new instance of Requester.
- #send_requests(search, amount) ⇒ Object
- #start(search, amount) ⇒ Object
Constructor Details
#initialize ⇒ Requester
Returns a new instance of Requester.
6 7 8 9 10 11 12 |
# File 'lib/twitter_images/requester.rb', line 6 def initialize @downloader = Downloader.new @authorizer = Authorizer.new @max_id = nil @tweets = [] @links = [] end |
Instance Attribute Details
#authorizer ⇒ Object (readonly)
Returns the value of attribute authorizer.
3 4 5 |
# File 'lib/twitter_images/requester.rb', line 3 def @authorizer end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/twitter_images/requester.rb', line 4 def client @client end |
#downloader ⇒ Object (readonly)
Returns the value of attribute downloader.
3 4 5 |
# File 'lib/twitter_images/requester.rb', line 3 def downloader @downloader end |
#links ⇒ Object
Returns the value of attribute links.
4 5 6 |
# File 'lib/twitter_images/requester.rb', line 4 def links @links end |
#max_id ⇒ Object
Returns the value of attribute max_id.
4 5 6 |
# File 'lib/twitter_images/requester.rb', line 4 def max_id @max_id end |
#search ⇒ Object (readonly)
Returns the value of attribute search.
3 4 5 |
# File 'lib/twitter_images/requester.rb', line 3 def search @search end |
#tweets ⇒ Object
Returns the value of attribute tweets.
4 5 6 |
# File 'lib/twitter_images/requester.rb', line 4 def tweets @tweets end |
Instance Method Details
#send_requests(search, amount) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/twitter_images/requester.rb', line 20 def send_requests(search, amount) configure_client loop do get_tweets(search, amount) break if @links.count > amount end trim_links(amount) end |
#start(search, amount) ⇒ Object
14 15 16 17 18 |
# File 'lib/twitter_images/requester.rb', line 14 def start(search, amount) puts "Getting links to the pictures..." send_requests(search, amount) download(links) end |