lastfm 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -100,6 +100,10 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
100
100
  * {library.getArtists}[http://www.lastfm.jp/api/show?service=322]
101
101
  * {library.getTracks}[http://www.last.fm/api/show/library.getTracks]
102
102
 
103
+ === Chart
104
+
105
+ * {chart.getHypedArtists}[http://www.lastfm.jp/api/show/chart.getHypedArtists]
106
+
103
107
  == Installation
104
108
 
105
109
  === Archive Installation
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.11.0"
15
+ gem.version = "1.12.0"
16
16
 
17
17
  gem.add_dependency "xml-simple"
18
18
  gem.add_dependency "httparty"
data/lib/lastfm.rb CHANGED
@@ -16,6 +16,7 @@ require 'lastfm/method_category/tag'
16
16
  require 'lastfm/method_category/tasteometer'
17
17
  require 'lastfm/method_category/track'
18
18
  require 'lastfm/method_category/user'
19
+ require 'lastfm/method_category/chart'
19
20
 
20
21
  class Lastfm
21
22
  API_ROOT = 'http://ws.audioscrobbler.com/2.0'
@@ -80,6 +81,10 @@ class Lastfm
80
81
  MethodCategory::User.new(self)
81
82
  end
82
83
 
84
+ def chart
85
+ MethodCategory::Chart.new(self)
86
+ end
87
+
83
88
  def request(method, params = {}, http_method = :get, with_signature = false, with_session = false)
84
89
  params[:method] = method
85
90
  params[:api_key] = @api_key
@@ -0,0 +1,9 @@
1
+ class Lastfm
2
+ module MethodCategory
3
+ class Chart < Base
4
+ regular_method :get_hyped_artists, [], [[:page, nil], [:limit, nil]] do |response|
5
+ response.xml['artists']['artist']
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,126 @@
1
+
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <lfm status="ok">
4
+ <artists page="3" perPage="10" totalPages="50" total="500">
5
+ <artist>
6
+ <name>Noonie Bao</name>
7
+ <percentagechange>240</percentagechange>
8
+ <mbid></mbid>
9
+ <url>http://www.last.fm/music/Noonie+Bao</url>
10
+ <streamable>0</streamable>
11
+ <image size="small">http://userserve-ak.last.fm/serve/34/83515811.jpg</image>
12
+ <image size="medium">http://userserve-ak.last.fm/serve/64/83515811.jpg</image>
13
+ <image size="large">http://userserve-ak.last.fm/serve/126/83515811.jpg</image>
14
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/83515811.jpg</image>
15
+ <image size="mega">http://userserve-ak.last.fm/serve/_/83515811/Noonie+Bao+Noonie_Bao_photo_by_Morgan_Nor.jpg</image>
16
+ </artist>
17
+ <artist>
18
+ <name>Let The Sky Fall</name>
19
+ <percentagechange>238</percentagechange>
20
+ <mbid></mbid>
21
+ <url>http://www.last.fm/music/Let+The+Sky+Fall</url>
22
+ <streamable>0</streamable>
23
+ <image size="small">http://userserve-ak.last.fm/serve/34/83252315.jpg</image>
24
+ <image size="medium">http://userserve-ak.last.fm/serve/64/83252315.jpg</image>
25
+ <image size="large">http://userserve-ak.last.fm/serve/126/83252315.jpg</image>
26
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/83252315.jpg</image>
27
+ <image size="mega">http://userserve-ak.last.fm/serve/500/83252315/Let+The+Sky+Fall+SKYFALLUKPOSTER_650.jpg</image>
28
+ </artist>
29
+ <artist>
30
+ <name>Early Graves</name>
31
+ <percentagechange>231</percentagechange>
32
+ <mbid>ddacb291-52ff-40a8-8cce-0ddfa535ce4a</mbid>
33
+ <url>http://www.last.fm/music/Early+Graves</url>
34
+ <streamable>1</streamable>
35
+ <image size="small">http://userserve-ak.last.fm/serve/34/37235129.jpg</image>
36
+ <image size="medium">http://userserve-ak.last.fm/serve/64/37235129.jpg</image>
37
+ <image size="large">http://userserve-ak.last.fm/serve/126/37235129.jpg</image>
38
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/37235129.jpg</image>
39
+ <image size="mega">http://userserve-ak.last.fm/serve/_/37235129/Early+Graves.jpg</image>
40
+ </artist>
41
+ <artist>
42
+ <name>Concrete Knives</name>
43
+ <percentagechange>229</percentagechange>
44
+ <mbid>75296680-d93b-43ea-b8ac-8695262e4b1d</mbid>
45
+ <url>http://www.last.fm/music/Concrete+Knives</url>
46
+ <streamable>0</streamable>
47
+ <image size="small">http://userserve-ak.last.fm/serve/34/60292433.jpg</image>
48
+ <image size="medium">http://userserve-ak.last.fm/serve/64/60292433.jpg</image>
49
+ <image size="large">http://userserve-ak.last.fm/serve/126/60292433.jpg</image>
50
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/60292433.jpg</image>
51
+ <image size="mega">http://userserve-ak.last.fm/serve/500/60292433/Concrete+Knives+Live++la+Cave+aux+potes+Roubai.jpg</image>
52
+ </artist>
53
+ <artist>
54
+ <name>The Soft Moon</name>
55
+ <percentagechange>226</percentagechange>
56
+ <mbid>93eba14e-f85c-4d39-8412-5e4018c89d75</mbid>
57
+ <url>http://www.last.fm/music/The+Soft+Moon</url>
58
+ <streamable>1</streamable>
59
+ <image size="small">http://userserve-ak.last.fm/serve/34/64608131.jpg</image>
60
+ <image size="medium">http://userserve-ak.last.fm/serve/64/64608131.jpg</image>
61
+ <image size="large">http://userserve-ak.last.fm/serve/126/64608131.jpg</image>
62
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/64608131.jpg</image>
63
+ <image size="mega">http://userserve-ak.last.fm/serve/500/64608131/The+Soft+Moon+259306_10150195557771316_15967.jpg</image>
64
+ </artist>
65
+ <artist>
66
+ <name>Daley</name>
67
+ <percentagechange>215</percentagechange>
68
+ <mbid>baca710e-7df7-40e1-8d39-464543e5dc3d</mbid>
69
+ <url>http://www.last.fm/music/Daley</url>
70
+ <streamable>1</streamable>
71
+ <image size="small">http://userserve-ak.last.fm/serve/34/72621822.png</image>
72
+ <image size="medium">http://userserve-ak.last.fm/serve/64/72621822.png</image>
73
+ <image size="large">http://userserve-ak.last.fm/serve/126/72621822.png</image>
74
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/72621822.png</image>
75
+ <image size="mega">http://userserve-ak.last.fm/serve/500/72621822/Daley+PNG.png</image>
76
+ </artist>
77
+ <artist>
78
+ <name>Kyla La Grange</name>
79
+ <percentagechange>213</percentagechange>
80
+ <mbid>082e714f-be12-4890-ae83-6203bd9c7d2a</mbid>
81
+ <url>http://www.last.fm/music/Kyla+La+Grange</url>
82
+ <streamable>1</streamable>
83
+ <image size="small">http://userserve-ak.last.fm/serve/34/70951258.png</image>
84
+ <image size="medium">http://userserve-ak.last.fm/serve/64/70951258.png</image>
85
+ <image size="large">http://userserve-ak.last.fm/serve/126/70951258.png</image>
86
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/70951258.png</image>
87
+ <image size="mega">http://userserve-ak.last.fm/serve/500/70951258/Kyla+La+Grange+788778top.png</image>
88
+ </artist>
89
+ <artist>
90
+ <name>Sticky Fingers</name>
91
+ <percentagechange>212</percentagechange>
92
+ <mbid>7be0c0eb-7ae6-496d-a190-27cebf8b9905</mbid>
93
+ <url>http://www.last.fm/music/Sticky+Fingers</url>
94
+ <streamable>1</streamable>
95
+ <image size="small">http://userserve-ak.last.fm/serve/34/45590739.jpg</image>
96
+ <image size="medium">http://userserve-ak.last.fm/serve/64/45590739.jpg</image>
97
+ <image size="large">http://userserve-ak.last.fm/serve/126/45590739.jpg</image>
98
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/45590739.jpg</image>
99
+ <image size="mega">http://userserve-ak.last.fm/serve/_/45590739/Sticky+Fingers++on+the+road.jpg</image>
100
+ </artist>
101
+ <artist>
102
+ <name>Jackie Chain</name>
103
+ <percentagechange>211</percentagechange>
104
+ <mbid>2c9e6509-0a3b-498c-8c10-7d9b61f99d18</mbid>
105
+ <url>http://www.last.fm/music/Jackie+Chain</url>
106
+ <streamable>1</streamable>
107
+ <image size="small">http://userserve-ak.last.fm/serve/34/71569556.png</image>
108
+ <image size="medium">http://userserve-ak.last.fm/serve/64/71569556.png</image>
109
+ <image size="large">http://userserve-ak.last.fm/serve/126/71569556.png</image>
110
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/71569556.png</image>
111
+ <image size="mega">http://userserve-ak.last.fm/serve/500/71569556/Jackie+Chain.png</image>
112
+ </artist>
113
+ <artist>
114
+ <name>Stubborn Heart</name>
115
+ <percentagechange>206</percentagechange>
116
+ <mbid>5b78aa72-7b9a-4aad-a928-de83123221d9</mbid>
117
+ <url>http://www.last.fm/music/Stubborn+Heart</url>
118
+ <streamable>0</streamable>
119
+ <image size="small">http://userserve-ak.last.fm/serve/34/83532481.jpg</image>
120
+ <image size="medium">http://userserve-ak.last.fm/serve/64/83532481.jpg</image>
121
+ <image size="large">http://userserve-ak.last.fm/serve/126/83532481.jpg</image>
122
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/83532481.jpg</image>
123
+ <image size="mega">http://userserve-ak.last.fm/serve/_/83532481/Stubborn+Heart.jpg</image>
124
+ </artist>
125
+ </artists>
126
+ </lfm>
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe '#chart' do
4
+ before { init_lastfm }
5
+
6
+ it 'should return an instance of Lastfm::Chart' do
7
+ @lastfm.chart.should be_an_instance_of(Lastfm::MethodCategory::Chart)
8
+ end
9
+
10
+ describe '#get_hyped_artists' do
11
+ it 'should get hyped artists' do
12
+ @lastfm.should_receive(:request).with('chart.getHypedArtists', {
13
+ :limit => 10,
14
+ :page => 3
15
+ }).and_return(make_response('chart_get_hyped_artists'))
16
+
17
+ hyped_artists = @lastfm.chart.get_hyped_artists(:limit => 10, :page => 3)
18
+ hyped_artists.size.should > 1
19
+ end
20
+ end
21
+ 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.11.0
4
+ version: 1.12.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-11-03 00:00:00.000000000 Z
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -111,6 +111,7 @@ files:
111
111
  - lib/lastfm/method_category/artist.rb
112
112
  - lib/lastfm/method_category/auth.rb
113
113
  - lib/lastfm/method_category/base.rb
114
+ - lib/lastfm/method_category/chart.rb
114
115
  - lib/lastfm/method_category/event.rb
115
116
  - lib/lastfm/method_category/geo.rb
116
117
  - lib/lastfm/method_category/library.rb
@@ -129,6 +130,7 @@ files:
129
130
  - spec/fixtures/artist_get_top_albums.xml
130
131
  - spec/fixtures/artist_get_top_tracks.xml
131
132
  - spec/fixtures/artist_search.xml
133
+ - spec/fixtures/chart_get_hyped_artists.xml
132
134
  - spec/fixtures/event_get_info.xml
133
135
  - spec/fixtures/geo_get_events.xml
134
136
  - spec/fixtures/library_get_artists.xml
@@ -166,6 +168,7 @@ files:
166
168
  - spec/method_category_spec.rb
167
169
  - spec/method_specs/album_spec.rb
168
170
  - spec/method_specs/artist_spec.rb
171
+ - spec/method_specs/chart_spec.rb
169
172
  - spec/method_specs/event_spec.rb
170
173
  - spec/method_specs/geo_spec.rb
171
174
  - spec/method_specs/library_spec.rb
@@ -190,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
193
  version: '0'
191
194
  segments:
192
195
  - 0
193
- hash: -4577536308561870953
196
+ hash: -3027731203108285870
194
197
  required_rubygems_version: !ruby/object:Gem::Requirement
195
198
  none: false
196
199
  requirements:
@@ -199,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
202
  version: '0'
200
203
  segments:
201
204
  - 0
202
- hash: -4577536308561870953
205
+ hash: -3027731203108285870
203
206
  requirements: []
204
207
  rubyforge_project:
205
208
  rubygems_version: 1.8.24
@@ -216,6 +219,7 @@ test_files:
216
219
  - spec/fixtures/artist_get_top_albums.xml
217
220
  - spec/fixtures/artist_get_top_tracks.xml
218
221
  - spec/fixtures/artist_search.xml
222
+ - spec/fixtures/chart_get_hyped_artists.xml
219
223
  - spec/fixtures/event_get_info.xml
220
224
  - spec/fixtures/geo_get_events.xml
221
225
  - spec/fixtures/library_get_artists.xml
@@ -253,6 +257,7 @@ test_files:
253
257
  - spec/method_category_spec.rb
254
258
  - spec/method_specs/album_spec.rb
255
259
  - spec/method_specs/artist_spec.rb
260
+ - spec/method_specs/chart_spec.rb
256
261
  - spec/method_specs/event_spec.rb
257
262
  - spec/method_specs/geo_spec.rb
258
263
  - spec/method_specs/library_spec.rb