Ruby library for interfacing with the BandCamp.com API
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib Bump version to 0.2.1 Aug 18, 2014
spec Update dev dependencies to Rspec 3. Aug 18, 2014
.gitignore
.rspec Initial commit Jan 8, 2013
Gemfile Initial commit Jan 8, 2013
LICENSE.txt Initial commit Jan 8, 2013
README.md
Rakefile Initial commit Jan 8, 2013
bandcamp_api.gemspec Update dev dependencies to Rspec 3. Aug 18, 2014

README.md

Bandcamp

This is a gem that wraps the Bandcamp API in a warm Rubyish hug. To use it you will need to request an API key from them. For details see [http://bandcamp.com/developer#key_request][].

Usage

In your Gemfile

gem install bandcamp_api

Getting started:

require 'bandcamp_api'
Bandcamp.config.api_key = "your_api_key"

Search

Search the Bandcamp.com API by band name:

matching_bands = Bandcamp.search "pitch black"
=> [#<Bandcamp::Band:0x00000001efa168>, #<Bandcamp::Band:0x00000001e53278>, ...]

Resolving URLs

Bandcamp lets you resolve a given url to given band, track or album:

sea_oleena = Bandcamp.resolve.url "seaoleena.bandcamp.com"
=> #<Bandcamp::Band:0x00000001ef20f8>

emoxygen_by_sun_monx = Bandcamp.resolve.url "http://interchill.bandcamp.com/track/emoxygen"

Getting stuff

A specific track:

evolution_11 = Bandcamp.get.track 1735088360
=> #<Bandcamp::Track:0x0000000162c7e8>

Many specific tracks:

tracks = Bandcamp.get.tracks 1735088360, 1739611553
=> [#<Bandcamp::Track:0x00000001316ab8>, #<Bandcamp::Track:0x00000001314a10>, ...]

A band:

pitchblack = Bandcamp.get.band 950934886
=> #<Bandcamp::Band:0x000000017d43e8>

An album:

ape_to_angel = Bandcamp.get.album 2909726980
=> #<Bandcamp::Album:0x00000001e20c60>

Bands, Albums and Tracks all have a #to_json method that does what you would expect a to_json method to do.

TODO list

  • A nice interface for requesting discographies.
  • Rails 3 integration so you can use these ojects with partials and form_for.
  • Duck typing helpers along the lines of ActiveSupport's #acts_like?

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

(The MIT License)

Copyright (c) 2013 Mike Williamson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.