Class: Spotify::AlbumsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/spotify/resources/albums.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Spotify::Resource

Instance Method Details

#get(id:, market: nil) ⇒ Object



7
8
9
10
# File 'lib/spotify/resources/albums.rb', line 7

def get(id:, market: nil)
  response = get_request("albums/#{id}", params: { market: market })
  Album.new response.body
end

#list(ids:, market: nil) ⇒ Object



3
4
5
6
# File 'lib/spotify/resources/albums.rb', line 3

def list(ids:, market: nil)
  response = get_request("albums", params: { ids: ids, market: market })
  Collection.from_response(response, type: Album, key: "albums")
end

#tracks(id:, **params) ⇒ Object



11
12
13
14
# File 'lib/spotify/resources/albums.rb', line 11

def tracks(id:, **params)
  response = get_request("albums/#{id}/tracks", params: params)
  Collection.from_response(response, type: Track, key: "items")
end