rscrobbler 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/lib/lastfm/album.rb +50 -112
  2. data/lib/lastfm/api/album.rb +140 -0
  3. data/lib/lastfm/api/artist.rb +243 -0
  4. data/lib/lastfm/api/auth.rb +35 -0
  5. data/lib/lastfm/api/chart.rb +63 -0
  6. data/lib/lastfm/api/event.rb +71 -0
  7. data/lib/lastfm/api/geo.rb +125 -0
  8. data/lib/lastfm/api/group.rb +69 -0
  9. data/lib/lastfm/api/library.rb +117 -0
  10. data/lib/lastfm/api/playlist.rb +40 -0
  11. data/lib/lastfm/api/radio.rb +41 -0
  12. data/lib/lastfm/api/tag.rb +120 -0
  13. data/lib/lastfm/api/tasteometer.rb +37 -0
  14. data/lib/lastfm/api/track.rb +272 -0
  15. data/lib/lastfm/api/user.rb +266 -0
  16. data/lib/lastfm/api/venue.rb +40 -0
  17. data/lib/lastfm/artist.rb +42 -204
  18. data/lib/lastfm/buylink.rb +34 -0
  19. data/lib/lastfm/event.rb +57 -66
  20. data/lib/lastfm/shout.rb +20 -0
  21. data/lib/lastfm/struct.rb +34 -0
  22. data/lib/lastfm/tag.rb +24 -89
  23. data/lib/lastfm/track.rb +51 -242
  24. data/lib/lastfm/venue.rb +21 -36
  25. data/lib/lastfm/wiki.rb +20 -0
  26. data/lib/rscrobbler.rb +24 -11
  27. data/test/test_album.rb +36 -0
  28. metadata +25 -45
  29. data/lib/lastfm/auth.rb +0 -35
  30. data/lib/lastfm/chart.rb +0 -63
  31. data/lib/lastfm/geo.rb +0 -125
  32. data/lib/lastfm/group.rb +0 -69
  33. data/lib/lastfm/library.rb +0 -117
  34. data/lib/lastfm/playlist.rb +0 -40
  35. data/lib/lastfm/radio.rb +0 -41
  36. data/lib/lastfm/tasteometer.rb +0 -37
  37. data/lib/lastfm/user.rb +0 -266
  38. data/test/unit/lib/lastfm/album_test.rb +0 -0
  39. data/test/unit/lib/lastfm/artist_test.rb +0 -0
  40. data/test/unit/lib/lastfm/auth_test.rb +0 -0
  41. data/test/unit/lib/lastfm/chart_test.rb +0 -0
  42. data/test/unit/lib/lastfm/event_test.rb +0 -0
  43. data/test/unit/lib/lastfm/geo_test.rb +0 -0
  44. data/test/unit/lib/lastfm/group_test.rb +0 -0
  45. data/test/unit/lib/lastfm/library_test.rb +0 -0
  46. data/test/unit/lib/lastfm/playlist_test.rb +0 -0
  47. data/test/unit/lib/lastfm/radio_test.rb +0 -0
  48. data/test/unit/lib/lastfm/tag_test.rb +0 -0
  49. data/test/unit/lib/lastfm/tasteometer_test.rb +0 -0
  50. data/test/unit/lib/lastfm/track_test.rb +0 -0
  51. data/test/unit/lib/lastfm/user_test.rb +0 -0
  52. data/test/unit/lib/lastfm/venue_test.rb +0 -0
  53. data/test/unit/lib/rscrobbler_test.rb +0 -0
data/lib/lastfm/user.rb DELETED
@@ -1,266 +0,0 @@
1
- module LastFM
2
- class User
3
- class << self
4
-
5
- TYPE = 'user'
6
-
7
- # Get a list of tracks by a given artist scrobbled by this user,
8
- # including scrobble time. Can be limited to specific timeranges,
9
- # defaults to all time.
10
- #
11
- # @option params [String, required] :user last.fm username to fetch the recent tracks for
12
- # @option params [String, required] :artist the artist name to fetch tracks for
13
- # @option params [Time, optional] :startTimestamp a unix timestamp to start at
14
- # @option params [Time, optional] :endTimestamp a unix timestamp to end at
15
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
16
- # @see http://www.last.fm/api/show?service=432
17
- def get_artist_tracks( params )
18
- LastFM.get( "#{TYPE}.getArtistTracks", params )
19
- end
20
-
21
- # Get a list of tracks banned by a user.
22
- #
23
- # @option params [String, required] :user last.fm username
24
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
25
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
26
- # @see http://www.last.fm/api/show?service=448
27
- def get_banned_tracks( params )
28
- LastFM.get( "#{TYPE}.getBannedTracks", params )
29
- end
30
-
31
- # Get a list of upcoming events that this user is attending.
32
- #
33
- # @option params [String, required] :user last.fm username
34
- # @option params [Boolean, optional] :festivalsonly whether only festivals should be returned, or all events
35
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
36
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
37
- # @see http://www.last.fm/api/show?service=291
38
- def get_events( params )
39
- LastFM.get( "#{TYPE}.getEvents", params )
40
- end
41
-
42
- # Get a list of the user's friends on Last.fm.
43
- #
44
- # @option params [String, required] :user last.fm username
45
- # @option params [Boolean, optional] :recenttracks whether or not to include information about friends' recent listening in the response.
46
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
47
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
48
- # @see http://www.last.fm/api/show?service=263
49
- def get_friends( params )
50
- LastFM.get( "#{TYPE}.getFriends", params )
51
- end
52
-
53
- # Get information about a user profile.
54
- #
55
- # @option params [String, optional] :user user to fetch info for. defaults to the authenticated user
56
- # @see http://www.last.fm/api/show?service=344
57
- def get_info( params )
58
- LastFM.get( "#{TYPE}.getInfo", params )
59
- end
60
-
61
- # Get a list of tracks loved by a user.
62
- #
63
- # @option params [String, required] :user last.fm username
64
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
65
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
66
- # @see http://www.last.fm/api/show?service=329
67
- def get_loved_tracks( params )
68
- LastFM.get( "#{TYPE}.getLovedTracks", params )
69
- end
70
-
71
- # Get a list of a user's neighbours on Last.fm.
72
- #
73
- # @option params [String, required] :user last.fm username
74
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
75
- # @see http://www.last.fm/api/show?service=264
76
- def get_neighbors( params )
77
- LastFM.get( "#{TYPE}.getNeighbonrs", params )
78
- end
79
-
80
- # Gets a list of upcoming releases based on a user's musical taste.
81
- #
82
- # @option params [String, required] :user last.fm username
83
- # @option params [Boolean, optional] :userecs if true, return new releases based on artist recommendations. otherwise, it is based on their library (the default)
84
- # @see http://www.last.fm/api/show?service=444
85
- def get_new_releases( params )
86
- LastFM.get( "#{TYPE}.getNewReleases", params )
87
- end
88
-
89
- # Get a list of all events a user has attended in the past.
90
- #
91
- # @option params [String, required] :user last.fm username
92
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
93
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
94
- # @see http://www.last.fm/api/show?service=343
95
- def get_past_events( params )
96
- LastFM.get( "#{TYPE}.getPastEvents", params )
97
- end
98
-
99
- # Get the user's personal tags.
100
- #
101
- # @option params [String, required] :user last.fm username
102
- # @option params [String, required] :tag the tag you're interested in
103
- # @option params [String, required] :taggingtype the type of items which have been tagged. accepted types are 'artist', 'album', or 'track'
104
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
105
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
106
- # @see http://www.last.fm/api/show?service=455
107
- def get_personal_tags( params )
108
- LastFM.get( "#{TYPE}.getPersonalTags", params )
109
- end
110
-
111
- # Get a list of a user's playlists.
112
- #
113
- # @option params [String, required] :user last.fm username
114
- # @see http://www.last.fm/api/show?service=313
115
- def get_playlists( params )
116
- LastFM.get( "#{TYPE}.getPlaylists", params )
117
- end
118
-
119
- # Get a list of the recent Stations listened to by a user.
120
- #
121
- # @option params [String, required] :user last.fm username
122
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
123
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
124
- # @see http://www.last.fm/api/show?service=414
125
- def get_recent_stations( params )
126
- LastFM.requires_authentication
127
- LastFM.get( "#{TYPE}.getRecentStations", params, :secure )
128
- end
129
-
130
- # Get a list of the recent tracks listened to by a user. Also includes
131
- # the currently playing track with the nowplaying="true" attribute if
132
- # the user is currently listening.
133
- #
134
- # @option params [String, required] :user last.fm username
135
- # @option params [Time, optional] :from display scrobbles after this time, formatted as unix UTC integer timestamp
136
- # @option params [Time, optional] :to display scrobbles before this time, formatted as unix UTC integer timestamp
137
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
138
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
139
- # @see http://www.last.fm/api/show?service=278
140
- def get_recent_tracks( params )
141
- LastFM.get( "#{TYPE}.getRecentTracks", params )
142
- end
143
-
144
- # Get Last.fm artist recommendations for a user.
145
- #
146
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
147
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
148
- # @see http://www.last.fm/api/show?service=388
149
- def get_recommended_artists( params )
150
- LastFM.requires_authentication
151
- LastFM.get( "#{TYPE}.getRecommendedArtists", params, :secure )
152
- end
153
-
154
- # Get a paginated list of all events recommended to a user by Last.fm, based on their listening profile.
155
- #
156
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
157
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
158
- # @see http://www.last.fm/api/show?service=375
159
- def get_recommended_events( params )
160
- LastFM.requires_authentication
161
- LastFM.get( "#{TYPE}.getRecommendedEvents", params, :secure )
162
- end
163
-
164
- # Get shouts for a user.
165
- #
166
- # @option params [String, required] :user last.fm username
167
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
168
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
169
- # @see http://www.last.fm/api/show?service=401
170
- def get_shouts( params )
171
- LastFM.get( "#{TYPE}.getShouts", params, :secure )
172
- end
173
-
174
- # Get the top albums listened to by a user, based on an optional time period.
175
- #
176
- # @option params [String, required] :user last.fm username
177
- # @option params [String, optional] :period time period over which to retrieve top albums for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
178
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
179
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
180
- # @see http://www.last.fm/api/show?service=299
181
- def get_top_albums( params )
182
- LastFM.get( "#{TYPE}.getTopAlbums", params )
183
- end
184
-
185
- # Get the top artists listened to by a user, based on an optional time period.
186
- #
187
- # @option params [String, required] :user last.fm username
188
- # @option params [String, optional] :period time period over which to retrieve top artists for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
189
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
190
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
191
- # @see http://www.last.fm/api/show?service=300
192
- def get_top_artists( params )
193
- LastFM.get( "#{TYPE}.getTopArtists", params )
194
- end
195
-
196
- # Get the top tags used by a user.
197
- #
198
- # @option params [String, required] :user last.fm username
199
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
200
- # @see http://www.last.fm/api/show?service=123
201
- def get_top_tags( params )
202
- LastFM.get( "#{TYPE}.getTopTags", params )
203
- end
204
-
205
- # Get the top tracks listened to by a user, based on an optional time period.
206
- #
207
- # @option params [String, required] :user last.fm username
208
- # @option params [String, optional] :period time period over which to retrieve top tracks for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
209
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
210
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
211
- # @see http://www.last.fm/api/show?service=301
212
- def get_top_tracks( params )
213
- LastFM.get( "#{TYPE}.getTopTracks", params )
214
- end
215
-
216
- # Get an album chart for a user, for a given date range. Defaults to the most recent chart.
217
- #
218
- # @option params [String, required] :user last.fm username
219
- # @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
220
- # @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
221
- # @see http://www.last.fm/api/show?service=279
222
- def get_weekly_album_chart( params )
223
- LastFM.get( "#{TYPE}.getWeeklyAlbumChart", params )
224
- end
225
-
226
- # Get an artist chart for a user, for a given date range. Defaults to the most recent chart.
227
- #
228
- # @option params [String, required] :user last.fm username
229
- # @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
230
- # @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
231
- # @see http://www.last.fm/api/show?service=281
232
- def get_weekly_artist_chart( params )
233
- LastFM.get( "#{TYPE}.getWeeklyArtistChart", params )
234
- end
235
-
236
- # Get a list of available charts for this user, expressed as date ranges which can be sent to the chart services.
237
- #
238
- # @option params [String, required] :user last.fm username
239
- # @see http://www.last.fm/api/show?service=280
240
- def get_weekly_chart_list( params )
241
- LastFM.get( "#{TYPE}.getWeeklyChartList", params )
242
- end
243
-
244
- # Get a track chart for a user, for a given date range. Defaults to the most recent chart.
245
- #
246
- # @option params [String, required] :user last.fm username
247
- # @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
248
- # @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
249
- # @see http://www.last.fm/api/show?service=282
250
- def get_weekly_track_chart( params )
251
- LastFM.get( "#{TYPE}.getWeeklyTrackChart", params )
252
- end
253
-
254
- # Shout on a user's shoutbox.
255
- #
256
- # @option params [String, required] :user user to shout on
257
- # @option params [String, required] :message message to post to the shoutbox
258
- # @see http://www.last.fm/api/show?service=411
259
- def shout( params )
260
- LastFM.requires_authentication
261
- LastFM.post( "#{TYPE}.shout", params )
262
- end
263
-
264
- end
265
- end
266
- end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes