bandsintown

Description

Bandsintown.com API gem

A Ruby library for accessing the Bandsintown API.

The Bandsintown API lets any developer access the largest database of upcoming concert listings and concert tickets in the world.

For more information see Bandsintown.com API Documentation.

Installing

sudo gem install bandsintown

Usage

Requiring

require 'bandsintown'

Setting the bandsintown app_id parameter

Bandsintown.app_id = 'YOUR_APP_ID'

Find all upcoming events for a given artist

artist = Bandsintown::Artist.new({
  :name => 'The Killers'
})
events = artist.events

Find all upcoming events for a given artist using mbid (music brainz id)

# 486af4f0-a79b-468f-be73-527cd4caf6ea => mbid for Slick Rick
artist = Bandsintown::Artist.new({ 
  :mbid => "486af4f0-a79b-468f-be73-527cd4caf6ea"
})
events = artist.events

Find basic information about an artist without requesting event data

artist = Bandsintown::Artist.get({
  :name => "Raekwon"
})
artist.upcoming_events_count
=> 5
artist.on_tour?
=> true

Find basic information about an artist without requesting event data, using mbid

# 4e954b02-fae2-4bd7-9547-e055a6ac0527 => mbid for Raekwon
artist = Bandsintown::Artist.get({
  :mbid => "4e954b02-fae2-4bd7-9547-e055a6ac0527"
})
artist.upcoming_events_count
=> 5
artist.on_tour?
=> true

Find events this week around Boston, MA

events = Bandsintown::Event.search({
  :location => 'Boston, MA', 
  :start_date => Time.now,
  :end_date => 1.week.from_now
})

Find events this week for Mos Def and Talib Kweli

events = Bandsintown::Event.search({
  :artists => ['Mos Def', 'Talib Kweli'],
  :start_date => Time.now,
  :end_date => 1.week.from_now
})

Find events this month for Ghostface Killah and Raekwon using mbid (music brainz id)

# 3b39abeb-0064-4eed-9ddd-ee47a45c54cb => mbid for Ghostface Killah
# 4e954b02-fae2-4bd7-9547-e055a6ac0527 => mbid for Raekwon
events = Bandsintown::Event.search({
  :artists => [
    'mbid_3b39abeb-0064-4eed-9ddd-ee47a45c54cb', 
    'mbid_4e954b02-fae2-4bd7-9547-e055a6ac0527'
  ], 
  :start_date => Time.now.beginning_of_month, 
  :end_date => Time.now.end_of_month
})

Find recommended events around Boston, MA for fans of Led Zeppelin

events = Bandsintown::Event.recommended({
  :artists => ['Led Zeppelin'],
  :location => 'Boston, MA'
})

Find events added/updated/deleted within the last day

events = Bandsintown::Event.daily

Find events going on sale in the next week within 10 miles of Boston, MA

events = Bandsintown::Event.on_sale_soon({
  :location => "Boston, MA",
  :radius => 10
})

Find venues with name beginning with “House of Blues” near San Diego, CA

venues = Bandsintown::Venue.search({
  :query => "House of Blues",
  :location => "San Diego, CA"
})

Find all upcoming events for a given venue

# 1700 => Bandsintown venue ID for Paradise Rock Club in Boston, MA
venue = Bandsintown::Venue.new(1700)
events = venue.events

Create an event on bandsintown.com using Bandsintown::Artist and Bandsintown::Venue objects

# 1700 => Bandsintown venue ID for Paradise Rock Club in Boston, MA
Bandsintown::Event.create({
  :artists => [Bandsintown::Artist.new(:name => "The Roots")],
  :datetime => Time.parse("2010-06-01 20:00"),
  :venue => Bandsintown::Venue.new(1700),
  :ticket_url => "http://www.example.com/tickets/123",
  :ticket_price => 19.5,
  :on_sale_datetime => Time.parse("2010-05-01 12:00")
})

Create an event on bandsintown.com using artist names and venue location hash

# 1700 => Bandsintown venue ID for Paradise Rock Club in Boston, MA
Bandsintown::Event.create({
  :artists => ["Evidence", "Alchemist"],
  :datetime => "2010-06-01T19:30:00",
  :venue => { 
    :name => "Paradise Rock Club",
    :city => "Boston",
    :region => "MA",
    :country => "United States"
  },
  :ticket_url => "http://www.example.com/tickets/123",
  :ticket_price => 15,
  :on_sale_datetime => "2010-05-01T19:30:00"
})

Cancel an event on bandsintown.com

events = Bandsintown::Event.search(:location => "San Diego, CA")
event = events.first
event.cancel

Cancel an event on bandsintown.com for a single artist

artist = Bandsintown::Artist.new(:name => "Diamond District")
events = artist.events
event_id = events.first.bandsintown_id
artist.cancel_event(event_id)

Create an artist on bandsintown.com with name, music brainz id, myspace url, and website

artist = Bandsintown::Artist.create({
  :name => "A New Artist",
  :mbid => "abcd1234-abcd-1234-abcd-12345678abcd",
  :myspace_url => "http://www.myspace.com/anewartist",
  :website => "http://www.a-new-artist.com"
})

Create an artist on bandsintown.com with name only (all other parameters optional)

artist = Bandsintown::Artist.create({
  :name => "A New Artist"
})

Source

git clone git://github.com/bandsintown/bandsintown.git

Links

License

This code is free to use under the terms of the MIT license.

Theme extended from Paul Battley