lastfm 1.2.0 → 1.3.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gem 'xml-simple'
5
5
  gem 'activesupport', '>= 3.0.3'
6
6
 
7
7
  group :development do
8
- gem 'rspec', '~> 2.3.0'
8
+ gem 'rspec', '~> 2.8.0'
9
9
  gem 'jeweler', '~> 1.6.4'
10
10
  gem 'rdoc'
11
11
  end
@@ -20,14 +20,14 @@ GEM
20
20
  rake (0.9.2.2)
21
21
  rdoc (3.12)
22
22
  json (~> 1.4)
23
- rspec (2.3.0)
24
- rspec-core (~> 2.3.0)
25
- rspec-expectations (~> 2.3.0)
26
- rspec-mocks (~> 2.3.0)
27
- rspec-core (2.3.1)
28
- rspec-expectations (2.3.0)
23
+ rspec (2.8.0)
24
+ rspec-core (~> 2.8.0)
25
+ rspec-expectations (~> 2.8.0)
26
+ rspec-mocks (~> 2.8.0)
27
+ rspec-core (2.8.0)
28
+ rspec-expectations (2.8.0)
29
29
  diff-lcs (~> 1.1.2)
30
- rspec-mocks (2.3.0)
30
+ rspec-mocks (2.8.0)
31
31
  xml-simple (1.1.1)
32
32
 
33
33
  PLATFORMS
@@ -38,5 +38,5 @@ DEPENDENCIES
38
38
  httparty
39
39
  jeweler (~> 1.6.4)
40
40
  rdoc
41
- rspec (~> 2.3.0)
41
+ rspec (~> 2.8.0)
42
42
  xml-simple
@@ -55,12 +55,14 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
55
55
 
56
56
  === User
57
57
 
58
- * {user.getInfo}[http://www.lastfm.jp/api/show?service=344]
59
58
  * {user.getFriends}[http://www.lastfm.jp/api/show?service=263]
60
- * {user.getRecentTracks}[http://www.lastfm.jp/api/show?service=278]
59
+ * {user.getInfo}[http://www.lastfm.jp/api/show?service=344]
60
+ * {user.getLovedTracks}[http://www.lastfm.jp/api/show/user.getLovedTracks]
61
61
  * {user.getNeighbours}[http://www.lastfm.jp/api/show?service=264]
62
62
  * {user.getTopArtists}[http://www.lastfm.jp/api/show/user.getTopArtists]
63
63
  * {user.getTopAlbuns}[http://www.lastfm.jp/api/show/user.getTopAlbums]
64
+ * {user.getTopTracks}[http://www.lastfm.jp/api/show/user.getTopTracks]
65
+ * {user.getRecentTracks}[http://www.lastfm.jp/api/show?service=278]
64
66
 
65
67
  === Geo
66
68
 
@@ -88,16 +90,17 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
88
90
 
89
91
  == Comitters
90
92
 
91
- * {mattfawcett}[https://github.com/mattfawcett]
92
- * {peplin}[https://github.com/peplin]
93
- * {liff}[https://github.com/liff]
93
+ * {Matthew Fawcett}[https://github.com/mattfawcett]
94
+ * {Christopher Peplin}[https://github.com/peplin]
95
+ * {Olli Helenius}[https://github.com/liff]
94
96
  * {pipedreambomb}[https://github.com/pipedreambomb]
95
- * {dbolson}[https://github.com/dbolson]
97
+ * {Danny Olson}[https://github.com/dbolson]
96
98
  * {webs}[https://github.com/webs]
97
- * {magnolia-fan}[https://github.com/magnolia-fan]
98
- * {garyadamshannon}[https://github.com/garyadamshannon]
99
- * {Garthex}[https://github.com/Garthex]
100
- * {lfzawacki}[https://github.com/lfzawacki]
99
+ * {Gregory Eremin}[https://github.com/magnolia-fan]
100
+ * {Gary Shannon}[https://github.com/garyadamshannon]
101
+ * {Kyle Fleming}[https://github.com/Garthex]
102
+ * {Lucas}[https://github.com/lfzawacki]
103
+ * {Johan Oskarsson}[https://github.com/johanoskarsson]
101
104
 
102
105
  == Note on Patches/Pull Requests
103
106
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -13,6 +13,14 @@ class Lastfm
13
13
  response.xml['topartists']['artist']
14
14
  end
15
15
 
16
+ regular_method :get_top_tracks, [:user], [[:period, nil], [:limit, nil], [:page, nil]] do |response|
17
+ response.xml['toptracks']['track']
18
+ end
19
+
20
+ regular_method :get_loved_tracks, [:user], [[:period, nil], [:limit, nil], [:page, nil]] do |response|
21
+ response.xml['lovedtracks']['track']
22
+ end
23
+
16
24
  regular_method :get_friends, [:user], [[:recenttracks, nil], [:limit, nil], [:page, nil]] do |response|
17
25
  response.xml['friends']['user']
18
26
  end
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <lovedtracks user="skr" page="1" perPage="50" totalPages="4" total="180">
4
+ <track>
5
+ <name>I Spy</name>
6
+ <mbid></mbid>
7
+ <url>http://www.last.fm/music/Mikhael+Paskalev/_/I+Spy</url>
8
+ <date uts="1329859504">21 Feb 2012, 21:25</date>
9
+ <artist>
10
+ <name>Mikhael Paskalev</name>
11
+ <mbid></mbid>
12
+ <url>http://www.last.fm/music/Mikhael+Paskalev</url>
13
+ </artist>
14
+ <streamable fulltrack="0">0</streamable>
15
+ </track>
16
+ <track>
17
+ <name>Working Titles</name>
18
+ <mbid></mbid>
19
+ <url>http://www.last.fm/music/Damien+Jurado/_/Working+Titles</url>
20
+ <date uts="1329857253">21 Feb 2012, 20:47</date>
21
+ <artist>
22
+ <name>Damien Jurado</name>
23
+ <mbid>f4805b9d-68f8-438e-8f13-ec7bcb4c8581</mbid>
24
+ <url>http://www.last.fm/music/Damien+Jurado</url>
25
+ </artist>
26
+ <streamable fulltrack="0">0</streamable>
27
+ </track>
28
+ </lovedtracks></lfm>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <toptracks user="skr" type="7day" page="1" perPage="50" totalPages="6" total="271">
4
+
5
+ <track rank="1">
6
+ <name>No Light, No Light (TV On The Radio Remix)</name>
7
+ <duration></duration>
8
+ <playcount>5</playcount>
9
+ <mbid></mbid>
10
+ <url>http://www.last.fm/music/Florence%2B%252B%2Bthe%2BMachine/_/No+Light%2C+No+Light+%28TV+On+The+Radio+Remix%29</url>
11
+ <streamable fulltrack="0">0</streamable>
12
+ <artist>
13
+ <name>Florence + the Machine</name>
14
+ <mbid>5fee3020-513b-48c2-b1f7-4681b01db0c6</mbid>
15
+ <url>http://www.last.fm/music/Florence%2B%252B%2Bthe%2BMachine</url>
16
+ </artist>
17
+ </track> <track rank="2">
18
+ <name>Backwords (Porcelain Raft cover)</name>
19
+ <duration>230</duration>
20
+ <playcount>5</playcount>
21
+ <mbid></mbid>
22
+ <url>http://www.last.fm/music/Oupa%2B%2526%2BTony%2BCrow/_/Backwords+%28Porcelain+Raft+cover%29</url>
23
+ <streamable fulltrack="0">0</streamable>
24
+ <artist>
25
+ <name>Oupa &amp; Tony Crow</name>
26
+ <mbid></mbid>
27
+ <url>http://www.last.fm/music/Oupa%2B%2526%2BTony%2BCrow</url>
28
+ </artist>
29
+ </track>
30
+ </toptracks></lfm>
@@ -513,6 +513,52 @@ XML
513
513
  albums[1]['artist']['name'].should == 'Pain of Salvation'
514
514
  end
515
515
  end
516
+
517
+ describe '#get_top_tracks' do
518
+ it 'should get user\'s top tracks' do
519
+ @lastfm.should_receive(:request).with('user.getTopTracks', {
520
+ :user => 'test',
521
+ :period => '7day',
522
+ :limit => nil,
523
+ :page => nil
524
+ }).and_return(make_response('user_get_top_tracks'))
525
+
526
+ tracks = @lastfm.user.get_top_tracks('test', '7day', nil, nil)
527
+
528
+ tracks.size.should == 2
529
+
530
+ tracks[0]['rank'].should == '1'
531
+ tracks[0]['name'].should == 'No Light, No Light (TV On The Radio Remix)'
532
+ tracks[0]['artist']['name'].should == 'Florence + the Machine'
533
+
534
+ tracks[1]['rank'].should == '2'
535
+ tracks[1]['name'].should == 'Backwords (Porcelain Raft cover)'
536
+ tracks[1]['artist']['name'].should == 'Oupa & Tony Crow'
537
+ end
538
+ end
539
+
540
+ describe '#get_loved_tracks' do
541
+ it 'should get user\'s loved tracks' do
542
+ @lastfm.should_receive(:request).with('user.getLovedTracks', {
543
+ :user => 'test',
544
+ :period => nil,
545
+ :limit => nil,
546
+ :page => nil
547
+ }).and_return(make_response('user_get_loved_tracks'))
548
+
549
+ tracks = @lastfm.user.get_loved_tracks('test', nil, nil, nil)
550
+
551
+ tracks.size.should == 2
552
+
553
+ tracks[0]['rank'].should == nil
554
+ tracks[0]['name'].should == 'I Spy'
555
+ tracks[0]['artist']['name'].should == 'Mikhael Paskalev'
556
+
557
+ tracks[1]['rank'].should == nil
558
+ tracks[1]['name'].should == 'Working Titles'
559
+ tracks[1]['artist']['name'].should == 'Damien Jurado'
560
+ end
561
+ end
516
562
 
517
563
  describe '#get_friends' do
518
564
  it 'should get user\'s friends' do
metadata CHANGED
@@ -1,117 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lastfm
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 2
8
- - 0
9
- segments_generated: true
10
- version: 1.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - youpy
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-27 00:00:00 +09:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- segments:
27
- - 0
28
- segments_generated: true
29
- version: "0"
30
- requirement: *id001
12
+ date: 2012-02-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
31
15
  name: httparty
32
- prerelease: false
16
+ requirement: &70299718961480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- segments:
40
- - 0
41
- segments_generated: true
42
- version: "0"
43
- requirement: *id002
44
- name: xml-simple
45
23
  prerelease: false
24
+ version_requirements: *70299718961480
25
+ - !ruby/object:Gem::Dependency
26
+ name: xml-simple
27
+ requirement: &70299718960660 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
46
33
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- version_requirements: &id003 !ruby/object:Gem::Requirement
49
- requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- segments:
53
- - 3
54
- - 0
55
- - 3
56
- segments_generated: true
57
- version: 3.0.3
58
- requirement: *id003
59
- name: activesupport
60
34
  prerelease: false
35
+ version_requirements: *70299718960660
36
+ - !ruby/object:Gem::Dependency
37
+ name: activesupport
38
+ requirement: &70299718959900 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 3.0.3
61
44
  type: :runtime
62
- - !ruby/object:Gem::Dependency
63
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ~>
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 2
69
- - 3
70
- - 0
71
- segments_generated: true
72
- version: 2.3.0
73
- requirement: *id004
74
- name: rspec
75
45
  prerelease: false
46
+ version_requirements: *70299718959900
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70299718975280 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.8.0
76
55
  type: :development
77
- - !ruby/object:Gem::Dependency
78
- version_requirements: &id005 !ruby/object:Gem::Requirement
79
- requirements:
56
+ prerelease: false
57
+ version_requirements: *70299718975280
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &70299718974480 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
80
63
  - - ~>
81
- - !ruby/object:Gem::Version
82
- segments:
83
- - 1
84
- - 6
85
- - 4
86
- segments_generated: true
64
+ - !ruby/object:Gem::Version
87
65
  version: 1.6.4
88
- requirement: *id005
89
- name: jeweler
90
- prerelease: false
91
66
  type: :development
92
- - !ruby/object:Gem::Dependency
93
- version_requirements: &id006 !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- segments:
98
- - 0
99
- segments_generated: true
100
- version: "0"
101
- requirement: *id006
102
- name: rdoc
103
67
  prerelease: false
68
+ version_requirements: *70299718974480
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &70299718973600 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
104
77
  type: :development
78
+ prerelease: false
79
+ version_requirements: *70299718973600
105
80
  description: A ruby interface for Last.fm web services version 2.0
106
81
  email: youpy@buycheapviagraonlinenow.com
107
82
  executables: []
108
-
109
83
  extensions: []
110
-
111
- extra_rdoc_files:
84
+ extra_rdoc_files:
112
85
  - LICENSE
113
86
  - README.rdoc
114
- files:
87
+ files:
115
88
  - .document
116
89
  - .rspec
117
90
  - Gemfile
@@ -150,46 +123,42 @@ files:
150
123
  - spec/fixtures/track_search.xml
151
124
  - spec/fixtures/user_get_friends.xml
152
125
  - spec/fixtures/user_get_info.xml
126
+ - spec/fixtures/user_get_loved_tracks.xml
153
127
  - spec/fixtures/user_get_neighbours.xml
154
128
  - spec/fixtures/user_get_recent_tracks.xml
155
129
  - spec/fixtures/user_get_top_albums.xml
156
130
  - spec/fixtures/user_get_top_artists.xml
131
+ - spec/fixtures/user_get_top_tracks.xml
157
132
  - spec/lastfm_spec.rb
158
133
  - spec/method_category_spec.rb
159
134
  - spec/response_spec.rb
160
135
  - spec/spec_helper.rb
161
136
  - spec/util_spec.rb
162
- has_rdoc: true
163
137
  homepage: http://github.com/youpy/ruby-lastfm
164
138
  licenses: []
165
-
166
139
  post_install_message:
167
140
  rdoc_options: []
168
-
169
- require_paths:
141
+ require_paths:
170
142
  - lib
171
- required_ruby_version: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- segments:
176
- - 0
177
- segments_generated: true
178
- version: "0"
179
- required_rubygems_version: !ruby/object:Gem::Requirement
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- segments:
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
184
150
  - 0
185
- segments_generated: true
186
- version: "0"
151
+ hash: 791443162221732736
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
187
158
  requirements: []
188
-
189
159
  rubyforge_project:
190
- rubygems_version: 1.3.6
160
+ rubygems_version: 1.8.10
191
161
  signing_key:
192
162
  specification_version: 3
193
163
  summary: A Ruby interface for Last.fm Web Services
194
164
  test_files: []
195
-