A Ruby interface to the Rhapsody API.
This gem has been deprecated. Please use Napster gem instead.
Add this line to your application's Gemfile:
gem 'rhapsody'And then execute:
$ bundle
Or install it yourself as:
$ gem install rhapsody
A client prepares you to make calls to Rhapsody API. Here is an example code for setting up a client using implicit method.
require 'rhapsody'
options = {
api_key: 'API_KEY',
api_secret: 'API_SECRET',
}
client = Rhapsody::Client.new(options)client_hash = {
api_key: 'API_KEY',
api_secret: 'API_SECRET',
username: 'USERNAME',
password: 'PASSWORD'
}
client = Rhapsody::Client.new(client_hash)
client.password_grant
client.authentication.access_token # => returns access_token
client.authentication.refresh_token
client.authentication.expires_inclient_hash = {
api_key: 'API_KEY',
api_secret: 'API_SECRET',
redirect_uri: 'REDIRECT_URI',
auth_code: 'AUTH_CODE'
}
client = Rhapsody::Client.new(client_hash)
client.connect
client.authentication.access_token # => returns access_token
client.authentication.refresh_token
client.authentication.expires_inRhapsody gem uses RSpec and FactoryGirl.
-
Get the API key and API secret from Rhapsody Developers site.
-
Create a file called
config.ymlinspecdirectory. -
Add the following with the correct API key and API secret
config_variables:
API_KEY: 'API_KEY'
API_SECRET: 'API_SECRET'
USERNAME: 'USERNAME'
PASSWORD: 'PASSWORD'
REDIRECT_URI: 'REDIRECT_URI'-
$ bundle install -
$ rspec
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rhapsody.
The gem is available as open source under the terms of the MIT License.