Module: Twitter::REST::Lists
Overview
Methods for working with Twitter lists
Constant Summary collapse
- MAX_USERS_PER_REQUEST =
Maximum users per request
100
Constants included from Utils
Instance Method Summary collapse
-
#add_list_member(*args) ⇒ Twitter::List
Adds 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
Shows the specified list.
-
#list_member?(*args) ⇒ Boolean
Checks 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
Makes the authenticated user follow the specified list.
-
#list_subscriber?(*args) ⇒ Boolean
Checks 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>
Shows tweet timeline for members of the specified list.
-
#list_unsubscribe(*args) ⇒ Twitter::List
Unsubscribes the authenticated user from 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 user subscribes to, including their own.
-
#memberships(*args) ⇒ Twitter::Cursor
Lists 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
Lists 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.
Adds a member to a list
309 310 311 |
# File 'lib/twitter/rest/lists.rb', line 309 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.
Adds specified members to a list
238 239 240 |
# File 'lib/twitter/rest/lists.rb', line 238 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
377 378 379 |
# File 'lib/twitter/rest/lists.rb', line 377 def create_list(name, = {}) perform_post_with_object("/1.1/lists/create.json", .merge(name:), 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
332 333 334 |
# File 'lib/twitter/rest/lists.rb', line 332 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 are only shown if the authenticated user owns them.
Shows the specified list
400 401 402 |
# File 'lib/twitter/rest/lists.rb', line 400 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
Checks if a user is a member of the specified list
262 263 264 |
# File 'lib/twitter/rest/lists.rb', line 262 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
284 285 286 |
# File 'lib/twitter/rest/lists.rb', line 284 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
Makes the authenticated user follow the specified list
165 166 167 |
# File 'lib/twitter/rest/lists.rb', line 165 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
Checks if a user is a subscriber of the specified list
190 191 192 |
# File 'lib/twitter/rest/lists.rb', line 190 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
143 144 145 |
# File 'lib/twitter/rest/lists.rb', line 143 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>
Shows tweet timeline for members of the specified list
71 72 73 74 75 76 |
# File 'lib/twitter/rest/lists.rb', line 71 def list_timeline(*args) arguments = Arguments.new(args) merge_list!(arguments., arguments.pop) merge_owner!(arguments., arguments.pop) perform_get_with_objects("/1.1/lists/statuses.json", arguments., Tweet) end |
#list_unsubscribe(list, options = {}) ⇒ Twitter::List #list_unsubscribe(user, list, options = {}) ⇒ Twitter::List
Unsubscribes the authenticated user from the specified list
212 213 214 |
# File 'lib/twitter/rest/lists.rb', line 212 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
358 359 360 |
# File 'lib/twitter/rest/lists.rb', line 358 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 user subscribes to, including their own
39 40 41 |
# File 'lib/twitter/rest/lists.rb', line 39 def lists(*args) objects_from_response_with_user(List, :get, "/1.1/lists/list.json", args) end |
#memberships(options = {}) ⇒ Twitter::Cursor #memberships(user, options = {}) ⇒ Twitter::Cursor
Lists the lists the specified user has been added to
121 122 123 |
# File 'lib/twitter/rest/lists.rb', line 121 def memberships(*args) cursor_from_response_with_user(:lists, 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
464 465 466 |
# File 'lib/twitter/rest/lists.rb', line 464 def owned_lists(*args) cursor_from_response_with_user(:lists, 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
98 99 100 |
# File 'lib/twitter/rest/lists.rb', line 98 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
443 444 445 |
# File 'lib/twitter/rest/lists.rb', line 443 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
Lists the lists the specified user follows
419 420 421 |
# File 'lib/twitter/rest/lists.rb', line 419 def subscriptions(*args) cursor_from_response_with_user(:lists, List, "/1.1/lists/subscriptions.json", args) end |