From aefdb6f2a988004f5689b4f2b8cf22a076e125af Mon Sep 17 00:00:00 2001 From: Sean Lerner Date: Wed, 25 Apr 2012 08:44:57 -0700 Subject: [PATCH] removed Jammed::Search --- lib/jammed.rb | 8 +------- lib/jammed/people_search.rb | 8 +++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/jammed.rb b/lib/jammed.rb index 9a89afd..158c83f 100644 --- a/lib/jammed.rb +++ b/lib/jammed.rb @@ -4,13 +4,7 @@ require file end -module Jammed - - class Search #:nodoc: - include HTTParty - base_uri 'http://api.thisismyjam.com/1' - end - +module Jammed class << self #Creates a Jammed::Base object for interacting with the API # diff --git a/lib/jammed/people_search.rb b/lib/jammed/people_search.rb index fc347a7..74c566c 100644 --- a/lib/jammed/people_search.rb +++ b/lib/jammed/people_search.rb @@ -48,9 +48,11 @@ def self.search_artist(artist, api_key) # # Jammed::PeopleSearch.search_track('beach boys', 'good vibrations', '08972935872035') def self.search_track(artist, track, api_key) - uri = URI.escape("/search/person.json?by=track&q=#{artist.split.join('+')}|#{track.split.join('+')}&key=#{api_key}", '|') - search = Search.get uri - search["people"][0] ? search["people"] : "No tracks found" + 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 end