Module: Mastodon::REST::Statuses
Instance Method Summary collapse
-
#create_status(text, params = {}) ⇒ Mastodon::Status
Create new status.
-
#destroy_status(id) ⇒ Boolean
Destroy status.
-
#favourite(id) ⇒ Mastodon::Status
Favourite a status.
-
#favourited_by(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Get a list of accounts that favourited a toot.
-
#pin(id) ⇒ Mastodon::Status
Pin status on own profile.
-
#reblog(id) ⇒ Mastodon::Status
Reblog a status.
-
#reblogged_by(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Get a list of accounts that reblogged a toot.
-
#status(id) ⇒ Mastodon::Status
Retrieve status.
-
#statuses(account_id, options = {}) ⇒ Mastodon::Collection<Mastodon::Status>
Get a list of statuses by a user.
-
#unfavourite(id) ⇒ Mastodon::Status
Undo a favourite of a status.
-
#unpin(id) ⇒ Mastodon::Status
Unpin status from own profile.
-
#unreblog(id) ⇒ Mastodon::Status
Undo a reblog of a status.
Methods included from Utils
#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object
Instance Method Details
#create_status(text, params = {}) ⇒ Mastodon::Status
Create new status
20 21 22 23 24 25 |
# File 'lib/mastodon/rest/statuses.rb', line 20 def create_status(text, params = {}) params[:status] = text params[:'media_ids[]'] = params.delete(:media_ids) if params.key?(:media_ids) perform_request_with_object(:post, '/api/v1/statuses', params, Mastodon::Status) end |
#destroy_status(id) ⇒ Boolean
Destroy status
37 38 39 |
# File 'lib/mastodon/rest/statuses.rb', line 37 def destroy_status(id) !perform_request(:delete, "/api/v1/statuses/#{id}").nil? end |
#favourite(id) ⇒ Mastodon::Status
Favourite a status
58 59 60 |
# File 'lib/mastodon/rest/statuses.rb', line 58 def favourite(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/favourite", {}, Mastodon::Status) end |
#favourited_by(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Get a list of accounts that favourited a toot
89 90 91 |
# File 'lib/mastodon/rest/statuses.rb', line 89 def favourited_by(id, = {}) perform_request_with_collection(:get, "/api/v1/statuses/#{id}/favourited_by", , Mastodon::Account) end |
#pin(id) ⇒ Mastodon::Status
Pin status on own profile
96 97 98 |
# File 'lib/mastodon/rest/statuses.rb', line 96 def pin(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/pin", {}, Mastodon::Status) end |
#reblog(id) ⇒ Mastodon::Status
Reblog a status
44 45 46 |
# File 'lib/mastodon/rest/statuses.rb', line 44 def reblog(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/reblog", {}, Mastodon::Status) end |
#reblogged_by(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>
Get a list of accounts that reblogged a toot
77 78 79 |
# File 'lib/mastodon/rest/statuses.rb', line 77 def reblogged_by(id, = {}) perform_request_with_collection(:get, "/api/v1/statuses/#{id}/reblogged_by", , Mastodon::Account) end |
#status(id) ⇒ Mastodon::Status
Retrieve status
30 31 32 |
# File 'lib/mastodon/rest/statuses.rb', line 30 def status(id) perform_request_with_object(:get, "/api/v1/statuses/#{id}", {}, Mastodon::Status) end |
#statuses(account_id, options = {}) ⇒ Mastodon::Collection<Mastodon::Status>
Get a list of statuses by a user
119 120 121 |
# File 'lib/mastodon/rest/statuses.rb', line 119 def statuses(account_id, = {}) perform_request_with_collection(:get, "/api/v1/accounts/#{account_id}/statuses", , Mastodon::Status) end |
#unfavourite(id) ⇒ Mastodon::Status
Undo a favourite of a status
65 66 67 |
# File 'lib/mastodon/rest/statuses.rb', line 65 def unfavourite(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unfavourite", {}, Mastodon::Status) end |
#unpin(id) ⇒ Mastodon::Status
Unpin status from own profile
103 104 105 |
# File 'lib/mastodon/rest/statuses.rb', line 103 def unpin(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unpin", {}, Mastodon::Status) end |
#unreblog(id) ⇒ Mastodon::Status
Undo a reblog of a status
51 52 53 |
# File 'lib/mastodon/rest/statuses.rb', line 51 def unreblog(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unreblog", {}, Mastodon::Status) end |