Module: Shikimori::API::V1::UserImages

Included in:
Shikimori::API::V1
Defined in:
lib/shikimori/api/v1/user_images.rb

Overview

Methods for the User images API

Instance Method Summary collapse

Instance Method Details

#create_user_image(image, linked_type: nil, headers: nil, **query) ⇒ Hash

Create User image. Requires ‘comments` oauth scope

Examples:

Create user’s image

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.create_user_image(File.open('/tmp/file.jpg'), linked_type: 'Comment')

Parameters:

  • image (File)

    Image file

  • linked_type ('Comment') (defaults to: nil)

    Linking type

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing created user image

See Also:



28
29
30
31
32
# File 'lib/shikimori/api/v1/user_images.rb', line 28

def create_user_image(image, linked_type: nil, headers: nil, **query)
  rest.post base_url.join('user_images').url,
            { 'image' => image, 'linked_type' => linked_type }.compact,
            headers: headers, query: query, as_form: true
end