lastfm 1.14.0 → 1.14.1
Sign up to get free protection for your applications and to get access to all the features.
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.14.
|
15
|
+
gem.version = "1.14.1"
|
16
16
|
|
17
17
|
gem.add_dependency "xml-simple"
|
18
18
|
gem.add_dependency "httparty"
|
@@ -27,7 +27,10 @@ class Lastfm
|
|
27
27
|
regular_method :get_similar, [:artist, :track], [] do |response|
|
28
28
|
response.xml['similartracks']['track'][1 .. -1]
|
29
29
|
end
|
30
|
-
regular_method :search, [:track], [[:artist, nil], [:limit, nil], [:page, nil]]
|
30
|
+
regular_method :search, [:track], [[:artist, nil], [:limit, nil], [:page, nil]] do |response|
|
31
|
+
response.xml['results']['trackmatches']['track'] = Util.force_array(response.xml['results']['trackmatches']['track'])
|
32
|
+
response.xml
|
33
|
+
end
|
31
34
|
|
32
35
|
method_with_authentication :get_tags, [:artist, :track], [] do |response|
|
33
36
|
response.xml['tags']['tag']
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<lfm status="ok">
|
3
|
+
<results xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" for="Believe">
|
4
|
+
<opensearch:Query role="request" searchTerms="Believe" startPage="3"/>
|
5
|
+
<opensearch:totalResults>40540</opensearch:totalResults>
|
6
|
+
<opensearch:startIndex>20</opensearch:startIndex>
|
7
|
+
<opensearch:itemsPerPage>10</opensearch:itemsPerPage>
|
8
|
+
<trackmatches>
|
9
|
+
<track>
|
10
|
+
<name>Make Me Believe</name>
|
11
|
+
<artist>Godsmack</artist>
|
12
|
+
<url>http://www.last.fm/music/Godsmack/_/Make+Me+Believe</url>
|
13
|
+
<streamable fulltrack="0">1</streamable>
|
14
|
+
<listeners>76858</listeners>
|
15
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/8674971.jpg</image>
|
16
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/8674971.jpg</image>
|
17
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/8674971.jpg</image>
|
18
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/8674971.jpg</image>
|
19
|
+
</track>
|
20
|
+
</trackmatches>
|
21
|
+
</results>
|
22
|
+
</lfm>
|
@@ -203,6 +203,24 @@ describe '#track' do
|
|
203
203
|
tracks['results']['trackmatches']['track'].size.should == 2
|
204
204
|
tracks['results']['trackmatches']['track'][0]['name'].should == 'Make Me Believe'
|
205
205
|
end
|
206
|
+
|
207
|
+
it 'should always return an arrays of tracks' do
|
208
|
+
@lastfm.should_receive(:request).with('track.search', {
|
209
|
+
:artist => nil,
|
210
|
+
:track => 'Believe',
|
211
|
+
:limit => 10,
|
212
|
+
:page => 3,
|
213
|
+
}).and_return(make_response('track_search_single_track'))
|
214
|
+
|
215
|
+
tracks = @lastfm.track.search(
|
216
|
+
:track => 'Believe',
|
217
|
+
:limit => 10,
|
218
|
+
:page => 3)
|
219
|
+
tracks['results']['for'].should == 'Believe'
|
220
|
+
tracks['results']['totalResults'].should == '40540'
|
221
|
+
tracks['results']['trackmatches']['track'].size.should == 1
|
222
|
+
tracks['results']['trackmatches']['track'][0]['name'].should == 'Make Me Believe'
|
223
|
+
end
|
206
224
|
end
|
207
225
|
|
208
226
|
describe '#share' do
|
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.14.
|
4
|
+
version: 1.14.1
|
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: 2013-01-
|
12
|
+
date: 2013-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-simple
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- spec/fixtures/track_get_top_fans.xml
|
152
152
|
- spec/fixtures/track_get_top_tags.xml
|
153
153
|
- spec/fixtures/track_search.xml
|
154
|
+
- spec/fixtures/track_search_single_track.xml
|
154
155
|
- spec/fixtures/user_get_friends.xml
|
155
156
|
- spec/fixtures/user_get_info.xml
|
156
157
|
- spec/fixtures/user_get_loved_tracks.xml
|
@@ -199,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
200
|
version: '0'
|
200
201
|
segments:
|
201
202
|
- 0
|
202
|
-
hash:
|
203
|
+
hash: 1931534095946630610
|
203
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
205
|
none: false
|
205
206
|
requirements:
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
version: '0'
|
209
210
|
segments:
|
210
211
|
- 0
|
211
|
-
hash:
|
212
|
+
hash: 1931534095946630610
|
212
213
|
requirements: []
|
213
214
|
rubyforge_project:
|
214
215
|
rubygems_version: 1.8.24
|
@@ -245,6 +246,7 @@ test_files:
|
|
245
246
|
- spec/fixtures/track_get_top_fans.xml
|
246
247
|
- spec/fixtures/track_get_top_tags.xml
|
247
248
|
- spec/fixtures/track_search.xml
|
249
|
+
- spec/fixtures/track_search_single_track.xml
|
248
250
|
- spec/fixtures/user_get_friends.xml
|
249
251
|
- spec/fixtures/user_get_info.xml
|
250
252
|
- spec/fixtures/user_get_loved_tracks.xml
|