module TwitterWithAutoPagination::REST::FriendsAndFollowers

Constants

MAX_IDS_PER_REQUEST

Public Instance Methods

followers(*args) click to toggle source
# File lib/twitter_with_auto_pagination/rest/friends_and_followers.rb, line 31
def followers(*args)
  options = args.extract_options!.merge(super_operation: :followers)
  ids = follower_ids(*args, options)
  users_internal(ids, options)
end
friend_ids_and_follower_ids(*args) click to toggle source
# File lib/twitter_with_auto_pagination/rest/friends_and_followers.rb, line 37
def friend_ids_and_follower_ids(*args)
  options = args.extract_options!.merge(super_operation: :friend_ids_and_follower_ids)

  parallel(in_threads: 2) do |batch|
    batch.friend_ids(*args, options)
    batch.follower_ids(*args, options)
  end
end
friends(*args) click to toggle source
# File lib/twitter_with_auto_pagination/rest/friends_and_followers.rb, line 25
def friends(*args)
  options = args.extract_options!.merge(super_operation: :friends)
  ids = friend_ids(*args, options)
  users_internal(ids, options)
end
friends_and_followers(*args) click to toggle source
# File lib/twitter_with_auto_pagination/rest/friends_and_followers.rb, line 46
def friends_and_followers(*args)
  options = args.extract_options!.merge(super_operation: :friends_and_followers)

  following_ids, followed_ids = friend_ids_and_follower_ids(*args, options)
  unique_ids = (following_ids + followed_ids).uniq
  people = users_internal(unique_ids).index_by { |u| u[:id] }
  [people.slice(*following_ids).values, people.slice(*followed_ids).values]

  # parallel(in_threads: 2) do |batch|
  #   batch.friends(*args, options)
  #   batch.followers(*args, options)
  # end
end
friendship?(from, to, options = {}) click to toggle source
# File lib/twitter_with_auto_pagination/rest/friends_and_followers.rb, line 8
def friendship?(from, to, options = {})
  twitter.send(__method__, from, to, options)
end