Permalink
Browse files

Add get_compare_from_tasteometer to compare users, artists and myspaces

  • Loading branch information...
1 parent 457ef15 commit ccc2e9cb17e4c0bb098c9dbf89216869da3a85d3 @txus txus committed Oct 12, 2010
View
2 .rvmrc
@@ -1 +1 @@
-rvm --create use ruby-1.9.2@audioscrobbler > /dev/null
+rvm --create use ruby-1.9.2@lastfm > /dev/null
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- lastfm (0.0.1)
+ lastfm (1.0.1)
crack
GEM
@@ -10,26 +10,26 @@ GEM
crack (0.1.8)
diff-lcs (1.1.2)
fakeweb (1.3.0)
- rspec (2.0.0.beta.22)
- rspec-core (= 2.0.0.beta.22)
- rspec-expectations (= 2.0.0.beta.22)
- rspec-mocks (= 2.0.0.beta.22)
- rspec-core (2.0.0.beta.22)
- rspec-expectations (2.0.0.beta.22)
+ rspec (2.0.0)
+ rspec-core (= 2.0.0)
+ rspec-expectations (= 2.0.0)
+ rspec-mocks (= 2.0.0)
+ rspec-core (2.0.0)
+ rspec-expectations (2.0.0)
diff-lcs (>= 1.1.2)
- rspec-mocks (2.0.0.beta.22)
- rspec-core (= 2.0.0.beta.22)
- rspec-expectations (= 2.0.0.beta.22)
+ rspec-mocks (2.0.0)
+ rspec-core (= 2.0.0)
+ rspec-expectations (= 2.0.0)
vcr (1.1.2)
PLATFORMS
java
ruby
DEPENDENCIES
- bundler (>= 1.0.0)
+ bundler (>= 1.0.2)
crack
fakeweb
lastfm!
- rspec (>= 2.0.0.beta.22)
+ rspec (>= 2.0.0)
vcr
View
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "crack"
- s.add_development_dependency "bundler", ">= 1.0.0"
- s.add_development_dependency "rspec", ">= 2.0.0.beta.22"
+ s.add_development_dependency "bundler", ">= 1.0.2"
+ s.add_development_dependency "rspec", ">= 2.0.0"
s.add_development_dependency "fakeweb"
s.add_development_dependency "vcr"
View
@@ -1,3 +1,3 @@
module LastFM
- VERSION = "1.0.0"
+ VERSION = "1.0.1"
end
@@ -68,6 +68,15 @@ module LastFM
end
end
+ context "tasteometer" do
+ %w{compare}.each do |element|
+ specify "#get_#{element}_from_tasteometer" do
+ VCR.insert_cassette "tasteometer/#{element}_txusfm_and_josepjaume", :record => :new_episodes
+ expect {connection.send(:"get_#{element}_from_tasteometer", :type1 => 'user', :type2 => 'user', :value1 => 'txusfm', :value2 => 'josepjaume')}.to_not raise_error
+ end
+ end
+ end
+
context "track" do
%w{buylinks info similar topfans toptags search}.each do |element|
specify "#get_#{element}_from_track" do
@@ -0,0 +1,32 @@
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
+ method: :get
+ uri: http://ws.audioscrobbler.com:80/2.0/?method=tasteometer.getcompare&api_key=0db875056888d327c24d7a76374733f4&type1=user&type2=user&value1=txusfm&value2=josepjaume&format=json
+ body:
+ headers:
+ accept:
+ - "*/*"
+ user-agent:
+ - Ruby
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
+ code: 200
+ message: OK
+ headers:
+ date:
+ - Tue, 12 Oct 2010 10:58:50 GMT
+ server:
+ - Apache/1.3.39 (Unix)
+ x-proxy-fix-up:
+ - headers fixed up
+ x-web-node:
+ - www159
+ connection:
+ - close
+ content-type:
+ - application/json; charset=utf-8;
+ body: |
+ {"comparison":{"result":{"score":"0.83175492286682","artists":{"artist":[{"name":"Ratatat","url":"http:\/\/www.last.fm\/music\/Ratatat","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/65954.jpg","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/65954.jpg","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/65954.jpg","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/65954.jpg","size":"extralarge"}]},{"name":"Chris Cornell","url":"http:\/\/www.last.fm\/music\/Chris+Cornell","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/427945.jpg","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/427945.jpg","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/427945.jpg","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/427945.jpg","size":"extralarge"}]},{"name":"Darwin Deez","url":"http:\/\/www.last.fm\/music\/Darwin+Deez","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/43591551.jpg","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/43591551.jpg","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/43591551.jpg","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/43591551.jpg","size":"extralarge"}]},{"name":"The Temper Trap","url":"http:\/\/www.last.fm\/music\/The+Temper+Trap","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/39208173.png","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/39208173.png","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/39208173.png","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/39208173.png","size":"extralarge"}]},{"name":"MSTRKRFT","url":"http:\/\/www.last.fm\/music\/MSTRKRFT","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/8477385.jpg","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/8477385.jpg","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/8477385.jpg","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/8477385.jpg","size":"extralarge"}]}],"@attr":{"matches":"10"}}},"input":{"user":[{"name":"txusfm","url":"http:\/\/www.last.fm\/user\/txusfm","image":[{"#text":"","size":"large"},{"#text":"","size":"medium"},{"#text":"","size":"small"},{"#text":"","size":"extralarge"}]},{"name":"josepjaume","url":"http:\/\/www.last.fm\/user\/josepjaume","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/616413.jpg","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/616413.jpg","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/616413.jpg","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/616413.jpg","size":"extralarge"}]}]}}}
+
+ http_version: "1.0"

0 comments on commit ccc2e9c

Please sign in to comment.