Class: Spotted::Resources::Albums

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/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:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#list(ids: , market: nil, request_options: {}) ⇒ Spotted::Models::AlbumListResponse

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

Get Spotify catalog information for multiple albums identified by their Spotify IDs.

Parameters:

Returns:

See Also:



50
51
52
53
54
55
56
57
58
59
# File 'lib/spotted/resources/albums.rb', line 50

def list(params)
  parsed, options = Spotted::AlbumListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "albums",
    query: parsed,
    model: Spotted::Models::AlbumListResponse,
    options: options
  )
end

#list_tracks(id, limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::SimplifiedTrackObject>

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

Get Spotify catalog information about an album’s tracks. Optional parameters can be used to limit the number of tracks returned.

Parameters:

  • id (String)

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

  • 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:



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/spotted/resources/albums.rb', line 82

def list_tracks(id, params = {})
  parsed, options = Spotted::AlbumListTracksParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["albums/%1$s/tracks", id],
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::SimplifiedTrackObject,
    options: options
  )
end

#retrieve(id, market: nil, request_options: {}) ⇒ Spotted::Models::AlbumRetrieveResponse

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

Get Spotify catalog information for a single album.

Parameters:

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/spotted/resources/albums.rb', line 22

def retrieve(id, params = {})
  parsed, options = Spotted::AlbumRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["albums/%1$s", id],
    query: parsed,
    model: Spotted::Models::AlbumRetrieveResponse,
    options: options
  )
end