Module: SimpleSpotify::Actions::Albums

Defined in:
lib/simplespotify/actions/albums.rb

Instance Method Summary collapse

Instance Method Details

#album(album, market: nil) ⇒ Object



5
6
7
8
# File 'lib/simplespotify/actions/albums.rb', line 5

def album album, market: nil
  response = get "albums/#{id_for(album)}", options_with_market(market, {})
  Model::Album.new(response.body)
end

#album_tracks(album, limit: 20, offset: 0, market: nil) ⇒ Object



21
22
23
24
25
# File 'lib/simplespotify/actions/albums.rb', line 21

def album_tracks album, limit: 20, offset: 0, market: nil
  options = options_with_market(market, {limit: limit, offset: offset})
  response = get "albums/#{id_for(album)}/tracks", options
  Model::Collection.of(:tracks, response.body)
end

#albums(*albums, market: nil) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/simplespotify/actions/albums.rb', line 11

def albums *albums, market: nil
  albums = albums.map {|a|
    id_for(a)
  }.join(',')

  response = get "albums", options_with_market(market, {ids: albums})
  Model::Collection.of(:albums, response.body)
end