lib/songkickr/remote_api/upcoming_events.rb in songkickr-0.5.4 vs lib/songkickr/remote_api/upcoming_events.rb in songkickr-0.5.5

- old
+ new

@@ -2,11 +2,11 @@ module RemoteApi module UpcomingEvents # ==== 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') + # ex. remote.artist_events('mbid:5bac9b4f-2f1c-4d39-8d11-231d5b6650ce', page: 1, per_page: 5, order: 'desc') # # http://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 @@ -21,11 +21,11 @@ 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) + result = get(url, query: query) Songkickr::EventResult.new result end # ==== Artist Search API # Returns Artist objects. @@ -39,14 +39,14 @@ # * +artist_name+ - Name of an artist. <em>Ex. 'Lady Gaga', 'Slayer', 'Atmosphere'</em> # * +page+ - Page number # * +per_page+ - Number of results per page, max 50. def artist_search(query = {}) if query.is_a? String - result = get("/search/artists.json", :query => { :query => query }) + 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)) + result = get("/search/artists.json", query: query.merge(query: artist_name)) end Songkickr::ArtistResult.new result end @@ -54,11 +54,11 @@ # http://www.songkick.com/developer/event-search # # === Parameters # * +query+ - A hash of query parameters, see below for options. # - # _Example:_ <code>{ :type => 'concert', :artists => 'Coolio' }</code> + # _Example:_ <code>{ type: 'concert', artists: 'Coolio' }</code> # # ==== 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' @@ -68,13 +68,13 @@ # * +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 http://www.songkick.com/developer/location-search def events(query = {}) if query.is_a? String - result = get("/events.json", :query => { :artist_name => query }) + result = get("/events.json", query: { artist_name: query }) elsif query.is_a? Hash - result = get("/events.json", :query => query) + result = get("/events.json", query: query) end Songkickr::EventResult.new result end @@ -89,40 +89,40 @@ # * +location+ - 'geo:{lat,lng}' string <em>Ex. 'geo:{-0.128,51.5078}'</em> # * +ip+ - 'ip:{ip-addr}' string <em>Ex. 'ip:{123.123.123.123}'</em> # * +page+ - Page number # * +per_page+ - Number of results per page, max 50. def location_search(query = {}) - result = get("/search/locations.json", :query => query) + result = get("/search/locations.json", query: query) Songkickr::LocationResult.new result end # Location Search by geographic coordinates # # === Parameters # * +latitude+ - float <em>Ex. 44.67</em> # * +longitude+ - float <em>Ex. -19.35</em> # * +options+ - hash of additional options such as page and per_page def location_search_geo(latitude, longitude, options = {}) - location_search(options.merge(:location => "geo:#{latitude},#{longitude}")) + location_search(options.merge(location: "geo:#{latitude},#{longitude}")) end # Location Search by IP address # # === Parameters # * +ip_address+ string <em>Ex. '123.123.123.123'</em> # * +options+ - hash of additional options such as page and per_page - def location_search_ip(ip_address, options) - location_search(options.merge(:location => "ip:#{ip_address}")) + def location_search_ip(ip_address, options = {}) + location_search(options.merge(location: "ip:#{ip_address}")) end # Location Search by metro area name # # === Parameters # * +metro_area_name+ - Metro area or city named 'location_name' string <em>Ex. 'Minneapolis', 'Nashville', or 'London'</em>. # * +options+ - hash of additional options such as page and per_page - def location_search_metro_area_name(metro_area_name) - location_search(options.merge(:query => metro_area_name)) + def location_search_metro_area_name(metro_area_name, options = {}) + location_search(options.merge(query: metro_area_name)) end # ==== Metro Area Events (Upcoming) # Returns an array of Events. # @@ -134,11 +134,11 @@ # # ==== Query Parameters # * +page+ - Page number # * +per_page+ - Number of results per page, max 50. def metro_areas_events(metro_area_id, query = {}) - result = get("/metro_areas/#{metro_area_id}/calendar.json", :query => query) + result = get("/metro_areas/#{metro_area_id}/calendar.json", query: query) Songkickr::EventResult.new result end # ==== Venue Calendar # https://www.songkick.com/developer/upcoming-events-for-venue @@ -161,10 +161,10 @@ # ==== Query Parameters # * +query+ - Venue name search string # * +page+ - Page number # * +per_page+ - Number of results per page, max 50. def venue_search(query) - result = get("/search/venues.json", :query => query) + result = get("/search/venues.json", query: query) Songkickr::VenueResult.new result end end end end