Module: Songkickr::RemoteApi::UpcomingEvents

Included in:
Songkickr::Remote
Defined in:
lib/songkickr/remote_api/upcoming_events.rb

Instance Method Summary collapse

Instance Method Details

#artist_events(artist_id_or_music_brainz_id, query = {}) ⇒ Object

Artist calendar (Upcoming)

Returns an array of Events.

ex. remote.artist_events('mbid:5bac9b4f-2f1c-4d39-8d11-231d5b6650ce', page: 1, per_page: 5, order: 'desc')

www.songkick.com/developer/upcoming-events-for-artist

Parameters

  • artist_id_or_music_brainz_id - Songkick unique ID for artist. Use artist_search to find an artist ID. Or a MusicBrainz.org id string. ex. mbid:5bac9b4f-2f1c-4d39-8d11-231d5b6650ce

  • query - A hash of query parameters, see below for options.

Query Parameters

  • page - Page number

  • per_page - Number of results per page, max 50.

  • order - Results are sorted by date. The order can be specified with: order ('asc' or 'desc', 'asc' by default).


19
20
21
22
23
24
25
26
27
28
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 19

def artist_events(artist_id_or_music_brainz_id, query = {})
  if artist_id_or_music_brainz_id.to_s.match(/^mbid\:\d+$/)
    url = "/artists/mbid:#{artist_id_or_music_brainz_id}/calendar.json"
  else
    url = "/artists/#{artist_id_or_music_brainz_id}/calendar.json"
  end

  result = get(url, query: query)
  Songkickr::EventResult.new result
end

#artist_search(query = {}) ⇒ Object

Artist Search API

Returns Artist objects.

www.songkick.com/developer/artist-search

Parameters

  • query - Search for artists by name using full text search. Results from Songkick are returned by relevancy.

Query Parameters

  • artist_name - Name of an artist. Ex. 'Lady Gaga', 'Slayer', 'Atmosphere'

  • page - Page number

  • per_page - Number of results per page, max 50.


42
43
44
45
46
47
48
49
50
51
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 42

def artist_search(query = {})
  if query.is_a? String
    result = get("/search/artists.json", query: { query: query })
  elsif query.is_a? Hash
    artist_name = query.delete(:artist_name)
    result      = get("/search/artists.json", query: query.merge(query: artist_name))
  end

  Songkickr::ArtistResult.new result
end

#events(query = {}) ⇒ Object

Event Search API

www.songkick.com/developer/event-search

Parameters

  • query - A hash of query parameters, see below for options.

Example: { type: 'concert', artists: 'Coolio' }

Query Parameters

  • type - valid types: concert or festival

  • artists - events by any of the artists, comma-separated

  • artist_name - plain text name of artist ex. 'As I Lay Dying', 'Parkway Drive', 'Animals As Leaders'

  • artist_id - Songkick unique ID for an artist

  • venue_id - Songkick unique ID for a venue

  • setlist_item_name - name of a song which was played at the event – use with artist_id or artist_name

  • min_date - Oldest date for which you want to look for events

  • max_date - Most recent date for which you want to look for events

  • location - See the Songkick website for instructions on how to use the location parameter www.songkick.com/developer/location-search


71
72
73
74
75
76
77
78
79
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 71

def events(query = {})
  if query.is_a? String
    result = get("/events.json", query: { artist_name: query })
  elsif query.is_a? Hash
    result = get("/events.json", query: query)
  end

  Songkickr::EventResult.new result
end

#location_search(query = {}) ⇒ Object

Location Search API

www.songkick.com/developer/location-search

Parameters

  • query - A hash of query parameters, see below for options. Note: Only one of name, location, or ip may be used at a time.

Query Parameters

  • name - Metro area or city named 'location_name' string Ex. 'Minneapolis', 'Nashville', or 'London'.

  • location - 'geo:lat,lng' string Ex. 'geo:-0.128,51.5078'

  • ip - 'ip:ip-addr' string Ex. 'ip:123.123.123.123'

  • page - Page number

  • per_page - Number of results per page, max 50.


93
94
95
96
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 93

def location_search(query = {})
  result = get("/search/locations.json", query: query)
  Songkickr::LocationResult.new result
end

#location_search_geo(latitude, longitude, options = {}) ⇒ Object

Location Search by geographic coordinates

Parameters

  • latitude - float Ex. 44.67

  • longitude - float Ex. -19.35

  • options - hash of additional options such as page and per_page


104
105
106
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 104

def location_search_geo(latitude, longitude, options = {})
  location_search(options.merge(location: "geo:#{latitude},#{longitude}"))
end

#location_search_ip(ip_address, options = {}) ⇒ Object

Location Search by IP address

Parameters

  • ip_address string Ex. '123.123.123.123'

  • options - hash of additional options such as page and per_page


113
114
115
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 113

def location_search_ip(ip_address, options = {})
  location_search(options.merge(location: "ip:#{ip_address}"))
end

#location_search_metro_area_name(metro_area_name, options = {}) ⇒ Object

Location Search by metro area name

Parameters

  • metro_area_name - Metro area or city named 'location_name' string Ex. 'Minneapolis', 'Nashville', or 'London'.

  • options - hash of additional options such as page and per_page


122
123
124
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 122

def location_search_metro_area_name(metro_area_name, options = {})
  location_search(options.merge(query: metro_area_name))
end

#metro_areas_events(metro_area_id, query = {}) ⇒ Object

Metro Area Events (Upcoming)

Returns an array of Events.

www.songkick.com/developer/upcoming-events-for-metro-area

Parameters

  • metro_area_id - Songkick unique ID for metro areas. Use location_search to find a metro area ID.

  • query - A hash of query parameters, see below for options.

Query Parameters

  • page - Page number

  • per_page - Number of results per page, max 50.


138
139
140
141
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 138

def metro_areas_events(metro_area_id, query = {})
  result = get("/metro_areas/#{metro_area_id}/calendar.json", query: query)
  Songkickr::EventResult.new result
end

#venue_calendar(venue_id) ⇒ Object

Venue Calendar

www.songkick.com/developer/upcoming-events-for-venue

Parameters

  • venue_id - Songkick venue ID.


149
150
151
152
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 149

def venue_calendar(venue_id)
  result = get("/venues/#{venue_id}/calendar.json")
  Songkickr::EventResult.new result
end

#venue_search(query) ⇒ Object

Venue Search

www.songkick.com/developer/venue-search

Parameters

  • query - A hash of query parameters, see below for options.

Query Parameters

  • query - Venue name search string

  • page - Page number

  • per_page - Number of results per page, max 50.


165
166
167
168
# File 'lib/songkickr/remote_api/upcoming_events.rb', line 165

def venue_search(query)
  result = get("/search/venues.json", query: query)
  Songkickr::VenueResult.new result
end