Module: Twitter::REST::Lists
Constant Summary collapse
- MAX_USERS_PER_REQUEST =
100
- URI_SUBSTRING =
'://'.freeze
Constants included from Utils
Instance Method Summary collapse
-
#add_list_member(*args) ⇒ Twitter::List
Add a member to a list.
-
#add_list_members(*args) ⇒ Twitter::List
Adds specified members to a list.
-
#create_list(name, options = {}) ⇒ Twitter::List
Creates a new list for the authenticated user.
-
#destroy_list(*args) ⇒ Twitter::List
Deletes the specified list.
-
#list(*args) ⇒ Twitter::List
Show the specified list.
-
#list_member?(*args) ⇒ Boolean
Check if a user is a member of the specified list.
-
#list_members(*args) ⇒ Twitter::Cursor
Returns the members of the specified list.
-
#list_subscribe(*args) ⇒ Twitter::List
Make the authenticated user follow the specified list.
-
#list_subscriber?(*args) ⇒ Boolean
Check if a user is a subscriber of the specified list.
-
#list_subscribers(*args) ⇒ Twitter::Cursor
Returns the subscribers of the specified list.
-
#list_timeline(*args) ⇒ Array<Twitter::Tweet>
Show tweet timeline for members of the specified list.
-
#list_unsubscribe(*args) ⇒ Twitter::List
Unsubscribes the authenticated user form the specified list.
-
#list_update(*args) ⇒ Twitter::List
Updates the specified list.
-
#lists(*args) ⇒ Array<Twitter::List>
(also: #lists_subscribed_to)
Returns all lists the authenticating or specified user subscribes to, including their own.
-
#memberships(*args) ⇒ Twitter::Cursor
List the lists the specified user has been added to.
-
#owned_lists(*args) ⇒ Array<Twitter::List>
Returns the lists owned by the specified Twitter user.
-
#remove_list_member(*args) ⇒ Twitter::List
Removes the specified member from the list.
-
#remove_list_members(*args) ⇒ Twitter::List
Removes specified members from the list.
-
#subscriptions(*args) ⇒ Twitter::Cursor
List the lists the specified user follows.
Methods included from Utils
Instance Method Details
#add_list_member(list, user_to_add, options = {}) ⇒ Twitter::List #add_list_member(user, list, user_to_add, options = {}) ⇒ Twitter::List
Lists are limited to having 5,000 members.
Add a member to a list
269 270 271 |
# File 'lib/twitter/rest/lists.rb', line 269 def add_list_member(*args) list_from_response_with_user('/1.1/lists/members/create.json', args) end |
#add_list_members(list, users, options = {}) ⇒ Twitter::List #add_list_members(user, list, users, options = {}) ⇒ Twitter::List
Lists are limited to having 5,000 members, and you are limited to adding up to 100 members to a list at a time with this method.
Adds specified members to a list
206 207 208 |
# File 'lib/twitter/rest/lists.rb', line 206 def add_list_members(*args) list_from_response_with_users('/1.1/lists/members/create_all.json', args) end |
#create_list(name, options = {}) ⇒ Twitter::List
Accounts are limited to 20 lists.
Creates a new list for the authenticated user
330 331 332 |
# File 'lib/twitter/rest/lists.rb', line 330 def create_list(name, = {}) perform_post_with_object('/1.1/lists/create.json', .merge(:name => name), Twitter::List) end |
#destroy_list(list, options = {}) ⇒ Twitter::List #destroy_list(user, list, options = {}) ⇒ Twitter::List
Must be owned by the authenticated user.
Deletes the specified list
290 291 292 |
# File 'lib/twitter/rest/lists.rb', line 290 def destroy_list(*args) list_from_response(:post, '/1.1/lists/destroy.json', args) end |
#list(list, options = {}) ⇒ Twitter::List #list(user, list, options = {}) ⇒ Twitter::List
Private lists will only be shown if the authenticated user owns the specified list.
Show the specified list
351 352 353 |
# File 'lib/twitter/rest/lists.rb', line 351 def list(*args) list_from_response(:get, '/1.1/lists/show.json', args) end |
#list_member?(list, user_to_check, options = {}) ⇒ Boolean #list_member?(user, list, user_to_check, options = {}) ⇒ Boolean
Check if a user is a member of the specified list
228 229 230 |
# File 'lib/twitter/rest/lists.rb', line 228 def list_member?(*args) list_user?(:get, '/1.1/lists/members/show.json', args) end |
#list_members(list, options = {}) ⇒ Twitter::Cursor #list_members(user, list, options = {}) ⇒ Twitter::Cursor
Returns the members of the specified list
247 248 249 |
# File 'lib/twitter/rest/lists.rb', line 247 def list_members(*args) cursor_from_response_with_list('/1.1/lists/members.json', args) end |
#list_subscribe(list, options = {}) ⇒ Twitter::List #list_subscribe(user, list, options = {}) ⇒ Twitter::List
Make the authenticated user follow the specified list
142 143 144 |
# File 'lib/twitter/rest/lists.rb', line 142 def list_subscribe(*args) list_from_response(:post, '/1.1/lists/subscribers/create.json', args) end |
#list_subscriber?(list, user_to_check, options = {}) ⇒ Boolean #list_subscriber?(user, list, user_to_check, options = {}) ⇒ Boolean
Check if a user is a subscriber of the specified list
164 165 166 |
# File 'lib/twitter/rest/lists.rb', line 164 def list_subscriber?(*args) list_user?(:get, '/1.1/lists/subscribers/show.json', args) end |
#list_subscribers(list, options = {}) ⇒ Twitter::Cursor #list_subscribers(user, list, options = {}) ⇒ Twitter::Cursor
Returns the subscribers of the specified list
123 124 125 |
# File 'lib/twitter/rest/lists.rb', line 123 def list_subscribers(*args) cursor_from_response_with_list('/1.1/lists/subscribers.json', args) end |
#list_timeline(list, options = {}) ⇒ Array<Twitter::Tweet> #list_timeline(user, list, options = {}) ⇒ Array<Twitter::Tweet>
Show tweet timeline for members of the specified list
59 60 61 62 63 64 |
# File 'lib/twitter/rest/lists.rb', line 59 def list_timeline(*args) arguments = Twitter::Arguments.new(args) merge_list!(arguments., arguments.pop) merge_owner!(arguments., arguments.pop) perform_get_with_objects('/1.1/lists/statuses.json', arguments., Twitter::Tweet) end |
#list_unsubscribe(list, options = {}) ⇒ Twitter::List #list_unsubscribe(user, list, options = {}) ⇒ Twitter::List
Unsubscribes the authenticated user form the specified list
183 184 185 |
# File 'lib/twitter/rest/lists.rb', line 183 def list_unsubscribe(*args) list_from_response(:post, '/1.1/lists/subscribers/destroy.json', args) end |
#list_update(list, options = {}) ⇒ Twitter::List #list_update(user, list, options = {}) ⇒ Twitter::List
Updates the specified list
314 315 316 |
# File 'lib/twitter/rest/lists.rb', line 314 def list_update(*args) list_from_response(:post, '/1.1/lists/update.json', args) end |
#lists(options = {}) ⇒ Array<Twitter::List> #lists(user, options = {}) ⇒ Array<Twitter::List> Also known as: lists_subscribed_to
Returns all lists the authenticating or specified user subscribes to, including their own
33 34 35 |
# File 'lib/twitter/rest/lists.rb', line 33 def lists(*args) objects_from_response_with_user(Twitter::List, :get, '/1.1/lists/list.json', args) end |
#memberships(options = {}) ⇒ Twitter::Cursor #memberships(user, options = {}) ⇒ Twitter::Cursor
List the lists the specified user has been added to
104 105 106 |
# File 'lib/twitter/rest/lists.rb', line 104 def memberships(*args) cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/memberships.json', args) end |
#owned_lists(options = {}) ⇒ Array<Twitter::List> #owned_lists(user, options = {}) ⇒ Array<Twitter::List>
Returns the lists owned by the specified Twitter user
407 408 409 |
# File 'lib/twitter/rest/lists.rb', line 407 def owned_lists(*args) cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/ownerships.json', args) end |
#remove_list_member(list, user_to_remove, options = {}) ⇒ Twitter::List #remove_list_member(user, list, user_to_remove, options = {}) ⇒ Twitter::List
Removes the specified member from the list
83 84 85 |
# File 'lib/twitter/rest/lists.rb', line 83 def remove_list_member(*args) list_from_response_with_user('/1.1/lists/members/destroy.json', args) end |
#remove_list_members(list, users, options = {}) ⇒ Twitter::List #remove_list_members(user, list, users, options = {}) ⇒ Twitter::List
Removes specified members from the list
388 389 390 |
# File 'lib/twitter/rest/lists.rb', line 388 def remove_list_members(*args) list_from_response_with_users('/1.1/lists/members/destroy_all.json', args) end |
#subscriptions(options = {}) ⇒ Twitter::Cursor #subscriptions(user, options = {}) ⇒ Twitter::Cursor
List the lists the specified user follows
367 368 369 |
# File 'lib/twitter/rest/lists.rb', line 367 def subscriptions(*args) cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/subscriptions.json', args) end |