lastfm 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -52,6 +52,10 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
52
52
 
53
53
  * {tag.getTopArtists}[http://www.lastfm.jp/api/show/tag.getTopArtists]
54
54
 
55
+ === Tasteometer
56
+
57
+ * {tasteometer.compare}[http://www.lastfm.jp/api/show/tasteometer.compare]
58
+
55
59
  === Track
56
60
 
57
61
  * {track.addTags}[http://www.lastfm.jp/api/show?service=304]
data/lastfm.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = %q{lastfm}
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "1.9.0"
15
+ gem.version = "1.10.0"
16
16
 
17
17
  gem.add_dependency "xml-simple"
18
18
  gem.add_dependency "httparty"
@@ -0,0 +1,9 @@
1
+ class Lastfm
2
+ module MethodCategory
3
+ class Tasteometer < Base
4
+ regular_method :compare, [:type1, :type2, :value1, :value2], [[:limit, nil]] do |response|
5
+ response.xml['comparison']['result']
6
+ end
7
+ end
8
+ end
9
+ end
data/lib/lastfm.rb CHANGED
@@ -13,6 +13,7 @@ require 'lastfm/method_category/event'
13
13
  require 'lastfm/method_category/geo'
14
14
  require 'lastfm/method_category/library'
15
15
  require 'lastfm/method_category/tag'
16
+ require 'lastfm/method_category/tasteometer'
16
17
  require 'lastfm/method_category/track'
17
18
  require 'lastfm/method_category/user'
18
19
 
@@ -67,6 +68,10 @@ class Lastfm
67
68
  MethodCategory::Tag.new(self)
68
69
  end
69
70
 
71
+ def tasteometer
72
+ MethodCategory::Tasteometer.new(self)
73
+ end
74
+
70
75
  def track
71
76
  MethodCategory::Track.new(self)
72
77
  end
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0"?>
2
+ <lfm status="ok">
3
+ <comparison>
4
+ <result>
5
+ <score>0.74</score>
6
+ <artists matches="43">
7
+ <artist>
8
+ <name>Radiohead</name>
9
+ <url>http://www.last.fm/music/Radiohead</url>
10
+ <image size="large">http://userserve-ak.last.fm/serve/160/169665.gif</image>
11
+ <image size="medium">http://userserve-ak.last.fm/serve/85/169665.gif</image>
12
+ <image size="small">http://userserve-ak.last.fm/serve/50/169665.gif</image>
13
+ </artist>
14
+ <artist>
15
+ <name>The Beatles</name>
16
+ <url>http://www.last.fm/music/The+Beatles</url>
17
+ <image size="large">http://userserve-ak.last.fm/serve/160/153358.jpg</image>
18
+ <image size="medium">http://userserve-ak.last.fm/serve/85/153358.jpg</image>
19
+ <image size="small">http://userserve-ak.last.fm/serve/50/153358.jpg</image>
20
+ </artist>
21
+ </artists>
22
+ </result>
23
+ <input>
24
+ <user>
25
+ <name>jwheare</name>
26
+ <url>http://www.last.fm/user/jwheare/</url>
27
+ <image size="large">http://userserve-ak.last.fm/serve/160/857567.png</image>
28
+ <image size="medium">http://userserve-ak.last.fm/serve/85/857567.png</image>
29
+ <image size="small">http://userserve-ak.last.fm/serve/50/857567.png</image>
30
+ </user>
31
+ <myspace>
32
+ <url>http://www.myspace.com/mcscrobbler</url>
33
+ <image>http://x.myspace.com/images/clear.gif</image>
34
+ </myspace>
35
+ </input>
36
+ </comparison>
37
+ </lfm>
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe '#tasteometer' do
4
+ before { init_lastfm }
5
+
6
+ it 'should return an instance of Lastfm::Tasteometer' do
7
+ @lastfm.tasteometer.should be_an_instance_of(Lastfm::MethodCategory::Tasteometer)
8
+ end
9
+
10
+ describe '#compare' do
11
+ it 'should compare users' do
12
+ @lastfm.should_receive(:request).with('tasteometer.compare', {
13
+ :type1 => 'user',
14
+ :type2 => 'user',
15
+ :value1 => 'foo',
16
+ :value2 => 'bar',
17
+ :limit => nil
18
+ }).and_return(make_response('tasteometer_compare'))
19
+ compare = @lastfm.tasteometer.compare(:type1 => 'user', :type2 => 'user', :value1 =>'foo', :value2 => 'bar')
20
+ compare['score'].should == '0.74'
21
+ compare['artists']['artist'][1]['name'].should == 'The Beatles'
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-04 00:00:00.000000000 Z
12
+ date: 2012-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -115,6 +115,7 @@ files:
115
115
  - lib/lastfm/method_category/geo.rb
116
116
  - lib/lastfm/method_category/library.rb
117
117
  - lib/lastfm/method_category/tag.rb
118
+ - lib/lastfm/method_category/tasteometer.rb
118
119
  - lib/lastfm/method_category/track.rb
119
120
  - lib/lastfm/method_category/user.rb
120
121
  - lib/lastfm/response.rb
@@ -134,6 +135,7 @@ files:
134
135
  - spec/fixtures/ng.xml
135
136
  - spec/fixtures/ok.xml
136
137
  - spec/fixtures/tag_get_top_artists.xml
138
+ - spec/fixtures/tasteometer_compare.xml
137
139
  - spec/fixtures/track_get_correction.xml
138
140
  - spec/fixtures/track_get_info.xml
139
141
  - spec/fixtures/track_get_info_force_array.xml
@@ -167,6 +169,7 @@ files:
167
169
  - spec/method_specs/geo_spec.rb
168
170
  - spec/method_specs/library_spec.rb
169
171
  - spec/method_specs/tag_spec.rb
172
+ - spec/method_specs/tasteometer_spec.rb
170
173
  - spec/method_specs/track_spec.rb
171
174
  - spec/method_specs/user_spec.rb
172
175
  - spec/response_spec.rb
@@ -186,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
189
  version: '0'
187
190
  segments:
188
191
  - 0
189
- hash: -2782955245738475169
192
+ hash: -1211690192638560457
190
193
  required_rubygems_version: !ruby/object:Gem::Requirement
191
194
  none: false
192
195
  requirements:
@@ -195,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
198
  version: '0'
196
199
  segments:
197
200
  - 0
198
- hash: -2782955245738475169
201
+ hash: -1211690192638560457
199
202
  requirements: []
200
203
  rubyforge_project:
201
204
  rubygems_version: 1.8.24
@@ -218,6 +221,7 @@ test_files:
218
221
  - spec/fixtures/ng.xml
219
222
  - spec/fixtures/ok.xml
220
223
  - spec/fixtures/tag_get_top_artists.xml
224
+ - spec/fixtures/tasteometer_compare.xml
221
225
  - spec/fixtures/track_get_correction.xml
222
226
  - spec/fixtures/track_get_info.xml
223
227
  - spec/fixtures/track_get_info_force_array.xml
@@ -251,6 +255,7 @@ test_files:
251
255
  - spec/method_specs/geo_spec.rb
252
256
  - spec/method_specs/library_spec.rb
253
257
  - spec/method_specs/tag_spec.rb
258
+ - spec/method_specs/tasteometer_spec.rb
254
259
  - spec/method_specs/track_spec.rb
255
260
  - spec/method_specs/user_spec.rb
256
261
  - spec/response_spec.rb