Class: Wuclan::Twitter::Scrape::TwitterFollowersIdsRequest
- Defined in:
- lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb
Overview
API request for the full list of a user’s followers (IDs only). One call gives the whole list.
Produces a (possibly very large) number of AFollowsB.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#healthy? ⇒ Boolean
followers_ids should be an array of user_ids.
- #items_count(thing) ⇒ Object
- #key ⇒ Object
- #make_url ⇒ Object
-
#parse(*args, &block) ⇒ Object
unpacks the raw API response, yielding all the relationships.
Methods inherited from Base
#num_items, #request_for_page, #response=, #set_total_items
Instance Method Details
#healthy? ⇒ Boolean
followers_ids should be an array of user_ids
22 23 24 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 22 def healthy?() parsed_contents && parsed_contents.is_a?(Array) end |
#items_count(thing) ⇒ Object
15 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 15 def items_count(thing) thing.followers_count == 0 ? 0 : 1 end |
#key ⇒ Object
17 18 19 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 17 def key twitter_user_id end |
#make_url ⇒ Object
16 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 16 def make_url() "http://twitter.com/#{resource_path}/#{twitter_user_id}.json" end |
#parse(*args, &block) ⇒ Object
unpacks the raw API response, yielding all the relationships.
29 30 31 32 33 34 35 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 29 def parse *args, &block parsed_contents.each do |user_b_id| user_b_id = "%010d"%user_b_id.to_i # B is a follower: B follows user. yield AFollowsB.new(user_b_id, user_a_id) end end |