Class: Spotted::Resources::Playlists::Images

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/playlists/images.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Images

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Images.

Parameters:



61
62
63
# File 'lib/spotted/resources/playlists/images.rb', line 61

def initialize(client:)
  @client = client
end

Instance Method Details

#list(playlist_id, request_options: {}) ⇒ Array<Spotted::Models::ImageObject>

Some parameter documentations has been truncated, see Models::Playlists::ImageListParams for more details.

Get the current image associated with a specific playlist.

Parameters:

  • playlist_id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) of the playli

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/spotted/resources/playlists/images.rb', line 49

def list(playlist_id, params = {})
  @client.request(
    method: :get,
    path: ["playlists/%1$s/images", playlist_id],
    model: Spotted::Internal::Type::ArrayOf[Spotted::ImageObject],
    options: params[:request_options]
  )
end

#update(playlist_id, body:, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Playlists::ImageUpdateParams for more details.

Replace the image used to represent a specific playlist.

Parameters:

  • playlist_id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) of the playli

  • body (Pathname, StringIO, IO, String, Spotted::FilePart)

    Base64 encoded JPEG image data, maximum payload size is 256 KB.

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/spotted/resources/playlists/images.rb', line 23

def update(playlist_id, params)
  parsed, options = Spotted::Playlists::ImageUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["playlists/%1$s/images", playlist_id],
    headers: {"content-type" => "image/jpeg", "accept" => "application/binary"},
    body: parsed[:body],
    model: StringIO,
    options: options
  )
end