Module: Songkick::Search

Includes:
Validations
Included in:
Client
Defined in:
lib/songkick/client/search.rb

Instance Method Summary collapse

Methods included from Validations

#validate_options

Instance Method Details

#search_artists(text, page = 1) ⇒ Object Also known as: search_artist

Search for artists

Example: sg = Songkick.new(“myapikey”) artists = sg.search_artists(“ladygaga”)



60
61
62
# File 'lib/songkick/client/search.rb', line 60

def search_artists(text, page = 1)
  get "search/artists.#{format}?query=#{text.gsub(" ","%20")}", page
end

#search_events(opts, page = 1) ⇒ Object Also known as: search_event

Search for upcoming events

Options:

  • artist_name

  • location

    • sk

    • geo

    • ip

    • clientip

  • min_date

  • max_date

Look at this page for more information about the location option: www.songkick.com/developer/event-search

Example: sg = Songkick.new(“myapikey”) events = sg.search_events(=> “lady gaga”) events = sg.search_events(=> “lady gaga”, 2) events = sg.search_events(=> “lady gaga”, :location => “clientip=10.10.10.10” )})



27
28
29
30
31
32
# File 'lib/songkick/client/search.rb', line 27

def search_events(opts, page = 1)
  validate_options %w(artist_name location min_date max_date), opts
  
  _opts = opts.collect{|k, v| "#{k}=#{v.gsub(" ", "%20")}"}.join("&")
  get "events.#{format}?#{_opts}", page
end

#search_locations(opts, page = 1) ⇒ Object Also known as: search_location

Search for locations

Options:

  • query

  • location

Look at this page for more information about the location option: www.songkick.com/developer/location-search

Example: sg = Songkick.new(“myapikey”) locations = sg.search_locations(=> “Paris”)



47
48
49
50
51
52
# File 'lib/songkick/client/search.rb', line 47

def search_locations(opts, page = 1)
  validate_options %w(query location), opts
  
  _opts = opts.collect{|k, v| "#{k}=#{v.gsub(" ", "%20")}"}.join("&")
  get "search/locations.#{format}?#{_opts}", page
end

#search_venues(text, page = 1) ⇒ Object

Search for venues



66
67
68
# File 'lib/songkick/client/search.rb', line 66

def search_venues(text, page = 1)
  get "search/venues.#{format}?query=#{text.gsub(" ","%20")}", page   
end