Class: Echonest::Playlist
- Defined in:
- lib/echonest-ruby-api/playlist.rb
Instance Method Summary collapse
-
#initialize(api_key, artist) ⇒ Playlist
constructor
A new instance of Playlist.
- #next ⇒ Object
- #session_id ⇒ Object
Methods inherited from Base
base_uri, #endpoint, #entity_name, #get, #get_response, version, #which
Constructor Details
#initialize(api_key, artist) ⇒ Playlist
Returns a new instance of Playlist.
9 10 11 12 13 14 15 16 |
# 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 |
Instance Method Details
#next ⇒ Object
18 19 20 21 22 |
# 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 ⇒ Object
24 25 26 |
# File 'lib/echonest-ruby-api/playlist.rb', line 24 def session_id @session_id end |