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].
In your Gemfile
gem install bandcamp_api
require 'bandcamp_api' Bandcamp.config.api_key = "your_api_key"
Search the Bandcamp.com API by band name:
matching_bands = Bandcamp.search "pitch black" => [#<Bandcamp::Band:0x00000001efa168>, #<Bandcamp::Band:0x00000001e53278>, ...]
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"
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>, ...]
pitchblack = Bandcamp.get.band 950934886 => #<Bandcamp::Band:0x000000017d43e8>
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.
- 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?
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
(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.