Class: Spotted::Resources::Me::Albums

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/me/albums.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Albums

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 Albums.

Parameters:



105
106
107
# File 'lib/spotted/resources/me/albums.rb', line 105

def initialize(client:)
  @client = client
end

Instance Method Details

#check(ids: , request_options: {}) ⇒ Array<Boolean>

Some parameter documentations has been truncated, see Models::Me::AlbumCheckParams for more details.

Check if one or more albums is already saved in the current Spotify user’s ‘Your Music’ library.

Parameters:

  • ids (String)

    A comma-separated list of the [Spotify IDs](/documentation/web-api/concepts/spot

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

Returns:

  • (Array<Boolean>)

See Also:



53
54
55
56
57
58
59
60
61
62
# File 'lib/spotted/resources/me/albums.rb', line 53

def check(params)
  parsed, options = Spotted::Me::AlbumCheckParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/albums/contains",
    query: parsed,
    model: Spotted::Internal::Type::ArrayOf[Spotted::Internal::Type::Boolean],
    options: options
  )
end

#list(limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::Me::AlbumListResponse>

Some parameter documentations has been truncated, see Models::Me::AlbumListParams for more details.

Get a list of the albums saved in the current Spotify user’s ‘Your Music’ library.

Parameters:

  • limit (Integer)

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • market (String)

    An [ISO 3166-1 alpha-2 country code](en.wikipedia.org/wiki/ISO_3166-1_al

  • offset (Integer)

    The index of the first item to return. Default: 0 (the first item). Use with lim

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/spotted/resources/me/albums.rb', line 26

def list(params = {})
  parsed, options = Spotted::Me::AlbumListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/albums",
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::Models::Me::AlbumListResponse,
    options: options
  )
end

#remove(ids: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::Me::AlbumRemoveParams for more details.

Remove one or more albums from the current user’s ‘Your Music’ library.

Parameters:

  • ids (Array<String>)

    A JSON array of the [Spotify IDs](/documentation/web-api/concepts/spotify-uris-i

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

Returns:

  • (nil)

See Also:



78
79
80
81
# File 'lib/spotted/resources/me/albums.rb', line 78

def remove(params = {})
  parsed, options = Spotted::Me::AlbumRemoveParams.dump_request(params)
  @client.request(method: :delete, path: "me/albums", body: parsed, model: NilClass, options: options)
end

#save(ids: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::Me::AlbumSaveParams for more details.

Save one or more albums to the current user’s ‘Your Music’ library.

Parameters:

  • ids (Array<String>)

    A JSON array of the [Spotify IDs](/documentation/web-api/concepts/spotify-uris-i

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

Returns:

  • (nil)

See Also:



97
98
99
100
# File 'lib/spotted/resources/me/albums.rb', line 97

def save(params = {})
  parsed, options = Spotted::Me::AlbumSaveParams.dump_request(params)
  @client.request(method: :put, path: "me/albums", body: parsed, model: NilClass, options: options)
end