lastfm 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/lastfm.gemspec +1 -1
- data/lib/lastfm.rb +12 -7
- data/lib/lastfm/http_request.rb +6 -0
- data/lib/lastfm/https_request.rb +6 -0
- data/lib/lastfm/method_category/auth.rb +1 -1
- data/lib/lastfm/method_category/base.rb +8 -0
- data/lib/lastfm/method_category/user.rb +4 -0
- data/spec/fixtures/user_get_recommended_events.xml +503 -0
- data/spec/lastfm_spec.rb +9 -13
- data/spec/method_specs/user_spec.rb +11 -0
- metadata +8 -4
data/README.rdoc
CHANGED
@@ -87,6 +87,7 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
|
|
87
87
|
* {user.getNeighbours}[http://www.lastfm.jp/api/show?service=264]
|
88
88
|
* {user.getPersonalTags}[http://www.lastfm.jp/api/show/user.getPersonalTags]
|
89
89
|
* {user.getRecentTracks}[http://www.lastfm.jp/api/show?service=278]
|
90
|
+
* {user.getRecommendedEvents}[http://www.last.fm/api/show/user.getRecommendedEvents]
|
90
91
|
* {user.getTopArtists}[http://www.lastfm.jp/api/show/user.getTopArtists]
|
91
92
|
* {user.getTopAlbums}[http://www.lastfm.jp/api/show/user.getTopAlbums]
|
92
93
|
* {user.getTopTags}[http://www.lastfm.jp/api/show/user.getTopTags]
|
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.
|
15
|
+
gem.version = "1.15.0"
|
16
16
|
|
17
17
|
gem.add_dependency "xml-simple"
|
18
18
|
gem.add_dependency "httparty"
|
data/lib/lastfm.rb
CHANGED
@@ -5,6 +5,8 @@ require 'active_support/core_ext/string/inflections'
|
|
5
5
|
|
6
6
|
require 'lastfm/util'
|
7
7
|
require 'lastfm/response'
|
8
|
+
require 'lastfm/http_request.rb'
|
9
|
+
require 'lastfm/https_request.rb'
|
8
10
|
require 'lastfm/method_category/base'
|
9
11
|
require 'lastfm/method_category/album'
|
10
12
|
require 'lastfm/method_category/artist'
|
@@ -20,11 +22,6 @@ require 'lastfm/method_category/chart'
|
|
20
22
|
require 'lastfm/method_category/radio'
|
21
23
|
|
22
24
|
class Lastfm
|
23
|
-
API_ROOT = 'http://ws.audioscrobbler.com/2.0'
|
24
|
-
|
25
|
-
include HTTParty
|
26
|
-
base_uri API_ROOT
|
27
|
-
|
28
25
|
attr_accessor :session
|
29
26
|
|
30
27
|
class Error < StandardError; end
|
@@ -90,7 +87,7 @@ class Lastfm
|
|
90
87
|
MethodCategory::Radio.new(self)
|
91
88
|
end
|
92
89
|
|
93
|
-
def request(method, params = {}, http_method = :get, with_signature = false, with_session = false)
|
90
|
+
def request(method, params = {}, http_method = :get, with_signature = false, with_session = false, use_https = false)
|
94
91
|
params[:method] = method
|
95
92
|
params[:api_key] = @api_key
|
96
93
|
|
@@ -106,7 +103,15 @@ class Lastfm
|
|
106
103
|
params.update(:sk => @session) if with_session
|
107
104
|
params.update(:api_sig => Digest::MD5.hexdigest(build_method_signature(params))) if with_signature
|
108
105
|
|
109
|
-
|
106
|
+
request_args = [http_method, '/', (http_method == :post ? :body : :query) => params]
|
107
|
+
|
108
|
+
response = if use_https
|
109
|
+
HTTPSRequest.send(*request_args)
|
110
|
+
else
|
111
|
+
HTTPRequest.send(*request_args)
|
112
|
+
end
|
113
|
+
|
114
|
+
response = Response.new(response.body)
|
110
115
|
unless response.success?
|
111
116
|
raise ApiError.new(response.message, response.error)
|
112
117
|
end
|
@@ -9,7 +9,7 @@ class Lastfm
|
|
9
9
|
response.xml['session']
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
method_for_secure_authentication :get_mobile_session, [:username, :password], [] do |response|
|
13
13
|
response.xml['session']
|
14
14
|
end
|
15
15
|
end
|
@@ -16,6 +16,10 @@ class Lastfm
|
|
16
16
|
__define_method(:request_for_authentication, id, mandatory, optional, &block)
|
17
17
|
end
|
18
18
|
|
19
|
+
def method_for_secure_authentication(id, mandatory, optional = [], &block)
|
20
|
+
__define_method(:request_for_secure_authentication, id, mandatory, optional, &block)
|
21
|
+
end
|
22
|
+
|
19
23
|
def regular_method(id, mandatory, optional = [], &block)
|
20
24
|
__define_method(:request, id, mandatory, optional, &block)
|
21
25
|
end
|
@@ -47,6 +51,10 @@ class Lastfm
|
|
47
51
|
request(method, params, :get, true)
|
48
52
|
end
|
49
53
|
|
54
|
+
def request_for_secure_authentication(method, params = {})
|
55
|
+
request(method, params, :post, true, false, true)
|
56
|
+
end
|
57
|
+
|
50
58
|
def request(*args)
|
51
59
|
method, *rest = args
|
52
60
|
method = [self.class.name.split(/::/).last.downcase, method].join('.')
|
@@ -68,6 +68,10 @@ class Lastfm
|
|
68
68
|
regular_method :get_weekly_track_chart, [:user], [[:from, nil], [:to, nil], [:limit, nil]] do |response|
|
69
69
|
response.xml['weeklytrackchart']['track']
|
70
70
|
end
|
71
|
+
|
72
|
+
method_with_authentication :get_recommended_events, [], [] do |response|
|
73
|
+
response.xml['events']['event']
|
74
|
+
end
|
71
75
|
end
|
72
76
|
end
|
73
77
|
end
|
@@ -0,0 +1,503 @@
|
|
1
|
+
<opt status="ok">
|
2
|
+
<events xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" user="USERNAME" page="1" perPage="20" totalPages="1" total="15" festivalsonly="0">
|
3
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3420044" title="Toro y Moi" score="0.21958294073681" startDate="Wed, 06 Feb 2013 20:00:00" attendance="52" reviews="0" url="http://www.last.fm/event/3420044+Toro+y+Moi+at+Masquerade+on+6+February+2013" cancelled="0">
|
4
|
+
<artists headliner="Toro y Moi">
|
5
|
+
<artist>Toro y Moi</artist>
|
6
|
+
<artist>Wild Belle</artist>
|
7
|
+
<artist>Dog Bite</artist>
|
8
|
+
</artists>
|
9
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
10
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
11
|
+
<point lat="33.77103" long="-84.364537" />
|
12
|
+
</location>
|
13
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
14
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
15
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
16
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
17
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
18
|
+
</venue>
|
19
|
+
<description></description>
|
20
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/75334270.png</image>
|
21
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/75334270.png</image>
|
22
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/75334270.png</image>
|
23
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/75334270.png</image>
|
24
|
+
<tag>lastfm:event=3420044</tag>
|
25
|
+
<website></website>
|
26
|
+
<tickets></tickets>
|
27
|
+
<tags>
|
28
|
+
<tag>indie</tag>
|
29
|
+
</tags>
|
30
|
+
</event>
|
31
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3467665" title="Reel Big Fish" score="0.14376493490457" startDate="Mon, 11 Feb 2013 19:35:01" attendance="4" reviews="0" url="http://www.last.fm/event/3467665+Reel+Big+Fish" cancelled="0">
|
32
|
+
<artists artist="Reel Big Fish" headliner="Reel Big Fish" />
|
33
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
34
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
35
|
+
<point lat="33.77103" long="-84.364537" />
|
36
|
+
</location>
|
37
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
38
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
39
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
40
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
41
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
42
|
+
</venue>
|
43
|
+
<description></description>
|
44
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/351598.jpg</image>
|
45
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/351598.jpg</image>
|
46
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/351598.jpg</image>
|
47
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/351598.jpg</image>
|
48
|
+
<tag>lastfm:event=3467665</tag>
|
49
|
+
<website></website>
|
50
|
+
<tickets></tickets>
|
51
|
+
<tags>
|
52
|
+
<tag>ska</tag>
|
53
|
+
<tag>ska punk</tag>
|
54
|
+
</tags>
|
55
|
+
</event>
|
56
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3449464" title="Desaparecidos" score="0.018114080685454" startDate="Thu, 21 Feb 2013 20:00:00" attendance="22" reviews="0" url="http://www.last.fm/event/3449464+Desaparecidos+at+Variety+Playhouse+on+21+February+2013" cancelled="0">
|
57
|
+
<artists headliner="Desaparecidos">
|
58
|
+
<artist>Desaparecidos</artist>
|
59
|
+
<artist>Joyce Manor</artist>
|
60
|
+
</artists>
|
61
|
+
<venue id="8779012" name="Variety Playhouse" url="http://www.last.fm/venue/8779012+Variety+Playhouse" website="http://www.variety-playhouse.com" phonenumber="404-524-7354">
|
62
|
+
<location city="Atlanta" country="United States" street="1099 Euclid Ave">
|
63
|
+
<postalcode></postalcode>
|
64
|
+
<point lat="33.763736" long="-84.351118" />
|
65
|
+
</location>
|
66
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/502235.jpg</image>
|
67
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/502235.jpg</image>
|
68
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/502235.jpg</image>
|
69
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/502235.jpg</image>
|
70
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/502235/Variety+Playhouse.jpg</image>
|
71
|
+
</venue>
|
72
|
+
<description></description>
|
73
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/154455.jpg</image>
|
74
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/154455.jpg</image>
|
75
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/154455.jpg</image>
|
76
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/154455.jpg</image>
|
77
|
+
<tag>lastfm:event=3449464</tag>
|
78
|
+
<website></website>
|
79
|
+
<tickets></tickets>
|
80
|
+
<tags>
|
81
|
+
<tag>indie rock</tag>
|
82
|
+
<tag>saddle creek</tag>
|
83
|
+
<tag>indie</tag>
|
84
|
+
<tag>pop punk</tag>
|
85
|
+
<tag>punk rock</tag>
|
86
|
+
<tag>punk</tag>
|
87
|
+
</tags>
|
88
|
+
</event>
|
89
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3481408" title="Good Old War" score="0.031283996807436" startDate="Fri, 22 Feb 2013 21:00:00" attendance="1" reviews="0" url="http://www.last.fm/event/3481408+Good+Old+War+at+The+Loft+on+22+February+2013" website="http://www.centerstage-atlanta.com/show?id=763&artist=GOOD+OLD+WAR" cancelled="0">
|
90
|
+
<artists headliner="Good Old War">
|
91
|
+
<artist>Good Old War</artist>
|
92
|
+
<artist>Bronze Radio Return</artist>
|
93
|
+
</artists>
|
94
|
+
<venue id="8780769" name="The Loft" url="http://www.last.fm/venue/8780769+The+Loft" website="http://www.theloftatl.com" phonenumber="(404) 885-1365">
|
95
|
+
<location city="Atlanta" country="United States" street="1374 W. Peachtree St." postalcode="30309">
|
96
|
+
<point lat="33.792085" long="-84.388225" />
|
97
|
+
</location>
|
98
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/4689115.jpg</image>
|
99
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/4689115.jpg</image>
|
100
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/4689115.jpg</image>
|
101
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/4689115.jpg</image>
|
102
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/4689115/The+Loft+theLoft_csLOGOweb.jpg</image>
|
103
|
+
</venue>
|
104
|
+
<description></description>
|
105
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/47003169.jpg</image>
|
106
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/47003169.jpg</image>
|
107
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/47003169.jpg</image>
|
108
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/47003169.jpg</image>
|
109
|
+
<tag>lastfm:event=3481408</tag>
|
110
|
+
<tickets></tickets>
|
111
|
+
<tags>
|
112
|
+
<tag>indie</tag>
|
113
|
+
<tag>alternative</tag>
|
114
|
+
<tag>blues</tag>
|
115
|
+
<tag>acoustic</tag>
|
116
|
+
<tag>rock</tag>
|
117
|
+
<tag>american</tag>
|
118
|
+
<tag>folk</tag>
|
119
|
+
<tag>on repeat</tag>
|
120
|
+
</tags>
|
121
|
+
</event>
|
122
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3428800" title="Ra Ra Riot" score="0.2167034384401" startDate="Sun, 24 Feb 2013 19:00:00" attendance="16" reviews="0" url="http://www.last.fm/event/3428800+Ra+Ra+Riot+at+Masquerade+on+24+February+2013" website="http://www.masqueradeatlanta.com/index.php?show_id=4475" cancelled="0">
|
123
|
+
<artists artist="Ra Ra Riot" headliner="Ra Ra Riot" />
|
124
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
125
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
126
|
+
<point lat="33.77103" long="-84.364537" />
|
127
|
+
</location>
|
128
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
129
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
130
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
131
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
132
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
133
|
+
</venue>
|
134
|
+
<description></description>
|
135
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/45624701.png</image>
|
136
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/45624701.png</image>
|
137
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/45624701.png</image>
|
138
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/45624701.png</image>
|
139
|
+
<tag>lastfm:event=3428800</tag>
|
140
|
+
<tickets></tickets>
|
141
|
+
<tags>
|
142
|
+
<tag>indie rock</tag>
|
143
|
+
<tag>indie</tag>
|
144
|
+
<tag>indie pop</tag>
|
145
|
+
</tags>
|
146
|
+
</event>
|
147
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3448637" title="Efterklang" score="0.32058523973149" startDate="Sat, 02 Mar 2013 18:33:01" attendance="8" reviews="0" url="http://www.last.fm/event/3448637+Efterklang+at+The+Earl+on+2+March+2013" cancelled="0">
|
148
|
+
<artists headliner="Efterklang">
|
149
|
+
<artist>Efterklang</artist>
|
150
|
+
<artist>Nightlands</artist>
|
151
|
+
</artists>
|
152
|
+
<venue id="8779615" name="The Earl" url="http://www.last.fm/venue/8779615+The+Earl" website="http://www.badearl.com/">
|
153
|
+
<location city="Atlanta" country="United States" street="488 Flat Shoals Ave SE" postalcode="30316">
|
154
|
+
<point lat="33.74094" long="-84.346007" />
|
155
|
+
</location>
|
156
|
+
<phonenumber></phonenumber>
|
157
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/5981416.jpg</image>
|
158
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/5981416.jpg</image>
|
159
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/5981416.jpg</image>
|
160
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/5981416.jpg</image>
|
161
|
+
<image size="mega">http://userserve-ak.last.fm/serve/_/5981416/The+Earl+theearl.jpg</image>
|
162
|
+
</venue>
|
163
|
+
<description></description>
|
164
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/81741345.png</image>
|
165
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/81741345.png</image>
|
166
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/81741345.png</image>
|
167
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/81741345.png</image>
|
168
|
+
<tag>lastfm:event=3448637</tag>
|
169
|
+
<website></website>
|
170
|
+
<tickets></tickets>
|
171
|
+
<tags>
|
172
|
+
<tag>danish</tag>
|
173
|
+
<tag>alternative</tag>
|
174
|
+
<tag>electronic</tag>
|
175
|
+
<tag>dreamy</tag>
|
176
|
+
<tag>ambient</tag>
|
177
|
+
<tag>psychedelic</tag>
|
178
|
+
<tag>post-rock</tag>
|
179
|
+
<tag>all</tag>
|
180
|
+
</tags>
|
181
|
+
</event>
|
182
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3491618" title="Body Language" score="0.45995205503932" startDate="Wed, 06 Mar 2013 21:00:00" description="<div class="bbcode">$8 in adv, $10 DOS, 18+<br />Doors @ 9 pm</div>" attendance="1" reviews="0" url="http://www.last.fm/event/3491618+Body+Language+at+The+Drunken+Unicorn+on+6+March+2013" website="http://www.ticketalternative.com/Events/22004.aspx" cancelled="0">
|
183
|
+
<artists headliner="Body Language">
|
184
|
+
<artist>Body Language</artist>
|
185
|
+
<artist>Vacationer</artist>
|
186
|
+
</artists>
|
187
|
+
<venue id="8777644" name="The Drunken Unicorn" url="http://www.last.fm/venue/8777644+The+Drunken+Unicorn" website="http://www.thedrunkenunicorn.net/">
|
188
|
+
<location city="Atlanta" country="United States" street="736 Ponce de Leon Place">
|
189
|
+
<postalcode></postalcode>
|
190
|
+
<point lat="33.774143" long="-84.363038" />
|
191
|
+
</location>
|
192
|
+
<phonenumber></phonenumber>
|
193
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/471142.jpg</image>
|
194
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/471142.jpg</image>
|
195
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/471142.jpg</image>
|
196
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/471142.jpg</image>
|
197
|
+
<image size="mega">http://userserve-ak.last.fm/serve/_/471142/The+Drunken+Unicorn.jpg</image>
|
198
|
+
</venue>
|
199
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/42318943.jpg</image>
|
200
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/42318943.jpg</image>
|
201
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/42318943.jpg</image>
|
202
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/42318943.jpg</image>
|
203
|
+
<tag>lastfm:event=3491618</tag>
|
204
|
+
<tickets></tickets>
|
205
|
+
<tags>
|
206
|
+
<tag>indie</tag>
|
207
|
+
<tag>electronic</tag>
|
208
|
+
<tag>american</tag>
|
209
|
+
<tag>mellow</tag>
|
210
|
+
<tag>chillout</tag>
|
211
|
+
<tag>fave indie pop</tag>
|
212
|
+
<tag>indie pop</tag>
|
213
|
+
<tag>electropop</tag>
|
214
|
+
</tags>
|
215
|
+
</event>
|
216
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3478006" title="Major Lazer" score="0.37379830490737" startDate="Fri, 08 Mar 2013 13:09:01" attendance="20" reviews="0" url="http://www.last.fm/event/3478006+Major+Lazer+at+Masquerade+on+8+March+2013" website="http://www.masqueradeatlanta.com/events/major-lazer-w-dragonette" cancelled="0">
|
217
|
+
<artists headliner="Major Lazer">
|
218
|
+
<artist>Major Lazer</artist>
|
219
|
+
<artist>Dragonette</artist>
|
220
|
+
</artists>
|
221
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
222
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
223
|
+
<point lat="33.77103" long="-84.364537" />
|
224
|
+
</location>
|
225
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
226
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
227
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
228
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
229
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
230
|
+
</venue>
|
231
|
+
<description></description>
|
232
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/63339873.png</image>
|
233
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/63339873.png</image>
|
234
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/63339873.png</image>
|
235
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/63339873.png</image>
|
236
|
+
<tag>lastfm:event=3478006</tag>
|
237
|
+
<tickets></tickets>
|
238
|
+
<tags>
|
239
|
+
<tag>electronic</tag>
|
240
|
+
<tag>reggae</tag>
|
241
|
+
<tag>electropop</tag>
|
242
|
+
<tag>pop</tag>
|
243
|
+
<tag>female vocalists</tag>
|
244
|
+
<tag>dance</tag>
|
245
|
+
<tag>dancehall</tag>
|
246
|
+
<tag>dub</tag>
|
247
|
+
</tags>
|
248
|
+
</event>
|
249
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3455443" title="Kishi Bashi" score="0.022830287884768" startDate="Thu, 14 Mar 2013 21:00:00" attendance="29" reviews="0" url="http://www.last.fm/event/3455443+Kishi+Bashi+at+The+Earl+on+14+March+2013" website="http://badearl.com/content/additional_info?event_id=2072" cancelled="0">
|
250
|
+
<artists headliner="Kishi Bashi">
|
251
|
+
<artist>Kishi Bashi</artist>
|
252
|
+
<artist>Elizabeth and The Catapult</artist>
|
253
|
+
</artists>
|
254
|
+
<venue id="8779615" name="The Earl" url="http://www.last.fm/venue/8779615+The+Earl" website="http://www.badearl.com/">
|
255
|
+
<location city="Atlanta" country="United States" street="488 Flat Shoals Ave SE" postalcode="30316">
|
256
|
+
<point lat="33.74094" long="-84.346007" />
|
257
|
+
</location>
|
258
|
+
<phonenumber></phonenumber>
|
259
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/5981416.jpg</image>
|
260
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/5981416.jpg</image>
|
261
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/5981416.jpg</image>
|
262
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/5981416.jpg</image>
|
263
|
+
<image size="mega">http://userserve-ak.last.fm/serve/_/5981416/The+Earl+theearl.jpg</image>
|
264
|
+
</venue>
|
265
|
+
<description></description>
|
266
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/78125954.jpg</image>
|
267
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/78125954.jpg</image>
|
268
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/78125954.jpg</image>
|
269
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/78125954.jpg</image>
|
270
|
+
<tag>lastfm:event=3455443</tag>
|
271
|
+
<tickets></tickets>
|
272
|
+
<tags>
|
273
|
+
<tag>folk</tag>
|
274
|
+
<tag>all</tag>
|
275
|
+
<tag>fave indie pop</tag>
|
276
|
+
<tag>indie</tag>
|
277
|
+
<tag>pop</tag>
|
278
|
+
</tags>
|
279
|
+
</event>
|
280
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3465090" title="Deftones" score="0.090859090065534" startDate="Sun, 17 Mar 2013 16:33:01" attendance="18" reviews="0" url="http://www.last.fm/event/3465090+Deftones+at+Tabernacle+on+17+March+2013" cancelled="0">
|
281
|
+
<artists artist="Deftones" headliner="Deftones" />
|
282
|
+
<venue id="8779452" name="Tabernacle" url="http://www.last.fm/venue/8779452+Tabernacle" website="http://www.tabernacleatl.com/" phonenumber="404.659.9022">
|
283
|
+
<location city="Atlanta" country="United States" street="152 Luckie Street" postalcode="30303">
|
284
|
+
<point lat="33.758688" long="-84.391449" />
|
285
|
+
</location>
|
286
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/286678.jpg</image>
|
287
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/286678.jpg</image>
|
288
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/286678.jpg</image>
|
289
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/286678.jpg</image>
|
290
|
+
<image size="mega">http://userserve-ak.last.fm/serve/_/286678/Tabernacle.jpg</image>
|
291
|
+
</venue>
|
292
|
+
<description></description>
|
293
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/44079721.jpg</image>
|
294
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/44079721.jpg</image>
|
295
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/44079721.jpg</image>
|
296
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/44079721.jpg</image>
|
297
|
+
<tag>lastfm:event=3465090</tag>
|
298
|
+
<website></website>
|
299
|
+
<tickets></tickets>
|
300
|
+
<tags>
|
301
|
+
<tag>alternative</tag>
|
302
|
+
<tag>alternative rock</tag>
|
303
|
+
<tag>deftones</tag>
|
304
|
+
<tag>rock</tag>
|
305
|
+
<tag>alternative metal</tag>
|
306
|
+
<tag>nu metal</tag>
|
307
|
+
<tag>metal</tag>
|
308
|
+
</tags>
|
309
|
+
</event>
|
310
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3459520" title="Frightened Rabbit" score="0.12979763045985" startDate="Wed, 10 Apr 2013 16:33:01" attendance="8" reviews="0" url="http://www.last.fm/event/3459520+Frightened+Rabbit+at+Masquerade+on+10+April+2013" cancelled="0">
|
311
|
+
<artists headliner="Frightened Rabbit">
|
312
|
+
<artist>Frightened Rabbit</artist>
|
313
|
+
<artist>Wintersleep</artist>
|
314
|
+
</artists>
|
315
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
316
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
317
|
+
<point lat="33.77103" long="-84.364537" />
|
318
|
+
</location>
|
319
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
320
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
321
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
322
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
323
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
324
|
+
</venue>
|
325
|
+
<description></description>
|
326
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/10397305.jpg</image>
|
327
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/10397305.jpg</image>
|
328
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/10397305.jpg</image>
|
329
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/10397305.jpg</image>
|
330
|
+
<tag>lastfm:event=3459520</tag>
|
331
|
+
<website></website>
|
332
|
+
<tickets></tickets>
|
333
|
+
<tags>
|
334
|
+
<tag>indie</tag>
|
335
|
+
<tag>indie rock</tag>
|
336
|
+
<tag>canadian</tag>
|
337
|
+
<tag>rock</tag>
|
338
|
+
<tag>chuck</tag>
|
339
|
+
<tag>folk</tag>
|
340
|
+
<tag>scottish</tag>
|
341
|
+
<tag>alternative</tag>
|
342
|
+
</tags>
|
343
|
+
</event>
|
344
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3485577" title="Cold War Kids" score="0.027901239125896" startDate="Wed, 17 Apr 2013 19:00:00" description="<div class="bbcode">$21.00 ADV<br />All Ages</div>" attendance="6" reviews="0" url="http://www.last.fm/event/3485577+Cold+War+Kids+at+Masquerade+on+17+April+2013" website="http://www.masqueradeatlanta.com/events/cold-war-kids" cancelled="0">
|
345
|
+
<artists artist="Cold War Kids" headliner="Cold War Kids" />
|
346
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
347
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
348
|
+
<point lat="33.77103" long="-84.364537" />
|
349
|
+
</location>
|
350
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
351
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
352
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
353
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
354
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
355
|
+
</venue>
|
356
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/62173861.png</image>
|
357
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/62173861.png</image>
|
358
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/62173861.png</image>
|
359
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/62173861.png</image>
|
360
|
+
<tag>lastfm:event=3485577</tag>
|
361
|
+
<tickets></tickets>
|
362
|
+
<tags>
|
363
|
+
<tag>indie rock</tag>
|
364
|
+
<tag>alternative</tag>
|
365
|
+
<tag>indie</tag>
|
366
|
+
<tag>rock</tag>
|
367
|
+
</tags>
|
368
|
+
</event>
|
369
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3477578" title="The Flaming Lips" score="0.59762098304991" startDate="Thu, 02 May 2013 20:00:00" attendance="26" reviews="0" url="http://www.last.fm/event/3477578+The+Flaming+Lips+at+Aaron%27s+Amphitheatre+at+Lakewood+on+2+May+2013" cancelled="0">
|
370
|
+
<artists headliner="The Flaming Lips">
|
371
|
+
<artist>The Flaming Lips</artist>
|
372
|
+
<artist>The Black Keys</artist>
|
373
|
+
</artists>
|
374
|
+
<venue id="10251268" name="Aaron's Amphitheatre at Lakewood" url="http://www.last.fm/venue/10251268+Aaron%27s+Amphitheatre+at+Lakewood" website="http://www.livenation.com/Aarons-Amphitheatre-at-Lakewood-tickets-Atlanta/venue/114696">
|
375
|
+
<location city="Atlanta" country="United States" street="2002 Lakewood Way" postalcode="30315">
|
376
|
+
<point lat="33.700591" long="-84.388851" />
|
377
|
+
</location>
|
378
|
+
<phonenumber></phonenumber>
|
379
|
+
<image size="small" />
|
380
|
+
<image size="medium" />
|
381
|
+
<image size="large" />
|
382
|
+
<image size="extralarge" />
|
383
|
+
<image size="mega" />
|
384
|
+
</venue>
|
385
|
+
<description></description>
|
386
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/45645777.jpg</image>
|
387
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/45645777.jpg</image>
|
388
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/45645777.jpg</image>
|
389
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/45645777.jpg</image>
|
390
|
+
<tag>lastfm:event=3477578</tag>
|
391
|
+
<website></website>
|
392
|
+
<tickets></tickets>
|
393
|
+
<tags>
|
394
|
+
<tag>rock</tag>
|
395
|
+
<tag>blues</tag>
|
396
|
+
<tag>alternative</tag>
|
397
|
+
<tag>indie</tag>
|
398
|
+
<tag>alternative rock</tag>
|
399
|
+
<tag>psychedelic</tag>
|
400
|
+
<tag>indie rock</tag>
|
401
|
+
<tag>garage rock</tag>
|
402
|
+
<tag>blues rock</tag>
|
403
|
+
</tags>
|
404
|
+
</event>
|
405
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3497278" title="James Blake" score="0.37077803318407" startDate="Tue, 14 May 2013 20:00:01" description="<div class="bbcode"><a href="http://www.xlr8r.com/news/2013/01/james-blake-announces-north-amer" rel="nofollow">http://www.xlr8r.com/news/2013/01/james-blake-announces-north-amer</a></div>" attendance="14" reviews="0" url="http://www.last.fm/event/3497278+James+Blake+at+Masquerade+on+14+May+2013" cancelled="0">
|
406
|
+
<artists artist="James Blake" headliner="James Blake" />
|
407
|
+
<venue id="8805389" name="Masquerade" url="http://www.last.fm/venue/8805389+Masquerade" website="http://www.masqueradeatlanta.com/" phonenumber="404-577-8178">
|
408
|
+
<location city="Atlanta" country="United States" street="695 North Ave N.E." postalcode="30308">
|
409
|
+
<point lat="33.77103" long="-84.364537" />
|
410
|
+
</location>
|
411
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/52546935.jpg</image>
|
412
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/52546935.jpg</image>
|
413
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/52546935.jpg</image>
|
414
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/52546935.jpg</image>
|
415
|
+
<image size="mega">http://userserve-ak.last.fm/serve/500/52546935/Masquerade+Masq_atlanta.jpg</image>
|
416
|
+
</venue>
|
417
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/69795422.jpg</image>
|
418
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/69795422.jpg</image>
|
419
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/69795422.jpg</image>
|
420
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/69795422.jpg</image>
|
421
|
+
<tag>lastfm:event=3497278</tag>
|
422
|
+
<website></website>
|
423
|
+
<tickets></tickets>
|
424
|
+
<tags>
|
425
|
+
<tag>electronic</tag>
|
426
|
+
<tag>dubstep</tag>
|
427
|
+
<tag>experimental</tag>
|
428
|
+
<tag>british</tag>
|
429
|
+
</tags>
|
430
|
+
</event>
|
431
|
+
<event xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" status="2" id="3422934" title="The Vans Warped Tour 2013" score="0.34040562166752" startDate="Thu, 25 Jul 2013 21:56:01" description="<div class="bbcode">Venue subject to change... If it does in fact change when venues are announced, I will move the event to the new venue.</div>" attendance="13" reviews="0" url="http://www.last.fm/festival/3422934+The+Vans+Warped+Tour+2013" cancelled="0">
|
432
|
+
<artists headliner="Motion City Soundtrack">
|
433
|
+
<artist>Motion City Soundtrack</artist>
|
434
|
+
<artist>Reel Big Fish</artist>
|
435
|
+
<artist>Hawthorne Heights</artist>
|
436
|
+
<artist>Forever The Sickest Kids</artist>
|
437
|
+
<artist>Chiodos</artist>
|
438
|
+
<artist>blessthefall</artist>
|
439
|
+
<artist>The Early November</artist>
|
440
|
+
<artist>We Came As Romans</artist>
|
441
|
+
<artist>The Black Dahlia Murder</artist>
|
442
|
+
<artist>Big D and the Kids Table</artist>
|
443
|
+
<artist>The Summer Set</artist>
|
444
|
+
<artist>Architects</artist>
|
445
|
+
<artist>Anarbor</artist>
|
446
|
+
<artist>Oh, Sleeper</artist>
|
447
|
+
<artist>The Chariot</artist>
|
448
|
+
<artist>Go Radio</artist>
|
449
|
+
<artist>Woe, Is Me</artist>
|
450
|
+
<artist>Stick To Your Guns</artist>
|
451
|
+
<artist>I See Stars</artist>
|
452
|
+
<artist>MC Lars</artist>
|
453
|
+
<artist>VersaEmerge</artist>
|
454
|
+
<artist>Man Overboard</artist>
|
455
|
+
<artist>Allstar Weekend</artist>
|
456
|
+
<artist>The Amity Affliction</artist>
|
457
|
+
<artist>Defeater</artist>
|
458
|
+
<artist>New Years Day</artist>
|
459
|
+
<artist>Outasight</artist>
|
460
|
+
<artist>Mac Lethal</artist>
|
461
|
+
<artist>Tonight Alive</artist>
|
462
|
+
<artist>While She Sleeps</artist>
|
463
|
+
<artist>The Story So Far</artist>
|
464
|
+
<artist>Letlive</artist>
|
465
|
+
<artist>Like Moths To Flames</artist>
|
466
|
+
<artist>Big Chocolate</artist>
|
467
|
+
<artist>Upon A Burning Body</artist>
|
468
|
+
<artist>Wallpaper.</artist>
|
469
|
+
<artist>Hands Like Houses</artist>
|
470
|
+
<artist>Alvarez kings</artist>
|
471
|
+
<artist>Itch</artist>
|
472
|
+
<artist>Middle Finger Salute</artist>
|
473
|
+
<artist>Action Item</artist>
|
474
|
+
<artist>For The Foxes</artist>
|
475
|
+
<artist>Stephan Jacobs</artist>
|
476
|
+
<artist>Young London</artist>
|
477
|
+
<artist>Goldhouse</artist>
|
478
|
+
<artist>RDGLDGRN</artist>
|
479
|
+
<artist>Shy Kidx</artist>
|
480
|
+
<artist>Five Knives</artist>
|
481
|
+
<artist>Beebs and Her Money Makers</artist>
|
482
|
+
</artists>
|
483
|
+
<venue id="10251268" name="Aaron's Amphitheatre at Lakewood" url="http://www.last.fm/venue/10251268+Aaron%27s+Amphitheatre+at+Lakewood" website="http://www.livenation.com/Aarons-Amphitheatre-at-Lakewood-tickets-Atlanta/venue/114696">
|
484
|
+
<location city="Atlanta" country="United States" street="2002 Lakewood Way" postalcode="30315">
|
485
|
+
<point lat="33.700591" long="-84.388851" />
|
486
|
+
</location>
|
487
|
+
<phonenumber></phonenumber>
|
488
|
+
<image size="small" />
|
489
|
+
<image size="medium" />
|
490
|
+
<image size="large" />
|
491
|
+
<image size="extralarge" />
|
492
|
+
<image size="mega" />
|
493
|
+
</venue>
|
494
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/5681231.jpg</image>
|
495
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/5681231.jpg</image>
|
496
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/5681231.jpg</image>
|
497
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/5681231.jpg</image>
|
498
|
+
<tag>lastfm:event=3422934</tag>
|
499
|
+
<website></website>
|
500
|
+
<tickets></tickets>
|
501
|
+
</event>
|
502
|
+
</events>
|
503
|
+
</opt>
|
data/spec/lastfm_spec.rb
CHANGED
@@ -3,10 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Lastfm" do
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
|
-
it 'should have base_uri' do
|
7
|
-
Lastfm.base_uri.should == 'http://ws.audioscrobbler.com/2.0'
|
8
|
-
end
|
9
|
-
|
10
6
|
describe '.new' do
|
11
7
|
it 'should instantiate' do
|
12
8
|
@lastfm.should be_an_instance_of(Lastfm)
|
@@ -16,7 +12,7 @@ describe "Lastfm" do
|
|
16
12
|
describe '#request' do
|
17
13
|
it 'should post' do
|
18
14
|
mock_response = mock(HTTParty::Response)
|
19
|
-
|
15
|
+
HTTPRequest.should_receive(:post).with('/', :body => {
|
20
16
|
:foo => 'bar',
|
21
17
|
:method => 'xxx.yyy',
|
22
18
|
:api_key => 'xxx',
|
@@ -27,7 +23,7 @@ describe "Lastfm" do
|
|
27
23
|
|
28
24
|
it 'should post with signature' do
|
29
25
|
mock_response = mock(HTTParty::Response)
|
30
|
-
|
26
|
+
HTTPRequest.should_receive(:post).with('/', :body => {
|
31
27
|
:foo => 'bar',
|
32
28
|
:method => 'xxx.yyy',
|
33
29
|
:api_key => 'xxx',
|
@@ -40,7 +36,7 @@ describe "Lastfm" do
|
|
40
36
|
it 'should post with signature and session (request with authentication)' do
|
41
37
|
mock_response = mock(HTTParty::Response)
|
42
38
|
@lastfm.session = 'abcdef'
|
43
|
-
|
39
|
+
HTTPRequest.should_receive(:post).with('/', :body => {
|
44
40
|
:foo => 'bar',
|
45
41
|
:method => 'xxx.yyy',
|
46
42
|
:api_key => 'xxx',
|
@@ -53,7 +49,7 @@ describe "Lastfm" do
|
|
53
49
|
|
54
50
|
it 'should get' do
|
55
51
|
mock_response = mock(HTTParty::Response)
|
56
|
-
|
52
|
+
HTTPRequest.should_receive(:get).with('/', :query => {
|
57
53
|
:foo => 'bar',
|
58
54
|
:method => 'xxx.yyy',
|
59
55
|
:api_key => 'xxx',
|
@@ -64,7 +60,7 @@ describe "Lastfm" do
|
|
64
60
|
|
65
61
|
it 'should get with signature (request for authentication)' do
|
66
62
|
mock_response = mock(HTTParty::Response)
|
67
|
-
|
63
|
+
HTTPRequest.should_receive(:get).with('/', :query => {
|
68
64
|
:foo => 'bar',
|
69
65
|
:method => 'xxx.yyy',
|
70
66
|
:api_key => 'xxx',
|
@@ -77,7 +73,7 @@ describe "Lastfm" do
|
|
77
73
|
it 'should get with signature and session' do
|
78
74
|
mock_response = mock(HTTParty::Response)
|
79
75
|
@lastfm.session = 'abcdef'
|
80
|
-
|
76
|
+
HTTPRequest.should_receive(:get).with('/', :query => {
|
81
77
|
:foo => 'bar',
|
82
78
|
:method => 'xxx.yyy',
|
83
79
|
:api_key => 'xxx',
|
@@ -91,7 +87,7 @@ describe "Lastfm" do
|
|
91
87
|
it 'should raise an error if an api error is ocuured' do
|
92
88
|
mock_response = mock(HTTParty::Response)
|
93
89
|
mock_response.should_receive(:body).and_return(open(fixture('ng.xml')).read)
|
94
|
-
|
90
|
+
HTTPRequest.should_receive(:post).and_return(mock_response)
|
95
91
|
|
96
92
|
lambda {
|
97
93
|
@lastfm.request('xxx.yyy', { :foo => 'bar' }, :post)
|
@@ -138,7 +134,7 @@ XML
|
|
138
134
|
|
139
135
|
it 'should get mobile session' do
|
140
136
|
@lastfm.should_receive(:request).
|
141
|
-
with('auth.getMobileSession', { :username => 'xxxyyyzzz', :
|
137
|
+
with('auth.getMobileSession', { :username => 'xxxyyyzzz', :password => 'sekretz' }, :post, true, false, true).
|
142
138
|
and_return(make_response(<<XML))
|
143
139
|
<?xml version="1.0" encoding="utf-8"?>
|
144
140
|
<lfm status="ok">
|
@@ -149,7 +145,7 @@ XML
|
|
149
145
|
</session>
|
150
146
|
</lfm>
|
151
147
|
XML
|
152
|
-
session = @lastfm.auth.get_mobile_session('xxxyyyzzz', '
|
148
|
+
session = @lastfm.auth.get_mobile_session('xxxyyyzzz', 'sekretz')
|
153
149
|
session['name'].should == 'MyLastFMUsername'
|
154
150
|
session['key'].should == 'zzzyyyxxx'
|
155
151
|
end
|
@@ -298,4 +298,15 @@ describe '#user' do
|
|
298
298
|
weekly_tracks.size.should == 3
|
299
299
|
end
|
300
300
|
end
|
301
|
+
|
302
|
+
describe '#get_recommended_events' do
|
303
|
+
it 'should get a user\'s list of recommended events' do
|
304
|
+
@lastfm.should_receive(:request).with('user.getRecommendedEvents', {}, :get, true, true) {
|
305
|
+
make_response('user_get_recommended_events') }
|
306
|
+
|
307
|
+
recommended_events = @lastfm.user.get_recommended_events
|
308
|
+
recommended_events[0]['artists']['headliner'].should == 'Toro y Moi'
|
309
|
+
recommended_events[1]['artists']['headliner'].should == 'Reel Big Fish'
|
310
|
+
end
|
311
|
+
end
|
301
312
|
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.
|
4
|
+
version: 1.15.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: 2013-
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-simple
|
@@ -107,6 +107,8 @@ files:
|
|
107
107
|
- Rakefile
|
108
108
|
- lastfm.gemspec
|
109
109
|
- lib/lastfm.rb
|
110
|
+
- lib/lastfm/http_request.rb
|
111
|
+
- lib/lastfm/https_request.rb
|
110
112
|
- lib/lastfm/method_category/album.rb
|
111
113
|
- lib/lastfm/method_category/artist.rb
|
112
114
|
- lib/lastfm/method_category/auth.rb
|
@@ -162,6 +164,7 @@ files:
|
|
162
164
|
- spec/fixtures/user_get_personal_tags_tracks.xml
|
163
165
|
- spec/fixtures/user_get_recent_tracks.xml
|
164
166
|
- spec/fixtures/user_get_recent_tracks_malformed.xml
|
167
|
+
- spec/fixtures/user_get_recommended_events.xml
|
165
168
|
- spec/fixtures/user_get_top_albums.xml
|
166
169
|
- spec/fixtures/user_get_top_artists.xml
|
167
170
|
- spec/fixtures/user_get_top_tags.xml
|
@@ -200,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
203
|
version: '0'
|
201
204
|
segments:
|
202
205
|
- 0
|
203
|
-
hash:
|
206
|
+
hash: -3088818819595040993
|
204
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
208
|
none: false
|
206
209
|
requirements:
|
@@ -209,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
212
|
version: '0'
|
210
213
|
segments:
|
211
214
|
- 0
|
212
|
-
hash:
|
215
|
+
hash: -3088818819595040993
|
213
216
|
requirements: []
|
214
217
|
rubyforge_project:
|
215
218
|
rubygems_version: 1.8.24
|
@@ -257,6 +260,7 @@ test_files:
|
|
257
260
|
- spec/fixtures/user_get_personal_tags_tracks.xml
|
258
261
|
- spec/fixtures/user_get_recent_tracks.xml
|
259
262
|
- spec/fixtures/user_get_recent_tracks_malformed.xml
|
263
|
+
- spec/fixtures/user_get_recommended_events.xml
|
260
264
|
- spec/fixtures/user_get_top_albums.xml
|
261
265
|
- spec/fixtures/user_get_top_artists.xml
|
262
266
|
- spec/fixtures/user_get_top_tags.xml
|