hornairs-scrobbler 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. data/.gitignore +13 -0
  2. data/.loadpath +5 -0
  3. data/History.txt +5 -0
  4. data/MIT-LICENSE +19 -0
  5. data/Manifest +75 -0
  6. data/README.rdoc +104 -0
  7. data/Rakefile +10 -0
  8. data/VERSION.yml +5 -0
  9. data/examples/album.rb +20 -0
  10. data/examples/artist.rb +13 -0
  11. data/examples/playlist.rb +7 -0
  12. data/examples/scrobble.rb +31 -0
  13. data/examples/tag.rb +11 -0
  14. data/examples/track.rb +12 -0
  15. data/examples/user.rb +15 -0
  16. data/lib/scrobbler.rb +33 -0
  17. data/lib/scrobbler/album.rb +181 -0
  18. data/lib/scrobbler/artist.rb +165 -0
  19. data/lib/scrobbler/auth.rb +47 -0
  20. data/lib/scrobbler/base.rb +105 -0
  21. data/lib/scrobbler/event.rb +105 -0
  22. data/lib/scrobbler/geo.rb +27 -0
  23. data/lib/scrobbler/helper/image.rb +52 -0
  24. data/lib/scrobbler/helper/streamable.rb +40 -0
  25. data/lib/scrobbler/library.rb +112 -0
  26. data/lib/scrobbler/playing.rb +49 -0
  27. data/lib/scrobbler/playlist.rb +87 -0
  28. data/lib/scrobbler/radio.rb +12 -0
  29. data/lib/scrobbler/rest.rb +47 -0
  30. data/lib/scrobbler/scrobble.rb +116 -0
  31. data/lib/scrobbler/session.rb +9 -0
  32. data/lib/scrobbler/shout.rb +21 -0
  33. data/lib/scrobbler/simpleauth.rb +60 -0
  34. data/lib/scrobbler/tag.rb +113 -0
  35. data/lib/scrobbler/track.rb +152 -0
  36. data/lib/scrobbler/user.rb +222 -0
  37. data/lib/scrobbler/venue.rb +67 -0
  38. data/setup.rb +1585 -0
  39. data/tasks/jeweler.rake +15 -0
  40. data/tasks/rdoc.rake +7 -0
  41. data/tasks/tests.rake +13 -0
  42. data/tasks/yardoc.rake +8 -0
  43. data/test/fixtures/xml/album/info.xml +43 -0
  44. data/test/fixtures/xml/artist/fans.xml +52 -0
  45. data/test/fixtures/xml/artist/info.xml +58 -0
  46. data/test/fixtures/xml/artist/similar.xml +1004 -0
  47. data/test/fixtures/xml/artist/topalbums.xml +61 -0
  48. data/test/fixtures/xml/artist/toptags.xml +19 -0
  49. data/test/fixtures/xml/artist/toptracks.xml +62 -0
  50. data/test/fixtures/xml/auth/session.xml +7 -0
  51. data/test/fixtures/xml/auth/token.xml +3 -0
  52. data/test/fixtures/xml/event/attend.xml +3 -0
  53. data/test/fixtures/xml/event/attendees.xml +53 -0
  54. data/test/fixtures/xml/event/event.xml +35 -0
  55. data/test/fixtures/xml/event/shouts.xml +35 -0
  56. data/test/fixtures/xml/geo/events-distance-p1.xml +151 -0
  57. data/test/fixtures/xml/geo/events-lat-long.xml +167 -0
  58. data/test/fixtures/xml/geo/events-p1.xml +152 -0
  59. data/test/fixtures/xml/geo/events-p2.xml +380 -0
  60. data/test/fixtures/xml/geo/events-p3.xml +427 -0
  61. data/test/fixtures/xml/geo/top_artists-p1.xml +76 -0
  62. data/test/fixtures/xml/geo/top_tracks-p1.xml +77 -0
  63. data/test/fixtures/xml/library/albums-f30.xml +454 -0
  64. data/test/fixtures/xml/library/albums-p1.xml +754 -0
  65. data/test/fixtures/xml/library/albums-p2.xml +754 -0
  66. data/test/fixtures/xml/library/albums-p3.xml +754 -0
  67. data/test/fixtures/xml/library/albums-p4.xml +739 -0
  68. data/test/fixtures/xml/library/albums-p5.xml +754 -0
  69. data/test/fixtures/xml/library/albums-p6.xml +754 -0
  70. data/test/fixtures/xml/library/albums-p7.xml +739 -0
  71. data/test/fixtures/xml/library/albums-p8.xml +724 -0
  72. data/test/fixtures/xml/library/artists-f30.xml +334 -0
  73. data/test/fixtures/xml/library/artists-p1.xml +554 -0
  74. data/test/fixtures/xml/library/artists-p2.xml +554 -0
  75. data/test/fixtures/xml/library/artists-p3.xml +554 -0
  76. data/test/fixtures/xml/library/artists-p4.xml +554 -0
  77. data/test/fixtures/xml/library/artists-p5.xml +554 -0
  78. data/test/fixtures/xml/library/artists-p6.xml +554 -0
  79. data/test/fixtures/xml/library/artists-p7.xml +444 -0
  80. data/test/fixtures/xml/library/tracks-f30.xml +472 -0
  81. data/test/fixtures/xml/library/tracks-p1.xml +789 -0
  82. data/test/fixtures/xml/library/tracks-p10.xml +771 -0
  83. data/test/fixtures/xml/library/tracks-p11.xml +792 -0
  84. data/test/fixtures/xml/library/tracks-p12.xml +777 -0
  85. data/test/fixtures/xml/library/tracks-p13.xml +762 -0
  86. data/test/fixtures/xml/library/tracks-p14.xml +759 -0
  87. data/test/fixtures/xml/library/tracks-p15.xml +762 -0
  88. data/test/fixtures/xml/library/tracks-p16.xml +756 -0
  89. data/test/fixtures/xml/library/tracks-p17.xml +780 -0
  90. data/test/fixtures/xml/library/tracks-p18.xml +756 -0
  91. data/test/fixtures/xml/library/tracks-p19.xml +774 -0
  92. data/test/fixtures/xml/library/tracks-p2.xml +765 -0
  93. data/test/fixtures/xml/library/tracks-p20.xml +777 -0
  94. data/test/fixtures/xml/library/tracks-p21.xml +777 -0
  95. data/test/fixtures/xml/library/tracks-p22.xml +771 -0
  96. data/test/fixtures/xml/library/tracks-p23.xml +765 -0
  97. data/test/fixtures/xml/library/tracks-p24.xml +783 -0
  98. data/test/fixtures/xml/library/tracks-p25.xml +777 -0
  99. data/test/fixtures/xml/library/tracks-p26.xml +777 -0
  100. data/test/fixtures/xml/library/tracks-p27.xml +756 -0
  101. data/test/fixtures/xml/library/tracks-p28.xml +771 -0
  102. data/test/fixtures/xml/library/tracks-p29.xml +753 -0
  103. data/test/fixtures/xml/library/tracks-p3.xml +771 -0
  104. data/test/fixtures/xml/library/tracks-p30.xml +780 -0
  105. data/test/fixtures/xml/library/tracks-p31.xml +753 -0
  106. data/test/fixtures/xml/library/tracks-p32.xml +771 -0
  107. data/test/fixtures/xml/library/tracks-p33.xml +762 -0
  108. data/test/fixtures/xml/library/tracks-p34.xml +538 -0
  109. data/test/fixtures/xml/library/tracks-p4.xml +792 -0
  110. data/test/fixtures/xml/library/tracks-p5.xml +780 -0
  111. data/test/fixtures/xml/library/tracks-p6.xml +789 -0
  112. data/test/fixtures/xml/library/tracks-p7.xml +789 -0
  113. data/test/fixtures/xml/library/tracks-p8.xml +780 -0
  114. data/test/fixtures/xml/library/tracks-p9.xml +774 -0
  115. data/test/fixtures/xml/tag/similar.xml +254 -0
  116. data/test/fixtures/xml/tag/topalbums.xml +805 -0
  117. data/test/fixtures/xml/tag/topartists.xml +605 -0
  118. data/test/fixtures/xml/tag/toptags.xml +1254 -0
  119. data/test/fixtures/xml/tag/toptracks.xml +852 -0
  120. data/test/fixtures/xml/track/fans.xml +34 -0
  121. data/test/fixtures/xml/track/info.xml +53 -0
  122. data/test/fixtures/xml/track/toptags.xml +504 -0
  123. data/test/fixtures/xml/user/events.xml +401 -0
  124. data/test/fixtures/xml/user/friends.xml +30 -0
  125. data/test/fixtures/xml/user/lovedtracks.xml +678 -0
  126. data/test/fixtures/xml/user/neighbours.xml +23 -0
  127. data/test/fixtures/xml/user/playlists.xml +61 -0
  128. data/test/fixtures/xml/user/profile.xml +12 -0
  129. data/test/fixtures/xml/user/recentbannedtracks.xml +24 -0
  130. data/test/fixtures/xml/user/recentlovedtracks.xml +24 -0
  131. data/test/fixtures/xml/user/recenttracks.xml +124 -0
  132. data/test/fixtures/xml/user/systemrecs.xml +18 -0
  133. data/test/fixtures/xml/user/topalbums.xml +61 -0
  134. data/test/fixtures/xml/user/topartists.xml +41 -0
  135. data/test/fixtures/xml/user/toptags.xml +44 -0
  136. data/test/fixtures/xml/user/toptracks.xml +65 -0
  137. data/test/fixtures/xml/user/weeklyalbumchart.xml +256 -0
  138. data/test/fixtures/xml/user/weeklyartistchart.xml +220 -0
  139. data/test/fixtures/xml/user/weeklytrackchart.xml +746 -0
  140. data/test/fixtures/xml/venue/events.xml +151 -0
  141. data/test/fixtures/xml/venue/venue.xml +16 -0
  142. data/test/mocks/rest.rb +212 -0
  143. data/test/spec_helper.rb +7 -0
  144. data/test/test_helper.rb +20 -0
  145. data/test/unit/album_spec.rb +52 -0
  146. data/test/unit/artist_spec.rb +130 -0
  147. data/test/unit/auth_spec.rb +36 -0
  148. data/test/unit/event_spec.rb +109 -0
  149. data/test/unit/geo_spec.rb +148 -0
  150. data/test/unit/library_spec.rb +133 -0
  151. data/test/unit/playing_test.rb +53 -0
  152. data/test/unit/playlist_spec.rb +25 -0
  153. data/test/unit/radio_spec.rb +22 -0
  154. data/test/unit/scrobble_spec.rb +55 -0
  155. data/test/unit/scrobble_test.rb +69 -0
  156. data/test/unit/simpleauth_test.rb +45 -0
  157. data/test/unit/tag_spec.rb +101 -0
  158. data/test/unit/track_spec.rb +95 -0
  159. data/test/unit/user_spec.rb +264 -0
  160. data/test/unit/venue_spec.rb +104 -0
  161. metadata +265 -0
@@ -0,0 +1,264 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Scrobbler::User do
4
+
5
+ before(:all) do
6
+ @user = Scrobbler::User.new('jnunemaker')
7
+ end
8
+
9
+ it 'should know its name' do
10
+ @user.name.should eql('jnunemaker')
11
+ end
12
+
13
+ it 'should implement all methods from the Last.fm 2.0 API' do
14
+ @user.should respond_to(:events)
15
+ @user.should respond_to(:friends)
16
+ @user.should respond_to(:load_info)
17
+ @user.should respond_to(:loved_tracks)
18
+ @user.should respond_to(:neighbours)
19
+ @user.should respond_to(:past_events)
20
+ @user.should respond_to(:playlists)
21
+ @user.should respond_to(:recent_tracks)
22
+ @user.should respond_to(:recommended_artists)
23
+ @user.should respond_to(:recommended_events)
24
+ @user.should respond_to(:shouts)
25
+ @user.should respond_to(:top_albums)
26
+ @user.should respond_to(:top_artists)
27
+ @user.should respond_to(:top_tags)
28
+ @user.should respond_to(:top_tracks)
29
+ @user.should respond_to(:weekly_album_chart)
30
+ @user.should respond_to(:weekly_artist_chart)
31
+ @user.should respond_to(:weekly_chart_list)
32
+ @user.should respond_to(:weekly_track_chart)
33
+ @user.should respond_to(:shout)
34
+ end
35
+
36
+ it 'should be able to get a list of upcoming events this user is attending' do
37
+ @user.events.should be_kind_of(Array)
38
+ @user.events.should have(7).items
39
+ @user.events.first.should be_kind_of(Scrobbler::Event)
40
+ @user.events.first.id.should eql(1030003)
41
+ @user.events.first.title.should eql('The Mars Volta')
42
+ @user.events.first.headliner.should be_kind_of(Scrobbler::Artist)
43
+ @user.events.first.headliner.name.should eql('The Mars Volta')
44
+ @user.events.first.artists.should be_kind_of(Array)
45
+ @user.events.first.artists.should have(1).items
46
+ @user.events.first.artists.first.should be_kind_of(Scrobbler::Artist)
47
+ @user.events.first.artists.first.name.should eql('The Mars Volta')
48
+ @user.events.first.venue.should be_kind_of(Scrobbler::Venue)
49
+ @user.events.first.venue.name.should eql('Somerset House')
50
+ @user.events.first.venue.id.should eql(8796717)
51
+ @user.events.first.venue.city.should eql('London')
52
+ @user.events.first.venue.country.should eql('United Kingdom')
53
+ @user.events.first.venue.street.should eql('Strand')
54
+ @user.events.first.venue.postalcode.should eql('WC2R 1LA')
55
+ @user.events.first.venue.geo_lat.should eql('51.510732')
56
+ @user.events.first.venue.geo_long.should eql('-0.116937')
57
+ @user.events.first.venue.url.should eql('http://www.last.fm/venue/8796717')
58
+ @user.events.first.start_date.should eql(Time.mktime(2009, 07, 13, 19, 30, 00))
59
+ @user.events.first.description.should eql('<div class="bbcode"><a href="http://www.nme.com/news/nme/44079" rel="nofollow">http://www.nme.com/news/nme/44079</a></div>')
60
+ end
61
+
62
+ it 'should be able to get a list of its friends' do
63
+ @user.friends.should be_kind_of(Array)
64
+ @user.friends.should have(3).items
65
+ @user.friends.first.should be_kind_of(Scrobbler::User)
66
+ @user.friends.first.name.should eql('lobsterclaw')
67
+ @user.friends.first.realname.should eql('Laura Weiss')
68
+ @user.friends.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/1733471.jpg')
69
+ @user.friends.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/1733471.jpg')
70
+ @user.friends.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/1733471.jpg')
71
+ @user.friends.first.url.should eql('http://www.last.fm/user/lobsterclaw')
72
+ end
73
+
74
+ it 'should be able to load additional information'
75
+
76
+ it 'should be able to get its loved tracks' do
77
+ @user.loved_tracks.should be_kind_of(Array)
78
+ @user.loved_tracks.should have(49).items
79
+ @user.loved_tracks.first.should be_kind_of(Scrobbler::Track)
80
+ @user.loved_tracks.first.name.should eql('Early Mornin\' Stoned Pimp')
81
+ @user.loved_tracks.first.mbid.should eql('')
82
+ @user.loved_tracks.first.url.should eql('www.last.fm/music/Kid+Rock/_/Early+Mornin%27+Stoned+Pimp')
83
+ @user.loved_tracks.first.date.should eql(Time.mktime(2009, 4, 28, 11, 38, 0))
84
+ @user.loved_tracks.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/3458313.jpg')
85
+ @user.loved_tracks.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/3458313.jpg')
86
+ @user.loved_tracks.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/3458313.jpg')
87
+ @user.loved_tracks.first.artist.should be_kind_of(Scrobbler::Artist)
88
+ @user.loved_tracks.first.artist.name.should eql('Kid Rock')
89
+ @user.loved_tracks.first.artist.mbid.should eql('ad0ecd8b-805e-406e-82cb-5b00c3a3a29e')
90
+ @user.loved_tracks.first.artist.url.should eql('http://www.last.fm/music/Kid+Rock')
91
+ end
92
+
93
+ it 'should be able to list the neighbours' do
94
+ @user.should have(2).neighbours
95
+ @user.neighbours.first.should be_kind_of(Scrobbler::User)
96
+ @user.neighbours.first.name.should eql('Driotheri')
97
+ @user.neighbours.first.url.should eql('http://www.last.fm/user/Driotheri')
98
+ @user.neighbours.first.match.should eql('0.00027966260677204')
99
+ @user.neighbours.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/6070771.jpg')
100
+ @user.neighbours.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/6070771.jpg')
101
+ @user.neighbours.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/6070771.jpg')
102
+ end
103
+
104
+ it 'should be able to list the attened events'
105
+
106
+ describe 'retrieving a users playlist' do
107
+
108
+ before do
109
+ @playlists = @user.playlists
110
+ @firstplaylist = @playlists.first
111
+ end
112
+
113
+ it 'should return 4 playlists' do
114
+ @playlists.size.should eql(4)
115
+ end
116
+
117
+ it 'should have the correct attributes in the first playlist' do
118
+ #@firstplaylist.id.should eql(5606)
119
+ require 'pp'
120
+ pp @firstplaylist.id
121
+ @firstplaylist.title.should eql('Misc gubbins')
122
+ @firstplaylist.description.should eql('This is a misc test playlist with a few random tracks in it.')
123
+ @firstplaylist.date.should eql(Time.mktime(2006, 11, 15, 13, 05, 48))
124
+ @firstplaylist.size.should eql(10)
125
+ @firstplaylist.duration.should eql(2771)
126
+ @firstplaylist.streamable.should be_false
127
+ @firstplaylist.creator.should eql('http://www.last.fm/user/RJ')
128
+ @firstplaylist.url.should eql('http://www.last.fm/user/RJ/library/playlists/4bq_misc_gubbins')
129
+ @firstplaylist.image(:small).should eql('http://userserve-ak.last.fm/serve/34/4218758.jpg')
130
+ @firstplaylist.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/4218758.jpg')
131
+ @firstplaylist.image(:large).should eql('http://userserve-ak.last.fm/serve/126/4218758.jpg')
132
+ end
133
+ end
134
+
135
+
136
+ it 'should be able to fetch the recent tracks' do
137
+ @user.should have(10).recent_tracks
138
+ @user.recent_tracks.first.should be_kind_of(Scrobbler::Track)
139
+ @user.recent_tracks.first.name.should eql('Empty Arms')
140
+ @user.recent_tracks.first.mbid.should eql('')
141
+ @user.recent_tracks.first.url.should eql('http://www.last.fm/music/Stevie+Ray+Vaughan/_/Empty+Arms')
142
+ @user.recent_tracks.first.date.should eql(Time.mktime(2009, 5, 6, 18, 16, 00))
143
+ @user.recent_tracks.first.now_playing.should be_true
144
+ @user.recent_tracks.first.streamable.should be_true
145
+ @user.recent_tracks.first.artist.should be_kind_of(Scrobbler::Artist)
146
+ @user.recent_tracks.first.artist.name.should eql('Stevie Ray Vaughan')
147
+ @user.recent_tracks.first.artist.mbid.should eql('f5426431-f490-4678-ad44-a75c71097bb4')
148
+ @user.recent_tracks.first.album.should be_kind_of(Scrobbler::Album)
149
+ @user.recent_tracks.first.album.mbid.should eql('dfb4ba34-6d3f-4d88-848f-e8cc1e7c24d7')
150
+ @user.recent_tracks.first.album.name.should eql('Sout To Soul')
151
+ @user.recent_tracks.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/4289298.jpg')
152
+ @user.recent_tracks.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/4289298.jpg')
153
+ @user.recent_tracks.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/4289298.jpg')
154
+ end
155
+
156
+ it 'should be able to list the recommended artists'
157
+
158
+ it 'should be able to list the recommended events'
159
+
160
+ it 'should be able to list the shouts'
161
+
162
+ it 'should be able to list the top albums' do
163
+ @user.should have(3).top_albums
164
+ @user.top_albums.first.should be_kind_of(Scrobbler::Album)
165
+ @user.top_albums.first.name.should eql('Slave To The Grid')
166
+ @user.top_albums.first.mbid.should eql('')
167
+ @user.top_albums.first.playcount.should eql(251)
168
+ @user.top_albums.first.rank.should eql(1)
169
+ @user.top_albums.first.artist.should be_kind_of(Scrobbler::Artist)
170
+ @user.top_albums.first.artist.name.should eql('Skid Row')
171
+ @user.top_albums.first.artist.mbid.should eql('6da0515e-a27d-449d-84cc-00713c38a140')
172
+ @user.top_albums.first.url.should eql('http://www.last.fm/music/Skid+Row/Slave+To+The+Grid')
173
+ @user.top_albums.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/12621887.jpg')
174
+ @user.top_albums.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/12621887.jpg')
175
+ @user.top_albums.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/12621887.jpg')
176
+ end
177
+
178
+ it 'should be able to list the top artists' do
179
+ @user.should have(3).top_artists
180
+ @user.top_artists.first.should be_kind_of(Scrobbler::Artist)
181
+ first = @user.top_artists.first
182
+ first.name.should eql('Dream Theater')
183
+ first.mbid.should eql('28503ab7-8bf2-4666-a7bd-2644bfc7cb1d')
184
+ first.playcount.should eql(1643)
185
+ first.rank.should eql(1)
186
+ first.url.should eql('http://www.last.fm/music/Dream+Theater')
187
+ first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/5535004.jpg')
188
+ first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/5535004.jpg')
189
+ first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/5535004.jpg')
190
+ first.streamable.should be_true
191
+ end
192
+
193
+ it 'should be able to list the top tags' do
194
+ @user.should have(7).top_tags
195
+ @user.top_tags.first.should be_kind_of(Scrobbler::Tag)
196
+ first = @user.top_tags.first
197
+ first.name.should eql('rock')
198
+ first.count.should eql(16)
199
+ first.url.should eql('www.last.fm/tag/rock')
200
+ end
201
+
202
+ it 'should be able to list the top tracks' do
203
+ @user.should have(3).top_tracks
204
+ @user.top_tracks.first.should be_kind_of(Scrobbler::Track)
205
+ first = @user.top_tracks.first
206
+ first.name.should eql('Learning to Live')
207
+ first.mbid.should eql('')
208
+ first.playcount.should eql(51)
209
+ first.rank.should eql(1)
210
+ first.url.should eql('http://www.last.fm/music/Dream+Theater/_/Learning+to+Live')
211
+ first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/12620339.jpg')
212
+ first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/12620339.jpg')
213
+ first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/12620339.jpg')
214
+ first.artist.should be_kind_of(Scrobbler::Artist)
215
+ first.artist.name.should eql('Dream Theater')
216
+ first.artist.mbid.should eql('28503ab7-8bf2-4666-a7bd-2644bfc7cb1d')
217
+ first.artist.url.should eql('http://www.last.fm/music/Dream+Theater')
218
+ first.streamable.should be_true
219
+ end
220
+
221
+ it 'should be able to get the weekly album chart' do
222
+ @user.weekly_album_chart.should have(36).items
223
+ first = @user.weekly_album_chart.first
224
+ first.should be_kind_of(Scrobbler::Album)
225
+ first.artist.should be_kind_of(Scrobbler::Artist)
226
+ first.artist.name.should eql('Nine Inch Nails')
227
+ first.artist.mbid.should eql('b7ffd2af-418f-4be2-bdd1-22f8b48613da')
228
+ first.mbid.should eql('df025315-4897-4759-ba77-d2cd09b5b4b6')
229
+ first.name.should eql('With Teeth')
230
+ first.playcount.should eql(13)
231
+ first.rank.should eql(1)
232
+ first.url.should eql('http://www.last.fm/music/Nine+Inch+Nails/With+Teeth')
233
+ end
234
+
235
+ it 'should be able to get the weekly artist chart' do
236
+ @user.weekly_artist_chart.should have(36).items
237
+ first = @user.weekly_artist_chart.first
238
+ first.should be_kind_of(Scrobbler::Artist)
239
+ first.name.should eql('Nine Inch Nails')
240
+ first.mbid.should eql('b7ffd2af-418f-4be2-bdd1-22f8b48613da')
241
+ first.playcount.should eql(26)
242
+ first.rank.should eql(1)
243
+ first.url.should eql('http://www.last.fm/music/Nine+Inch+Nails')
244
+ end
245
+
246
+ it 'should be able to get the weekly chart list'
247
+
248
+ it 'should be able to get the weekly track chart' do
249
+ @user.weekly_track_chart.should have(106).items
250
+ first = @user.weekly_track_chart.first
251
+ first.should be_kind_of(Scrobbler::Track)
252
+ first.name.should eql('Three Minute Warning')
253
+ first.artist.should be_kind_of(Scrobbler::Artist)
254
+ first.artist.name.should eql('Liquid Tension Experiment')
255
+ first.artist.mbid.should eql('bc641be9-ca36-4c61-9394-5230433f6646')
256
+ first.mbid.should eql('')
257
+ first.playcount.should eql(5)
258
+ first.rank.should eql(1)
259
+ first.url.should eql('www.last.fm/music/Liquid+Tension+Experiment/_/Three+Minute+Warning')
260
+ end
261
+
262
+ it 'should be able to leave a shout'
263
+
264
+ end
@@ -0,0 +1,104 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Scrobbler::Venue do
4
+ before do
5
+ xml = LibXML::XML::Document.file(File.dirname(__FILE__) + '/../fixtures/xml/venue/venue.xml')
6
+ @venue = Scrobbler::Venue.new_from_xml(xml.root)
7
+ @event_ids = [875740, 950267, 1082373, 1059277]
8
+ @event_titles = ["Kilians", "Convention of the Universe - International Depeche Mode Fan Event", "The Get Up Kids", "Philipp Poisel"]
9
+ end
10
+
11
+ describe 'should implement the method' do
12
+ [:events,:past_events].each do |method_name|
13
+ it "'#{method_name}'" do
14
+ @venue.should respond_to(method_name)
15
+ end
16
+ end
17
+
18
+ it 'search' do
19
+ Scrobbler::Venue.should respond_to(:search)
20
+ end
21
+ end
22
+
23
+ describe 'a Venue built from XML should have' do
24
+ it 'an ID' do
25
+ @venue.id.should eql(9027137)
26
+ end
27
+
28
+ it 'a name' do
29
+ @venue.name.should eql('Karrera Klub')
30
+ end
31
+
32
+ it 'a city' do
33
+ @venue.city.should eql('Berlin')
34
+ end
35
+
36
+ it 'a country' do
37
+ @venue.country.should eql('Germany')
38
+ end
39
+
40
+ it 'a street' do
41
+ @venue.street.should eql('Neue Promenade 10')
42
+ end
43
+
44
+ it 'a postalcode' do
45
+ @venue.postalcode.should eql('10178')
46
+ end
47
+
48
+ it 'a geo_lat' do
49
+ @venue.geo_lat.should eql('52.532019')
50
+ end
51
+
52
+ it 'a geo_long' do
53
+ @venue.geo_long.should eql('13.427965')
54
+ end
55
+
56
+ it 'a timezone' do
57
+ @venue.timezone.should eql('CET')
58
+ end
59
+
60
+ it 'a URL' do
61
+ @venue.url.should eql('http://www.last.fm/venue/9027137')
62
+ end
63
+ end
64
+
65
+ describe 'finding events for Postbahnhof, Berlin' do
66
+ before do
67
+ @events = @venue.events
68
+ end
69
+
70
+ it 'should find 4 events' do
71
+ @events.size.should eql(4)
72
+ end
73
+
74
+ it "should have the correct event id's" do
75
+ @events.collect(&:id).should eql(@event_ids)
76
+ end
77
+
78
+ it 'should have the correct event titles' do
79
+ @events.collect(&:title).should eql(@event_titles)
80
+ end
81
+ end
82
+
83
+ describe 'finding past events for Postbahnhof, Berlin' do
84
+ before do
85
+ @events = @venue.past_events
86
+ end
87
+
88
+ it 'should find 4 events' do
89
+ @events.size.should eql(4)
90
+ end
91
+
92
+ it "should have the correct event id's" do
93
+ @events.collect(&:id).should eql(@event_ids)
94
+ end
95
+
96
+ it 'should have the correct event titles' do
97
+ @events.collect(&:title).should eql(@event_titles)
98
+ end
99
+ end
100
+
101
+ describe 'searching for venues' do
102
+ #TODO
103
+ end
104
+ end
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hornairs-scrobbler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - John Nunemaker
8
+ - Jonathan Rudenberg
9
+ - Uwe L. Korn
10
+ - Harry Brundage
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2010-01-24 00:00:00 -05:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: activesupport
20
+ type: :runtime
21
+ version_requirement:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.2
27
+ version:
28
+ - !ruby/object:Gem::Dependency
29
+ name: libxml-ruby
30
+ type: :runtime
31
+ version_requirement:
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: "0"
37
+ version:
38
+ description: A ruby library for accessing the last.fm v2 webservices
39
+ email: harry@skylightlabs.ca
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - README.rdoc
46
+ files:
47
+ - .gitignore
48
+ - .loadpath
49
+ - .project
50
+ - .settings/com.aptana.rdt.prefs
51
+ - .settings/org.radrails.rails.core.prefs
52
+ - .settings/org.rubypeople.rdt.core.prefs
53
+ - History.txt
54
+ - MIT-LICENSE
55
+ - Manifest
56
+ - README.rdoc
57
+ - Rakefile
58
+ - VERSION.yml
59
+ - examples/album.rb
60
+ - examples/artist.rb
61
+ - examples/playlist.rb
62
+ - examples/scrobble.rb
63
+ - examples/tag.rb
64
+ - examples/track.rb
65
+ - examples/user.rb
66
+ - lib/scrobbler.rb
67
+ - lib/scrobbler/album.rb
68
+ - lib/scrobbler/artist.rb
69
+ - lib/scrobbler/auth.rb
70
+ - lib/scrobbler/base.rb
71
+ - lib/scrobbler/event.rb
72
+ - lib/scrobbler/geo.rb
73
+ - lib/scrobbler/helper/image.rb
74
+ - lib/scrobbler/helper/streamable.rb
75
+ - lib/scrobbler/library.rb
76
+ - lib/scrobbler/playing.rb
77
+ - lib/scrobbler/playlist.rb
78
+ - lib/scrobbler/radio.rb
79
+ - lib/scrobbler/rest.rb
80
+ - lib/scrobbler/scrobble.rb
81
+ - lib/scrobbler/session.rb
82
+ - lib/scrobbler/shout.rb
83
+ - lib/scrobbler/simpleauth.rb
84
+ - lib/scrobbler/tag.rb
85
+ - lib/scrobbler/track.rb
86
+ - lib/scrobbler/user.rb
87
+ - lib/scrobbler/venue.rb
88
+ - setup.rb
89
+ - tasks/jeweler.rake
90
+ - tasks/rdoc.rake
91
+ - tasks/tests.rake
92
+ - tasks/yardoc.rake
93
+ - test/fixtures/xml/album/info.xml
94
+ - test/fixtures/xml/artist/fans.xml
95
+ - test/fixtures/xml/artist/info.xml
96
+ - test/fixtures/xml/artist/similar.xml
97
+ - test/fixtures/xml/artist/topalbums.xml
98
+ - test/fixtures/xml/artist/toptags.xml
99
+ - test/fixtures/xml/artist/toptracks.xml
100
+ - test/fixtures/xml/auth/session.xml
101
+ - test/fixtures/xml/auth/token.xml
102
+ - test/fixtures/xml/event/attend.xml
103
+ - test/fixtures/xml/event/attendees.xml
104
+ - test/fixtures/xml/event/event.xml
105
+ - test/fixtures/xml/event/shouts.xml
106
+ - test/fixtures/xml/geo/events-distance-p1.xml
107
+ - test/fixtures/xml/geo/events-lat-long.xml
108
+ - test/fixtures/xml/geo/events-p1.xml
109
+ - test/fixtures/xml/geo/events-p2.xml
110
+ - test/fixtures/xml/geo/events-p3.xml
111
+ - test/fixtures/xml/geo/top_artists-p1.xml
112
+ - test/fixtures/xml/geo/top_tracks-p1.xml
113
+ - test/fixtures/xml/library/albums-f30.xml
114
+ - test/fixtures/xml/library/albums-p1.xml
115
+ - test/fixtures/xml/library/albums-p2.xml
116
+ - test/fixtures/xml/library/albums-p3.xml
117
+ - test/fixtures/xml/library/albums-p4.xml
118
+ - test/fixtures/xml/library/albums-p5.xml
119
+ - test/fixtures/xml/library/albums-p6.xml
120
+ - test/fixtures/xml/library/albums-p7.xml
121
+ - test/fixtures/xml/library/albums-p8.xml
122
+ - test/fixtures/xml/library/artists-f30.xml
123
+ - test/fixtures/xml/library/artists-p1.xml
124
+ - test/fixtures/xml/library/artists-p2.xml
125
+ - test/fixtures/xml/library/artists-p3.xml
126
+ - test/fixtures/xml/library/artists-p4.xml
127
+ - test/fixtures/xml/library/artists-p5.xml
128
+ - test/fixtures/xml/library/artists-p6.xml
129
+ - test/fixtures/xml/library/artists-p7.xml
130
+ - test/fixtures/xml/library/tracks-f30.xml
131
+ - test/fixtures/xml/library/tracks-p1.xml
132
+ - test/fixtures/xml/library/tracks-p10.xml
133
+ - test/fixtures/xml/library/tracks-p11.xml
134
+ - test/fixtures/xml/library/tracks-p12.xml
135
+ - test/fixtures/xml/library/tracks-p13.xml
136
+ - test/fixtures/xml/library/tracks-p14.xml
137
+ - test/fixtures/xml/library/tracks-p15.xml
138
+ - test/fixtures/xml/library/tracks-p16.xml
139
+ - test/fixtures/xml/library/tracks-p17.xml
140
+ - test/fixtures/xml/library/tracks-p18.xml
141
+ - test/fixtures/xml/library/tracks-p19.xml
142
+ - test/fixtures/xml/library/tracks-p2.xml
143
+ - test/fixtures/xml/library/tracks-p20.xml
144
+ - test/fixtures/xml/library/tracks-p21.xml
145
+ - test/fixtures/xml/library/tracks-p22.xml
146
+ - test/fixtures/xml/library/tracks-p23.xml
147
+ - test/fixtures/xml/library/tracks-p24.xml
148
+ - test/fixtures/xml/library/tracks-p25.xml
149
+ - test/fixtures/xml/library/tracks-p26.xml
150
+ - test/fixtures/xml/library/tracks-p27.xml
151
+ - test/fixtures/xml/library/tracks-p28.xml
152
+ - test/fixtures/xml/library/tracks-p29.xml
153
+ - test/fixtures/xml/library/tracks-p3.xml
154
+ - test/fixtures/xml/library/tracks-p30.xml
155
+ - test/fixtures/xml/library/tracks-p31.xml
156
+ - test/fixtures/xml/library/tracks-p32.xml
157
+ - test/fixtures/xml/library/tracks-p33.xml
158
+ - test/fixtures/xml/library/tracks-p34.xml
159
+ - test/fixtures/xml/library/tracks-p4.xml
160
+ - test/fixtures/xml/library/tracks-p5.xml
161
+ - test/fixtures/xml/library/tracks-p6.xml
162
+ - test/fixtures/xml/library/tracks-p7.xml
163
+ - test/fixtures/xml/library/tracks-p8.xml
164
+ - test/fixtures/xml/library/tracks-p9.xml
165
+ - test/fixtures/xml/tag/similar.xml
166
+ - test/fixtures/xml/tag/topalbums.xml
167
+ - test/fixtures/xml/tag/topartists.xml
168
+ - test/fixtures/xml/tag/toptags.xml
169
+ - test/fixtures/xml/tag/toptracks.xml
170
+ - test/fixtures/xml/track/fans.xml
171
+ - test/fixtures/xml/track/info.xml
172
+ - test/fixtures/xml/track/toptags.xml
173
+ - test/fixtures/xml/user/events.xml
174
+ - test/fixtures/xml/user/friends.xml
175
+ - test/fixtures/xml/user/lovedtracks.xml
176
+ - test/fixtures/xml/user/neighbours.xml
177
+ - test/fixtures/xml/user/playlists.xml
178
+ - test/fixtures/xml/user/profile.xml
179
+ - test/fixtures/xml/user/recentbannedtracks.xml
180
+ - test/fixtures/xml/user/recentlovedtracks.xml
181
+ - test/fixtures/xml/user/recenttracks.xml
182
+ - test/fixtures/xml/user/systemrecs.xml
183
+ - test/fixtures/xml/user/topalbums.xml
184
+ - test/fixtures/xml/user/topartists.xml
185
+ - test/fixtures/xml/user/toptags.xml
186
+ - test/fixtures/xml/user/toptracks.xml
187
+ - test/fixtures/xml/user/weeklyalbumchart.xml
188
+ - test/fixtures/xml/user/weeklyartistchart.xml
189
+ - test/fixtures/xml/user/weeklytrackchart.xml
190
+ - test/fixtures/xml/venue/events.xml
191
+ - test/fixtures/xml/venue/venue.xml
192
+ - test/mocks/rest.rb
193
+ - test/spec_helper.rb
194
+ - test/test_helper.rb
195
+ - test/unit/album_spec.rb
196
+ - test/unit/artist_spec.rb
197
+ - test/unit/auth_spec.rb
198
+ - test/unit/event_spec.rb
199
+ - test/unit/geo_spec.rb
200
+ - test/unit/library_spec.rb
201
+ - test/unit/playing_test.rb
202
+ - test/unit/playlist_spec.rb
203
+ - test/unit/radio_spec.rb
204
+ - test/unit/scrobble_spec.rb
205
+ - test/unit/scrobble_test.rb
206
+ - test/unit/simpleauth_test.rb
207
+ - test/unit/tag_spec.rb
208
+ - test/unit/track_spec.rb
209
+ - test/unit/user_spec.rb
210
+ - test/unit/venue_spec.rb
211
+ has_rdoc: true
212
+ homepage: http://github.com/hornairs/scrobbler
213
+ licenses: []
214
+
215
+ post_install_message:
216
+ rdoc_options:
217
+ - --charset=UTF-8
218
+ require_paths:
219
+ - lib
220
+ required_ruby_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: "0"
225
+ version:
226
+ required_rubygems_version: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: "0"
231
+ version:
232
+ requirements: []
233
+
234
+ rubyforge_project:
235
+ rubygems_version: 1.3.5
236
+ signing_key:
237
+ specification_version: 3
238
+ summary: A ruby library for accessing the last.fm v2 webservices
239
+ test_files:
240
+ - test/mocks/rest.rb
241
+ - test/spec_helper.rb
242
+ - test/test_helper.rb
243
+ - test/unit/album_spec.rb
244
+ - test/unit/artist_spec.rb
245
+ - test/unit/auth_spec.rb
246
+ - test/unit/event_spec.rb
247
+ - test/unit/geo_spec.rb
248
+ - test/unit/library_spec.rb
249
+ - test/unit/playing_test.rb
250
+ - test/unit/playlist_spec.rb
251
+ - test/unit/radio_spec.rb
252
+ - test/unit/scrobble_spec.rb
253
+ - test/unit/scrobble_test.rb
254
+ - test/unit/simpleauth_test.rb
255
+ - test/unit/tag_spec.rb
256
+ - test/unit/track_spec.rb
257
+ - test/unit/user_spec.rb
258
+ - test/unit/venue_spec.rb
259
+ - examples/album.rb
260
+ - examples/artist.rb
261
+ - examples/playlist.rb
262
+ - examples/scrobble.rb
263
+ - examples/tag.rb
264
+ - examples/track.rb
265
+ - examples/user.rb