1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
module TwitterOAuth
class Client
#
# List methods
#
# Creates a new list for the authenticated user. Accounts are limited to 20 lists.
def create_list(user, list, options={})
post("/#{user}/lists.json", options.merge(:name => list))
end
# Updates the specified list.
def update_list(user, list, options={})
post("/#{user}/lists/#{list}.json", options)
end
# List the lists of the specified user.
# Private lists will be included if the authenticated user is the same as the user whose lists are being returned.
def get_lists(user)
get("/#{user}/lists.json")
end
# Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
def get_list(user, list)
get("/#{user}/lists/#{list}.json")
end
# Deletes the specified list. Must be owned by the authenticated user.
def delete_list(user, list)
delete("/#{user}/lists/#{list}.json")
end
# Show tweet timeline for members of the specified list.
def list_statuses(user, list)
get("/#{user}/lists/#{list}/statuses.json")
end
# List the lists the specified user has been added to.
def list_memberships(user)
get("/#{user}/lists/memberships.json")
end
# List the lists the specified user follows.
def list_subscriptions(user)
get("/#{user}/lists/subscriptions.json")
end
#
# List Members Methods
#
# Returns the members of the specified list.
def list_members(user, list)
get("/#{user}/#{list}/members.json")
end
# Add a member to a list. The authenticated user must own the list to be able to add members to it.
# Lists are limited to having 500 members.
def add_member_to_list(user, list, member_id, options={})
post("/#{user}/#{list}/members.json", options.merge(:id => member_id))
end
# Removes the specified member from the list.
# The authenticated user must be the list's owner to remove members from the list.
def remove_member_from_list(user, list, member_id)
delete("/#{user}/#{list}/members.json?id=#{member_id}")
end
# Check if a user is a member of the specified list.
def get_member_of_list(user, list, member_id)
get("/#{user}/#{list}/members/#{member_id}.json")
end
#
# List Subscribers Methods
#
# Returns the subscribers of the specified list.
def list_subscribers(user, list)
get("/#{user}/#{list}/subscribers.json")
end
# Make the authenticated user follow the specified list.
def subscribe_to_list(user, list, options={})
post("/#{user}/#{list}/subscribers.json")
end
# Unsubscribes the authenticated user form the specified list.
def unsubscribe_from_list(user, list)
delete("/#{user}/#{list}/subscribers.json")
end
# Check if the specified user is a subscriber of the specified list.
def get_subscriber_of_list(user, list, subscriber_id)
get("/#{user}/#{list}/subscribers/#{subscriber_id}.json")
end
end
end
|