Skip to content
Ruby Client for the Spotify Web API
Branch: master
Clone or download
masterkain Merge pull request #17 from pake007/master
Add me_following API end-point
Latest commit 2368530 May 25, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add me_following API end-point Oct 12, 2015
spec Add me_following API end-point Oct 12, 2015
.gemrelease gemrelease Jul 20, 2014
.gitignore Improve .user_playlist_tracks Jul 20, 2014
.rspec first commit Jun 19, 2014
Gemfile first commit Jun 19, 2014
Guardfile first commit Jun 19, 2014
LICENSE first commit Jun 19, 2014 update readme Jun 18, 2015
Rakefile first commit Jun 19, 2014
spotify-client.gemspec first commit Jun 19, 2014


Ruby Client for the Spotify Web API.

Gem Version


Add this line to your application's Gemfile:

gem 'spotify-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spotify-client

Features and Goals

  • Optional persistent connections
  • Ease of use
  • Extremely light footprint, memory is always a concern.
  • Be future-proof.

Usage / Notes

This gem is pretty new and it should not be used in production environments yet.

It has been tested on Ruby 2.1+ only. Feel free to play around with it.

# Sample configuration:
config = {
  :access_token => 'tk',  # initialize the client with an access token to perform authenticated calls
  :raise_errors => true,  # choose between returning false or raising a proper exception when API calls fails

  # Connection properties
  :retries       => 0,    # automatically retry a certain number of times before returning
  :read_timeout  => 10,   # set longer read_timeout, default is 10 seconds
  :write_timeout => 10,   # set longer write_timeout, default is 10 seconds
  :persistent    => false # when true, make multiple requests calls using a single persistent connection. Use +close_connection+ method on the client to manually clean up sockets
client =
# or with default options:
client =

If you want to perform authenticated calls include access_token during initialization. Note that there are particular calls that not only requires authentication but the correct scopes.

Read more about scopes here.

# Current methods' signatures
client.user_playlist(user_id, playlist_id)
client.user_playlist_tracks(user_id, playlist_id, params = {})
client.create_user_playlist(user_id, name, is_public = true)
client.add_user_tracks_to_playlist(user_id, playlist_id, uris = [], position = nil)
client.remove_user_tracks_from_playlist(user_id, playlist_id, tracks)
client.replace_user_tracks_in_playlist(user_id, playlist_id, tracks)
client.truncate_user_playlist(user_id, playlist_id)
client.artist_albums(artist_id), term)
client.artist_top_tracks(artist_id, country_id)
client.follow(type, ids)
client.follow_playlist(user_id, playlist_id, is_public = true)

Please also refer to the source file spotify_client.rb.

More documentation will follow soon.


In order to use authenticated features you need to obtain access tokens. This feature is not supported (yet) by this gem, but if you'd like to let users authenticate against Spotify in a Rails/OmniAuth app you can use icoretech/omniauth-spotify.


  • Finish the spec suite and start implementing VCR instead of single response mocks, which doesn't add much value.
  • More OAuth2 features?
  • Modeling / Hashie / Indifferent Access response encapsulation?
  • CI setup


Please refer to

You can’t perform that action at this time.