class Echonest::Playlist

Public Class Methods

new(api_key, artist) click to toggle source
# File lib/echonest-ruby-api/playlist.rb, line 9
def initialize(api_key, artist) 
  @api_key = api_key
  @artist = artist
  @type = 'artist-radio'
  response = get('playlist/dynamic/create', 
    { artist: @artist, type: @type })
  @session_id = response[:session_id]
end

Public Instance Methods

next() click to toggle source
# File lib/echonest-ruby-api/playlist.rb, line 18
def next
  response = get('playlist/dynamic/next', { session_id: session_id })
  artist = Echonest::Artist.new(@api_key, response[:songs].first[:artist_name])
  { :artist => artist, :track => response[:songs].first[:title] }
end
session_id() click to toggle source
# File lib/echonest-ruby-api/playlist.rb, line 24
def session_id
  @session_id
end