Module: Mastodon::REST::Statuses
Instance Method Summary collapse
- #create_status(text, *args) ⇒ Mastodon::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.
-
#mute_thread(id) ⇒ Mastodon::Status
Mute thread.
-
#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.
-
#unmute_thread(id) ⇒ Mastodon::Status
Unmute thread.
-
#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, in_reply_to_id, media_ids, visibility) ⇒ Mastodon::Status #create_status(text, args) ⇒ Mastodon::Status
26 27 28 29 30 31 32 33 |
# File 'lib/mastodon/rest/statuses.rb', line 26 def create_status(text, *args) params = normalize_status_params(*args) params[:status] = text params['media_ids[]'] ||= params.delete(:media_ids) perform_request_with_object(:post, '/api/v1/statuses', params, Mastodon::Status) end |
#destroy_status(id) ⇒ Boolean
Destroy status
46 47 48 |
# File 'lib/mastodon/rest/statuses.rb', line 46 def destroy_status(id) !perform_request(:delete, "/api/v1/statuses/#{id}").nil? end |
#favourite(id) ⇒ Mastodon::Status
Favourite a status
69 70 71 72 |
# File 'lib/mastodon/rest/statuses.rb', line 69 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
97 98 99 100 101 |
# File 'lib/mastodon/rest/statuses.rb', line 97 def favourited_by(id, = {}) perform_request_with_collection(:get, "/api/v1/statuses/#{id}/favourited_by", , Mastodon::Account) end |
#mute_thread(id) ⇒ Mastodon::Status
Mute thread
118 119 120 121 122 123 |
# File 'lib/mastodon/rest/statuses.rb', line 118 def mute_thread(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/mute", {}, Mastodon::Status) end |
#reblog(id) ⇒ Mastodon::Status
Reblog a status
53 54 55 56 |
# File 'lib/mastodon/rest/statuses.rb', line 53 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
87 88 89 90 91 |
# File 'lib/mastodon/rest/statuses.rb', line 87 def reblogged_by(id, = {}) perform_request_with_collection(:get, "/api/v1/statuses/#{id}/reblogged_by", , Mastodon::Account) end |
#status(id) ⇒ Mastodon::Status
Retrieve status
38 39 40 41 |
# File 'lib/mastodon/rest/statuses.rb', line 38 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
110 111 112 113 |
# File 'lib/mastodon/rest/statuses.rb', line 110 def statuses(account_id, = {}) url = "/api/v1/accounts/#{account_id}/statuses" perform_request_with_collection(:get, url, , Mastodon::Status) end |
#unfavourite(id) ⇒ Mastodon::Status
Undo a favourite of a status
77 78 79 80 81 |
# File 'lib/mastodon/rest/statuses.rb', line 77 def unfavourite(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unfavourite", {}, Mastodon::Status) end |
#unmute_thread(id) ⇒ Mastodon::Status
Unmute thread
128 129 130 131 132 133 |
# File 'lib/mastodon/rest/statuses.rb', line 128 def unmute_thread(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unmute", {}, Mastodon::Status) end |
#unreblog(id) ⇒ Mastodon::Status
Undo a reblog of a status
61 62 63 64 |
# File 'lib/mastodon/rest/statuses.rb', line 61 def unreblog(id) perform_request_with_object(:post, "/api/v1/statuses/#{id}/unreblog", {}, Mastodon::Status) end |