Module: TwitterWithAutoPagination::REST::FriendsAndFollowers
- Includes:
- Utils
- Included in:
- API
- Defined in:
- lib/twitter_with_auto_pagination/rest/friends_and_followers.rb
Constant Summary
collapse
- MAX_IDS_PER_REQUEST =
5000
Constants included
from Utils
Utils::DEFAULT_CALL_LIMIT
Instance Method Summary
collapse
Methods included from Collector
#collect_with_cursor, #collect_with_max_id
Instance Method Details
#followers(*args) ⇒ Object
31
32
33
34
35
|
# File 'lib/twitter_with_auto_pagination/rest/friends_and_followers.rb', line 31
def followers(*args)
options = args..merge(super_operation: :followers)
ids = follower_ids(*args, options)
users_internal(ids, options)
end
|
#friend_ids_and_follower_ids(*args) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/twitter_with_auto_pagination/rest/friends_and_followers.rb', line 37
def friend_ids_and_follower_ids(*args)
options = args..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) ⇒ Object
25
26
27
28
29
|
# File 'lib/twitter_with_auto_pagination/rest/friends_and_followers.rb', line 25
def friends(*args)
options = args..merge(super_operation: :friends)
ids = friend_ids(*args, options)
users_internal(ids, options)
end
|
#friends_and_followers(*args) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/twitter_with_auto_pagination/rest/friends_and_followers.rb', line 46
def friends_and_followers(*args)
options = args..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]
end
|
#friendship?(from, to, options = {}) ⇒ Boolean
8
9
10
|
# File 'lib/twitter_with_auto_pagination/rest/friends_and_followers.rb', line 8
def friendship?(from, to, options = {})
.send(__method__, from, to, options)
end
|