Class: Jammed::PeopleSearch
Overview
Provides methods for calling API endpoint /person.json?by=
Class Method Summary (collapse)
-
+ (Object) search_artist(artist, api_key)
Calls API for a search by artist.
-
+ (Object) search_name(name, api_key)
Calls API for a search by username.
-
+ (Object) search_track(artist, track, api_key)
Calls API for a search by track.
Methods inherited from API
Class Method Details
+ (Object) search_artist(artist, api_key)
Calls API for a search by artist
Attributes
-
artist - Artist to search by
-
api_key - The key to use with the API call
Examples
Jammed::PeopleSearch.search_artist('beach boys', '08972935872035')
33 34 35 36 37 |
# File 'lib/jammed/people_search.rb', line 33 def self.search_artist(artist, api_key) response = request(:get, "/search/person.json", :query => {:by => 'artist', :q => "#{artist.split.join('+')}", :key => api_key}) JSON.parse(response.body)['people'] end |
+ (Object) search_name(name, api_key)
Calls API for a search by username
Attributes
-
name - Username to search by
-
api_key - The key to use with the API call
Examples
Jammed::PeopleSearch.search_name('IFTFOM', '08972935872035')
17 18 19 20 21 |
# File 'lib/jammed/people_search.rb', line 17 def self.search_name(name, api_key) response = request(:get, "/search/person.json", :query => {:by => 'name', :q => "#{name.split.join('+')}", :key => api_key}) JSON.parse(response.body)['people'] end |
+ (Object) search_track(artist, track, api_key)
Calls API for a search by track
Attributes
-
artist - Artist to search by
-
track - Track to search by
-
api_key - The key to use with the API call
Examples
Jammed::PeopleSearch.search_track('beach boys', 'good vibrations', '08972935872035')
50 51 52 53 54 55 56 |
# File 'lib/jammed/people_search.rb', line 50 def self.search_track(artist, track, api_key) response = request(:get, "/search/person.json", :query => {:by => 'track', :q => "#{artist.split.join('+')}|#{track.split.join('+')}", :key => api_key}) JSON.parse(response.body)['people'] end |