lastfm 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ pkg
6
6
  vendor/bundle
7
7
  .bundle
8
8
  Gemfile.lock
9
+ bin
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.10.0"
15
+ gem.version = "1.11.0"
16
16
 
17
17
  gem.add_dependency "xml-simple"
18
18
  gem.add_dependency "httparty"
@@ -17,6 +17,10 @@ class Lastfm
17
17
  response.xml['events']['event']
18
18
  end
19
19
 
20
+ regular_method :get_images, [:artist], [] do |response|
21
+ response.xml['images']['image']
22
+ end
23
+
20
24
  regular_method :get_similar, [:artist], [] do |response|
21
25
  response.xml['similarartists']['artist']
22
26
  end
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <images artist="Cher" total="2">
4
+ <image>
5
+ <title>60's</title>
6
+ <url>http://www.last.fm/music/Cher/+images/34800607</url>
7
+ <dateadded>Sun, 6 Sep 2009 15:32:53</dateadded>
8
+ <format>jpg</format>
9
+ <owner type="user">
10
+ <name>djosci_coelho</name>
11
+ <url>http://www.last.fm/user/djosci_coelho</url>
12
+ </owner>
13
+ <sizes>
14
+ <size height="973" name="original" width="728">http://userserve-ak.last.fm/serve/_/34800607/Cher+60s.jpg</size>
15
+ <size height="168" name="large" width="126">http://userserve-ak.last.fm/serve/126/34800607.jpg</size>
16
+ <size height="126" name="largesquare" width="126">http://userserve-ak.last.fm/serve/126s/34800607.jpg</size>
17
+ <size height="86" name="medium" width="64">http://userserve-ak.last.fm/serve/64/34800607.jpg</size>
18
+ <size height="45" name="small" width="34">http://userserve-ak.last.fm/serve/34/34800607.jpg</size>
19
+ <size height="337" name="extralarge" width="252">http://userserve-ak.last.fm/serve/252/34800607.jpg</size>
20
+ </sizes>
21
+ <votes>
22
+ <thumbsup>36</thumbsup>
23
+ <thumbsdown>5</thumbsdown>
24
+ </votes>
25
+ </image>
26
+ <image>
27
+ <title>Early years</title>
28
+ <url>http://www.last.fm/music/Cher/+images/34877783</url>
29
+ <dateadded>Tue, 8 Sep 2009 05:40:36</dateadded>
30
+ <format>jpg</format>
31
+ <owner type="user">
32
+ <name>djosci_coelho</name>
33
+ <url>http://www.last.fm/user/djosci_coelho</url>
34
+ </owner>
35
+ <sizes>
36
+ <size height="2000" name="original" width="1988">http://userserve-ak.last.fm/serve/_/34877783/Cher+Early+years.jpg</size>
37
+ <size height="127" name="large" width="126">http://userserve-ak.last.fm/serve/126/34877783.jpg</size>
38
+ <size height="126" name="largesquare" width="126">http://userserve-ak.last.fm/serve/126s/34877783.jpg</size>
39
+ <size height="64" name="medium" width="64">http://userserve-ak.last.fm/serve/64/34877783.jpg</size>
40
+ <size height="34" name="small" width="34">http://userserve-ak.last.fm/serve/34/34877783.jpg</size>
41
+ <size height="254" name="extralarge" width="252">http://userserve-ak.last.fm/serve/252/34877783.jpg</size>
42
+ </sizes>
43
+ <votes>
44
+ <thumbsup>120</thumbsup>
45
+ <thumbsdown>43</thumbsdown>
46
+ </votes>
47
+ </image>
48
+ </images>
49
+ </lfm>
@@ -17,7 +17,7 @@ describe '#artist' do
17
17
  top_tracks.size.should > 1
18
18
  end
19
19
  end
20
-
20
+
21
21
  describe '#get_top_albums' do
22
22
  it 'should get top albums' do
23
23
  @lastfm.should_receive(:request).with('artist.getTopAlbums', {
@@ -67,6 +67,25 @@ describe '#artist' do
67
67
  end
68
68
  end
69
69
 
70
+ describe '#get_images' do
71
+ it 'should get images' do
72
+ @lastfm.should_receive(:request).with('artist.getImages', {
73
+ :artist => 'Cher',
74
+ }).and_return(make_response('artist_get_images'))
75
+
76
+ images = @lastfm.artist.get_images(:artist => 'Cher')
77
+ images.count.should == 2
78
+ images[1]['title'].should == 'Early years'
79
+ images[1]['url'].should == 'http://www.last.fm/music/Cher/+images/34877783'
80
+ images[1]['dateadded'].should == 'Tue, 8 Sep 2009 05:40:36'
81
+ images[1]['format'].should == 'jpg'
82
+ images[1]['owner']['type'].should == 'user'
83
+ images[1]['owner']['name'].should == 'djosci_coelho'
84
+ images[1]['owner']['url'].should == 'http://www.last.fm/user/djosci_coelho'
85
+ images[1]['sizes']['size'].length.should == 6
86
+ end
87
+ end
88
+
70
89
  describe '#get_similar' do
71
90
  it 'should get similar artists' do
72
91
  @lastfm.should_receive(:request).with('artist.getSimilar', {
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.10.0
4
+ version: 1.11.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-28 00:00:00.000000000 Z
12
+ date: 2012-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -122,6 +122,7 @@ files:
122
122
  - lib/lastfm/util.rb
123
123
  - spec/fixtures/album_get_info.xml
124
124
  - spec/fixtures/artist_get_events.xml
125
+ - spec/fixtures/artist_get_images.xml
125
126
  - spec/fixtures/artist_get_info.xml
126
127
  - spec/fixtures/artist_get_similar.xml
127
128
  - spec/fixtures/artist_get_tags.xml
@@ -189,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
190
  version: '0'
190
191
  segments:
191
192
  - 0
192
- hash: -1211690192638560457
193
+ hash: -4577536308561870953
193
194
  required_rubygems_version: !ruby/object:Gem::Requirement
194
195
  none: false
195
196
  requirements:
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  version: '0'
199
200
  segments:
200
201
  - 0
201
- hash: -1211690192638560457
202
+ hash: -4577536308561870953
202
203
  requirements: []
203
204
  rubyforge_project:
204
205
  rubygems_version: 1.8.24
@@ -208,6 +209,7 @@ summary: A ruby interface for Last.fm web services version 2.0
208
209
  test_files:
209
210
  - spec/fixtures/album_get_info.xml
210
211
  - spec/fixtures/artist_get_events.xml
212
+ - spec/fixtures/artist_get_images.xml
211
213
  - spec/fixtures/artist_get_info.xml
212
214
  - spec/fixtures/artist_get_similar.xml
213
215
  - spec/fixtures/artist_get_tags.xml