Module: Mastodon::REST::Lists
Instance Method Summary collapse
-
#account_lists(id) ⇒ Mastodon::Collection<Mastodon::List>
Gets the lists this account is a part of.
-
#create_list(title) ⇒ Mastodon::List
Create a new list.
-
#delete_list(id) ⇒ Boolean
Delete a list.
-
#list(id) ⇒ Mastodon::List
Retrieve list.
-
#list_accounts(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Gets the accounts that are in a list.
-
#list_add_accounts(id, *accounts) ⇒ Object
Add accounts to a list.
-
#list_remove_accounts(id, *accounts) ⇒ Object
Add accounts to a list.
-
#lists ⇒ Mastodon::Collections<Mastodon::List>
Retrieve all lists.
-
#update_list(id, options = {}) ⇒ Mastodon::List
Update a list.
Methods included from Utils
#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object
Instance Method Details
#account_lists(id) ⇒ Mastodon::Collection<Mastodon::List>
Gets the lists this account is a part of
59 60 61 62 |
# File 'lib/mastodon/rest/lists.rb', line 59 def account_lists(id) perform_request_with_collection(:get, "/api/v1/accounts/#{id}/lists", {}, Mastodon::List) end |
#create_list(title) ⇒ Mastodon::List
Create a new list
30 31 32 33 34 |
# File 'lib/mastodon/rest/lists.rb', line 30 def create_list(title) = { title: title } perform_request_with_object(:post, '/api/v1/lists', , Mastodon::List) end |
#delete_list(id) ⇒ Boolean
Delete a list
67 68 69 |
# File 'lib/mastodon/rest/lists.rb', line 67 def delete_list(id) !perform_request(:delete, "/api/v1/lists/#{id}").nil? end |
#list(id) ⇒ Mastodon::List
Retrieve list
14 15 16 17 |
# File 'lib/mastodon/rest/lists.rb', line 14 def list(id) perform_request_with_object(:get, "/api/v1/lists/#{id}", {}, Mastodon::List) end |
#list_accounts(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Gets the accounts that are in a list
51 52 53 54 |
# File 'lib/mastodon/rest/lists.rb', line 51 def list_accounts(id, = {}) perform_request_with_collection(:get, "/api/v1/lists/#{id}/accounts", , Mastodon::List) end |
#list_add_accounts(id, *accounts) ⇒ Object
Add accounts to a list
74 75 76 77 78 79 |
# File 'lib/mastodon/rest/lists.rb', line 74 def list_add_accounts(id, *accounts) = {} ['account_ids[]'] = accounts perform_request(:post, "/api/v1/lists/#{id}/accounts", ) end |
#list_remove_accounts(id, *accounts) ⇒ Object
Add accounts to a list
84 85 86 87 88 89 |
# File 'lib/mastodon/rest/lists.rb', line 84 def list_remove_accounts(id, *accounts) = {} ['account_ids[]'] = accounts perform_request(:delete, "/api/v1/lists/#{id}/accounts", ) end |
#lists ⇒ Mastodon::Collections<Mastodon::List>
Retrieve all lists
22 23 24 25 |
# File 'lib/mastodon/rest/lists.rb', line 22 def lists perform_request_with_collection(:get, '/api/v1/lists', {}, Mastodon::List) end |
#update_list(id, options = {}) ⇒ Mastodon::List
Update a list
41 42 43 44 |
# File 'lib/mastodon/rest/lists.rb', line 41 def update_list(id, = {}) perform_request_with_object(:put, "/api/v1/lists/#{id}", , Mastodon::List) end |