insound_api
A ruby gem for accessing the insound.com Web Service API for affiliates.
Install
# Add the following to you Gemfile
gem 'insound_api'
# Update your bundle
bundle install
Setup
You will need to setup insound_api to use your credentials. If you are using rails, a good place to do this is in a initializer:
# /config/initializers/insound_api.rb
InsoundApi.setup do |config|
config.affiliate_id = 42
config.api_password = 'my_password'
end
Usage
Currently the API only supports searches and you must provide an artist param. There are some optional params (title, maxresults, format) you can find in their API Doc. The results contain some metadata about the search as well as two arrays of resulting products and artists:
results = InsoundApi.search(:artist => "Nofx", :maxresults => 50)
results.artists_total
=> 1
results.products_total
=> 36
artist = results.artists.first
artist.name
=> "NOFX"
product = results.products.first
product.title
=> "I Heard They Suck Live!"
Products have the following attributes: url, id, title, artist_name, format
and Artists have: url, id, name