Module: Twitter::API::Lists
Constant Summary collapse
- MAX_USERS_PER_REQUEST =
100
Constants included from Utils
Instance Method Summary collapse
-
#list(*args) ⇒ Twitter::List
Show the specified list.
-
#list_add_member(*args) ⇒ Twitter::List
Add a member to a list.
-
#list_add_members(*args) ⇒ Twitter::List
Adds specified members to a list.
-
#list_create(name, options = {}) ⇒ Twitter::List
Creates a new list for the authenticated user.
-
#list_destroy(*args) ⇒ Twitter::List
Deletes 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_remove_member(*args) ⇒ Twitter::List
Removes the specified member from the list.
-
#list_remove_members(*args) ⇒ Twitter::List
Removes specified members from the 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.
-
#subscriptions(*args) ⇒ Twitter::Cursor
List the lists the specified user follows.
Instance Method Details
#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
450 451 452 |
# File 'lib/twitter/api/lists.rb', line 450 def list(*args) list_from_response(:get, "/1.1/lists/show.json", args) end |
#list_add_member(list, user_to_add, options = {}) ⇒ Twitter::List #list_add_member(user, list, user_to_add, options = {}) ⇒ Twitter::List
Lists are limited to having 500 members.
Add a member to a list
348 349 350 |
# File 'lib/twitter/api/lists.rb', line 348 def list_add_member(*args) list_from_response_with_user(:post, "/1.1/lists/members/create.json", args) end |
#list_add_members(list, users, options = {}) ⇒ Twitter::List #list_add_members(user, list, users, options = {}) ⇒ Twitter::List
Lists are limited to having 500 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
264 265 266 |
# File 'lib/twitter/api/lists.rb', line 264 def list_add_members(*args) list_from_response_with_users(:post, "/1.1/lists/members/create_all.json", args) end |
#list_create(name, options = {}) ⇒ Twitter::List
Accounts are limited to 20 lists.
Creates a new list for the authenticated user
423 424 425 |
# File 'lib/twitter/api/lists.rb', line 423 def list_create(name, ={}) object_from_response(Twitter::List, :post, "/1.1/lists/create.json", .merge(:name => name)) end |
#list_destroy(list, options = {}) ⇒ Twitter::List #list_destroy(user, list, options = {}) ⇒ Twitter::List
Must be owned by the authenticated user.
Deletes the specified list
375 376 377 |
# File 'lib/twitter/api/lists.rb', line 375 def list_destroy(*args) list_from_response(:post, "/1.1/lists/destroy.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
291 292 293 |
# File 'lib/twitter/api/lists.rb', line 291 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
319 320 321 |
# File 'lib/twitter/api/lists.rb', line 319 def list_members(*args) cursor_from_response_with_list(:get, "/1.1/lists/members.json", args, :list_members) end |
#list_remove_member(list, user_to_remove, options = {}) ⇒ Twitter::List #list_remove_member(user, list, user_to_remove, options = {}) ⇒ Twitter::List
Removes the specified member from the list
99 100 101 |
# File 'lib/twitter/api/lists.rb', line 99 def list_remove_member(*args) list_from_response_with_user(:post, "/1.1/lists/members/destroy.json", args) end |
#list_remove_members(list, users, options = {}) ⇒ Twitter::List #list_remove_members(user, list, users, options = {}) ⇒ Twitter::List
Removes specified members from the list
505 506 507 |
# File 'lib/twitter/api/lists.rb', line 505 def list_remove_members(*args) list_from_response_with_users(:post, "/1.1/lists/members/destroy_all.json", args) end |
#list_subscribe(list, options = {}) ⇒ Twitter::List #list_subscribe(user, list, options = {}) ⇒ Twitter::List
Make the authenticated user follow the specified list
176 177 178 |
# File 'lib/twitter/api/lists.rb', line 176 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
206 207 208 |
# File 'lib/twitter/api/lists.rb', line 206 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
151 152 153 |
# File 'lib/twitter/api/lists.rb', line 151 def list_subscribers(*args) cursor_from_response_with_list(:get, "/1.1/lists/subscribers.json", args, :list_subscribers) 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
67 68 69 70 71 72 |
# File 'lib/twitter/api/lists.rb', line 67 def list_timeline(*args) arguments = Twitter::API::Arguments.new(args) merge_list!(arguments., arguments.pop) merge_owner!(arguments., arguments.pop || screen_name) unless arguments.[:owner_id] || arguments.[:owner_screen_name] objects_from_response(Twitter::Tweet, :get, "/1.1/lists/statuses.json", arguments.) end |
#list_unsubscribe(list, options = {}) ⇒ Twitter::List #list_unsubscribe(user, list, options = {}) ⇒ Twitter::List
Unsubscribes the authenticated user form the specified list
231 232 233 |
# File 'lib/twitter/api/lists.rb', line 231 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
405 406 407 |
# File 'lib/twitter/api/lists.rb', line 405 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
34 35 36 |
# File 'lib/twitter/api/lists.rb', line 34 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
124 125 126 |
# File 'lib/twitter/api/lists.rb', line 124 def memberships(*args) cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/memberships.json", args, :memberships) end |
#subscriptions(options = {}) ⇒ Twitter::Cursor #subscriptions(user, options = {}) ⇒ Twitter::Cursor
List the lists the specified user follows
473 474 475 |
# File 'lib/twitter/api/lists.rb', line 473 def subscriptions(*args) cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/subscriptions.json", args, :subscriptions) end |