Module: Mastodon::REST::Media
Instance Method Summary collapse
-
#update_media(id, params) ⇒ Mastodon::Media
Update a media description, can only be updated while it’s not associated to a status.
-
#upload_media(file, params = {}) ⇒ Mastodon::Media
Upload a media file.
Methods included from Utils
#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object
Instance Method Details
#update_media(id, params) ⇒ Mastodon::Media
Update a media description, can only be updated while it’s not associated to a status
26 27 28 |
# File 'lib/mastodon/rest/media.rb', line 26 def update_media(id, params) perform_request_with_object(:put, "/api/v1/media/#{media_id}", params, Mastodon::Media) end |
#upload_media(file, params = {}) ⇒ Mastodon::Media
Upload a media file
15 16 17 18 |
# File 'lib/mastodon/rest/media.rb', line 15 def upload_media(file, params = {}) file = file.is_a?(HTTP::FormData::File) ? file : HTTP::FormData::File.new(file) perform_request_with_object(:post, '/api/v1/media', { file: file }.merge(params), Mastodon::Media) end |