Skip to content

Commit

Permalink
Simplified get request
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Nov 12, 2010
1 parent a645817 commit 9127391
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
lastfm (1.0.1) lastfm (1.0.2)
crack crack


GEM GEM
Expand Down
8 changes: 2 additions & 6 deletions lib/lastfm/connection.rb
Expand Up @@ -33,12 +33,8 @@ def request(resource, method, *args)
args = "?method=#{resource}.#{method}&api_key=#{@key}#{formatted_options}" args = "?method=#{resource}.#{method}&api_key=#{@key}#{formatted_options}"


url = URI.parse(API_URL + "/" + args) url = URI.parse(API_URL + "/" + args)
req = Net::HTTP::Get.new(url.path + args) response = Net::HTTP.get(url)
res = Net::HTTP.start(url.host, url.port) {|http| Crack::JSON.parse(response)
http.request(req)
}

Crack::JSON.parse(res.body)
end end
end end
end end

0 comments on commit 9127391

Please sign in to comment.