Class: Wuclan::Twitter::Scrape::TwitterFriendsIdsRequest
- Defined in:
- lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb
Overview
API request for the full list of a user’s friends (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
friends_ids should be an array of user_id’s.
- #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
friends_ids should be an array of user_id’s
57 58 59 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 57 def healthy?() parsed_contents && parsed_contents.is_a?(Array) end |
#items_count(thing) ⇒ Object
48 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 48 def items_count(thing) thing.friends_count == 0 ? 0 : 1 end |
#key ⇒ Object
50 51 52 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 50 def key twitter_user_id end |
#make_url ⇒ Object
49 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 49 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.
64 65 66 67 68 69 70 |
# File 'lib/wuclan/twitter/scrape/twitter_ff_ids_request.rb', line 64 def parse *args, &block parsed_contents.each do |user_b_id| user_b_id = "%010d"%user_b_id.to_i # B is a friend: user follows B yield AFollowsB.new(user_a_id, user_b_id) end end |