module Mastodon::REST::Media

Public Instance Methods

update_media(id, params) click to toggle source

Update a media description, can only be updated while it's not associated to a status @param id [Integer] @param params [Hash] @option params :description [String] Alternative text @option params :focus [String] Two floating points, comma-delimited @return [Mastodon::Media]

# 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 = {}) click to toggle source

Upload a media file @param file [File, StringIO, HTTP::FormData::File] @param params [Hash] @option params :description [String] Alternative text @option params :focus [String] Two floating points, comma-delimited @return [Mastodon::Media]

# 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