Sha256: d6be3831ea7f63a740b2e604a707bc78ee18ada16c7d366096a6929e9c00da82
Contents?: true
Size: 609 Bytes
Versions: 2
Compression:
Stored size: 609 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' require 'rest_client' require 'json' require 'pp' puts "creating a new playlist" resp = RestClient.post 'http://localhost:3000/playlists', :name=>'my shiny playlist' if resp.code == 201 location = resp.headers[:location] puts "201 created (#{location})" spotify_id = location[location.rindex('/')+1..-1] puts "adding some tracks to it" resp = RestClient.put "http://localhost:3000/playlists/#{spotify_id}", { "tracks" => [ {'id'=>'6qHiOf1BFCQIzAjJsRbMfY'}, {'id'=>'1VaucR6Bsks5Q9bYBsXvuF'} ] }.to_json puts resp else raise resp.to_s end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jberkel-spotify-api-0.0.1 | examples/create_playlist.rb |
jberkel-spotify-api-0.0.2 | examples/create_playlist.rb |