rscrobbler 0.1.0 → 0.2.0

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 (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/chart.rb DELETED
@@ -1,63 +0,0 @@
1
- module LastFM
2
- class Chart
3
- class << self
4
-
5
- TYPE = 'chart'
6
-
7
- # Get the hyped artists chart
8
- #
9
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
10
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
11
- # @see http://www.last.fm/api/show?service=493
12
- def get_hyped_artists( params )
13
- LastFM.get( "#{TYPE}.getHypedArtists", params )
14
- end
15
-
16
- # Get the hyped tracks chart
17
- #
18
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
19
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
20
- # @see http://www.last.fm/api/show?service=494
21
- def get_hyped_tracks( params )
22
- LastFM.get( "#{TYPE}.getHypedTracks", params )
23
- end
24
-
25
- # Get the most loved tracks chart
26
- #
27
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
28
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
29
- # @see http://www.last.fm/api/show?service=495
30
- def get_loved_tracks( params )
31
- LastFM.get( "#{TYPE}.getLovedTracks", params )
32
- end
33
-
34
- # Get the top artists chart
35
- #
36
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
37
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
38
- # @see http://www.last.fm/api/show?service=496
39
- def get_top_artists( params )
40
- LastFM.get( "#{TYPE}.getTopArtists", params )
41
- end
42
-
43
- # Get the top tags chart
44
- #
45
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
46
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
47
- # @see http://www.last.fm/api/show?service=497
48
- def get_top_tags( params )
49
- LastFM.get( "#{TYPE}.getTopTags", params )
50
- end
51
-
52
- # Get the top tracks chart
53
- #
54
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
55
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
56
- # @see http://www.last.fm/api/show?service=498
57
- def get_top_tracks( params )
58
- LastFM.get( "#{TYPE}.getTopTracks", params )
59
- end
60
-
61
- end
62
- end
63
- end
data/lib/lastfm/geo.rb DELETED
@@ -1,125 +0,0 @@
1
- module LastFM
2
- class Geo
3
- class << self
4
-
5
- TYPE = 'geo'
6
-
7
- # Get all events in a specific location by country or city name.
8
- #
9
- # @option params [String, optional] :location location to retrieve events for
10
- # @option params [String, optional] :lat latitude value to retrieve events for
11
- # @option params [String, optional] :long longitude value to retrieve events for
12
- # @option params [Fixnum, optional] :distance find events within a specified radius (in kilometres)
13
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
14
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
15
- # @see http://www.last.fm/api/show?service=270
16
- def get_events( params )
17
- LastFM.get( "#{TYPE}.getEvents", !:secure, params )
18
- end
19
-
20
- # Get a chart of artists for a metro.
21
- #
22
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
23
- # @option params [String, required] :metro the metro's name
24
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
25
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
26
- # @see http://www.last.fm/api/show?service=421
27
- def get_metro_artist_chart( params )
28
- LastFM.get( "#{TYPE}.getMetroArtistChart", params )
29
- end
30
-
31
- # Get a chart of hyped (up and coming) artists for a metro.
32
- #
33
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
34
- # @option params [String, required] :metro the metro's name
35
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
36
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
37
- # @see http://www.last.fm/api/show?service=420
38
- def get_metro_hype_artist_chart( params )
39
- LastFM.get( "#{TYPE}.getMetroHypeArtistChart", params )
40
- end
41
-
42
- # Get a chart of hyped (up and coming) tracks for a metro.
43
- #
44
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
45
- # @option params [String, required] :metro the metro's name
46
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
47
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
48
- # @see http://www.last.fm/api/show?service=422
49
- def get_metro_hype_track_chart( params )
50
- LastFM.get( "#{TYPE}.getMetroHypeTrackChart", params )
51
- end
52
-
53
- # Get a chart of tracks for a metro.
54
- #
55
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
56
- # @option params [String, required] :metro the metro's name
57
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
58
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
59
- # @see http://www.last.fm/api/show?service=423
60
- def get_metro_track_chart( params )
61
- LastFM.get( "#{TYPE}.getMetroTrackChart", params )
62
- end
63
-
64
- # Get a chart of the artists which make that metro unique
65
- #
66
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
67
- # @option params [String, required] :metro the metro's name
68
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
69
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
70
- # @see http://www.last.fm/api/show?service=424
71
- def get_metro_unique_artist_chart( params )
72
- LastFM.get( "#{TYPE}.getMetroUniqueArtistChart", params )
73
- end
74
-
75
- # Get a chart of the tracks which make that metro unique
76
- #
77
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
78
- # @option params [String, required] :metro the metro's name
79
- # @option params [Time, optional] :start beginning timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
80
- # @option params [Time, optional] :end ending timestamp of the weekly range requested (see: Geo.get_weekly_chart_list)
81
- # @see http://www.last.fm/api/show?service=425
82
- def get_metro_unique_track_chart( params )
83
- LastFM.get( "#{TYPE}.getMetroUniqueTrackChart", params )
84
- end
85
-
86
- # Get a list of available chart periods for this metro, expressed as date ranges which can be sent to the chart services.
87
- #
88
- # @option params [String, required] :metro metro name to fetch the charts list for
89
- # @see http://www.last.fm/api/show?service=426
90
- def get_metro_weekly_chartlist( params )
91
- LastFM.get( "#{TYPE}.getMetroWeeklyChartlist", params )
92
- end
93
-
94
- # Get a list of valid countries and metros for use in the other webservices
95
- #
96
- # @option params [String, optional] :country restrict results to metros from a particular country, as defined by ISO 3166-1
97
- # @see http://www.last.fm/api/show?service=435
98
- def get_metros( params )
99
- LastFM.get( "#{TYPE}.getMetros", params )
100
- end
101
-
102
- # Get the most popular artists on Last.fm by country
103
- #
104
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
105
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
106
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
107
- # @see http://www.last.fm/api/show?service=297
108
- def get_top_artists( params )
109
- LastFM.get( "#{TYPE}.getTopArtists", params )
110
- end
111
-
112
- # Get the most popular tracks on Last.fm by country
113
- #
114
- # @option params [String, required] :country a country name, as defined by ISO 3166-1
115
- # @option params [String, optional] :location location to fetch the charts for
116
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
117
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
118
- # @see http://www.last.fm/api/show?service=298
119
- def get_top_tracks( params )
120
- LastFM.get( "#{TYPE}.getTopTracks", params )
121
- end
122
-
123
- end
124
- end
125
- end
data/lib/lastfm/group.rb DELETED
@@ -1,69 +0,0 @@
1
- module LastFM
2
- class Group
3
- class << self
4
-
5
- TYPE = 'group'
6
-
7
- # Get the hype list for a group.
8
- #
9
- # @option params [String, required] :group the last.fm group name
10
- # @see http://www.last.fm/api/show?service=259
11
- def get_hype( params )
12
- LastFM.get( "#{TYPE}.getHype", params )
13
- end
14
-
15
- # Get the list of members for a group.
16
- #
17
- # @option params [String, required] :group the last.fm group name
18
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
19
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
20
- # @see http://www.last.fm/api/show/?service=379
21
- def get_members( params )
22
- LastFM.get( "#{TYPE}.getMembers", params )
23
- end
24
-
25
- # Get an album chart for a group, for a given date range. If no date range
26
- # is supplied, return the most recent.
27
- #
28
- # @option params [String, required] :group the last.fm group name
29
- # @option params [Time, optional] :from date at which the chart should start from (see: Group.get_weekly_chart_list)
30
- # @option params [Time, optional] :to date at which the chart should end on (see: Group.get_weekly_chart_list)
31
- # @see http://www.last.fm/api/show/?service=293
32
- def get_weekly_album_chart( params )
33
- LastFM.get( "#{TYPE}.getWeeklyAlbumChart", params )
34
- end
35
-
36
- # Get an artist chart for a group, for a given date range. If no date range
37
- # is supplied, return the most recent.
38
- #
39
- # @option params [String, required] :group the last.fm group name
40
- # @option params [Time, optional] :from date at which the chart should start from (see: Group.get_weekly_chart_list)
41
- # @option params [Time, optional] :to date at which the chart should end on (see: Group.get_weekly_chart_list)
42
- # @see http://www.last.fm/api/show/?service=294
43
- def get_weekly_artist_chart( params )
44
- LastFM.get( "#{TYPE}.getWeeklyArtistChart", params )
45
- end
46
-
47
- # Get the list of available charts for a group, expressed as date ranges
48
- # which can be sent to the chart services.
49
- #
50
- # @option params [String, required] :group the last.fm group name
51
- # @see http://www.last.fm/api/show/?service=295
52
- def get_weekly_chart_list( params )
53
- LastFM.get( "#{TYPE}.getWeeklyChartList", params )
54
- end
55
-
56
- # Get a track chart for a group, for a given date range. If no date range
57
- # is supplied, return the most recent.
58
- #
59
- # @option params [String, required] :group the last.fm group name
60
- # @option params [Time, optional] :from date at which the chart should start from (see: Group.get_weekly_chart_list)
61
- # @option params [Time, optional] :to date at which the chart should end on (see: Group.get_weekly_chart_list)
62
- # @see http://www.last.fm/api/show/?service=296
63
- def get_weekly_track_chart( params )
64
- LastFM.get( "#{TYPE}.getWeeklyTrackChart", params )
65
- end
66
-
67
- end
68
- end
69
- end
@@ -1,117 +0,0 @@
1
- module LastFM
2
- class Library
3
- class << self
4
-
5
- TYPE = 'library'
6
-
7
- # Add an album or collection of albums to a user's Last.fm library.
8
- #
9
- # @option params [Array, required] :artists the artist or collection of artists to add
10
- # @option params [Array, required] :albums the album or collection of albums to add. the indices of the albums that you pass MUST correspond to those of the artists
11
- # @see http://www.last.fm/api/show?service=370
12
- def add_album( params )
13
- LastFM.requires_authentication
14
- # convert :artists and :albums to individual artist[i] and album[i]
15
- Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val}
16
- Array(params.delete(:albums)).each_with_index{|val, i| params["album[#{i}]"] = val}
17
- LastFM.post( "#{TYPE}.addAlbum", params )
18
- end
19
-
20
- # Add an artist or collection of artists to a user's Last.fm library.
21
- #
22
- # @option params [Array, required] :artists the artist or collection of artists to add
23
- # @see http://www.last.fm/api/show?service=371
24
- def add_artist( params )
25
- LastFM.requires_authentication
26
- Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val}
27
- LastFM.post( "#{TYPE}.addArtist", params )
28
- end
29
-
30
- # Add a track or collection of tracks to a user's Last.fm library.
31
- #
32
- # @option params [Array, required] :artists the artist or collection of artists to add
33
- # @option params [Array, required] :tracks the track or collection of tracks to add. the indices of the tracks that you pass MUST correspond to those of the artists
34
- # @see http://www.last.fm/api/show?service=372
35
- def add_track( params )
36
- LastFM.requires_authentication
37
- Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val}
38
- Array(params.delete(:tracks)).each_with_index{|val, i| params["track[#{i}]"] = val}
39
- LastFM.post( "#{TYPE}.addTrack", params )
40
- end
41
-
42
- # A paginated list of all the albums in a user's library, with play counts and tag counts.
43
- #
44
- # @option params [String, requried] :user the user whose library you want to fetch
45
- # @option params [String, optional] :artist an artist by which to filter albums
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=321
49
- def get_albums( params )
50
- LastFM.get( "#{TYPE}.getAlbums", params )
51
- end
52
-
53
- # A paginated list of all the artists in a user's library, with play counts and tag counts.
54
- #
55
- # @option params [String, requried] :user the user whose library you want to fetch
56
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
57
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
58
- # @see http://www.last.fm/api/show?service=322
59
- def get_artists( params )
60
- LastFM.get( "#{TYPE}.getArtists", params )
61
- end
62
-
63
- # A paginated list of all the tracks in a user's library, with play counts and tag counts.
64
- #
65
- # @option params [String, requried] :user the user whose library you want to fetch
66
- # @option params [String, optional] :artist an artist by which to filter track
67
- # @option params [String, optional] :album an album by which to filter tracks (requires an associated artist)
68
- # @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
69
- # @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
70
- # @see http://www.last.fm/api/show?service=323
71
- def get_tracks( params )
72
- LastFM.get( "#{TYPE}.getTracks", params )
73
- end
74
-
75
- # Remove an album from a user's Last.fm library.
76
- #
77
- # @option params [String, required] :artist the artist that composed the album
78
- # @option params [String, required] :album the name of the album to remove
79
- # @see http://www.last.fm/api/show?service=523
80
- def remove_album( params )
81
- LastFM.requires_authentication
82
- LastFM.post( "#{TYPE}.removeAlbum", params )
83
- end
84
-
85
- # Remove an artist from a user's Last.fm library.
86
- #
87
- # @option params [String, required] :artist the name of the artist to remove
88
- # @see http://www.last.fm/api/show?service=524
89
- def remove_artist( params )
90
- LastFM.requires_authentication
91
- LastFM.post( "#{TYPE}.removeArtist", params )
92
- end
93
-
94
- # Remove a scrobble from a user's Last.fm library.
95
- #
96
- # @option params [String, required] :artist the artist that composed the album
97
- # @option params [String, required] :track the name of the track to remove
98
- # @option params [Time, required] :timestamp the unix timestamp of the scrobble to remove
99
- # @see http://www.last.fm/api/show?service=525
100
- def remove_scrobble( params )
101
- LastFM.requires_authentication
102
- LastFM.post( "#{TYPE}.removeScrobble", params )
103
- end
104
-
105
- # Remove a track from a user's Last.fm library.
106
- #
107
- # @option params [String, required] :artist the artist that composed the track
108
- # @option params [String, required] :track the name of the track to remove
109
- # @see http://www.last.fm/api/show?service=526
110
- def remove_track( params )
111
- LastFM.requires_authentication
112
- LastFM.post( "#{TYPE}.removeTrack", params )
113
- end
114
-
115
- end
116
- end
117
- end
@@ -1,40 +0,0 @@
1
- module LastFM
2
- class Playlist
3
- class << self
4
-
5
- TYPE = 'playlist'
6
-
7
- # Add a track to a Last.fm user's playlist
8
- #
9
- # @option params [String, required] :playlist_id the id of the playlist (see: User.get_playlists)
10
- # @option params [String, required] :track the track name to add to the playlist
11
- # @option params [String, required] :artist the artist that corresponds to the track to be added
12
- # @see http://www.last.fm/api/show?service=337
13
- def add_track( params )
14
- LastFM.requires_authentication
15
- LastFM.post( "#{TYPE}.addTrack", params )
16
- end
17
-
18
- # Create a Last.fm playlist on behalf of a user.
19
- #
20
- # @option params [String, optional] :title title for the playlist
21
- # @option params [String, optional] :description description for the playlist
22
- # @see http://www.last.fm/api/show?service=365
23
- def create( params )
24
- LastFM.requires_authentication
25
- LastFM.post( "#{TYPE}.create", params )
26
- end
27
-
28
- # Fetch XSPF playlists using a lastfm playlist url.
29
- #
30
- # @option params [String, required] :playlist_url lastfm protocol playlist url (lastfm://playlist/...)
31
- # @option params [Boolean, optional] :steaming whether to return mp3 links for song previews
32
- # @see http://www.last.fm/api/show?service=271
33
- # @deprecated documentation removed from last.fm/api, but method calls still work
34
- def fetch( params )
35
- LastFM.get( "#{TYPE}.fetch", params )
36
- end
37
-
38
- end
39
- end
40
- end
data/lib/lastfm/radio.rb DELETED
@@ -1,41 +0,0 @@
1
- module LastFM
2
- class Radio
3
- class << self
4
-
5
- TYPE = 'radio'
6
-
7
- # Fetch new radio content periodically in an XSPF format.
8
- #
9
- # @option params [Boolean, optional] :discovery whether to request last.fm content in discovery mode
10
- # @option params [Boolean, optional] :rtp whether the user is scrobbling or not during this session (helps content generation)
11
- # @option params [Boolean, optional] :buylinks whether the response should contain links for purchase/download
12
- # @option params [String, optional] :speed_multiplier the rate at which to provide the stream (supported multipliers are 1.0 and 2.0)
13
- # @option params [String, optional] :bitrate what bitrate to stream content at, in kbps (supported bitrates are 64 and 128)
14
- # @see http://www.last.fm/api/show?service=256
15
- def get_playlist( params )
16
- LastFM.requires_authentication
17
- LastFM.get( "#{TYPE}.getPlaylist", params, :secure )
18
- end
19
-
20
- # Resolve the name of a resource into a station depending
21
- # on which resource it is most likely to represent.
22
- #
23
- # @option params [String, required] :name the tag or artist name to resolve
24
- # @see http://www.last.fm/api/show?service=418
25
- def search( params )
26
- LastFM.get( "#{TYPE}.search", params )
27
- end
28
-
29
- # Tune in to a Last.fm radio station.
30
- #
31
- # @option params [String, required] :station a 'lastfm://...' radio url
32
- # @option params [String, optional] :lang the language to return the station name in, expressed as an ISO 639 alpha-2 code
33
- # @see http://www.last.fm/api/show?service=160
34
- def tune( params )
35
- LastFM.requires_authentication
36
- LastFM.post( "#{TYPE}.tune", params )
37
- end
38
-
39
- end
40
- end
41
- end
@@ -1,37 +0,0 @@
1
- module LastFM
2
- class Tasteometer
3
- class << self
4
-
5
- TYPE = 'tasteometer'
6
-
7
- # Get a Tasteometer score from two inputs, along with a list of shared
8
- # artists. If the input is a User some additional information is returned.
9
- #
10
- # @option params [Array, required] :types two types are required for comparison. accepted types are 'user' and 'artists'
11
- # @option params [Array, required] :values values for the corresponding types. accepted values are Last.fm usernames, or arrays of artist names (up to 100 artists)
12
- # @option params [Fixnum, optional] :limit how many shared artists to display. default is 5
13
- # @see http://www.last.fm/api/show?service=258
14
- def compare( params )
15
- Array(params.delete(:types)).each_with_index{|val, i| params["type[#{i}]"] = val}
16
- Array(params.delete(:values)).each_with_index{|val, i| params["value[#{i}]"] = val}
17
- LastFM.get( "#{TYPE}.compare", params )
18
- end
19
-
20
- # Get the scores between every user in a group of users, plus shared artists.
21
- # Cuts off any similarities below a cutoff. Also returns a list of all users
22
- # in the comparison and a small amount of metadata about each. Can take the
23
- # list of users from a group, or a users friends.
24
- #
25
- # @option params [String, required] :source what source we're using for the comparison. accepted sources are 'user' and 'group'
26
- # @option params [String, required] :value name of the source we're using. should be either a Last.fm username or group name
27
- # @option params [Float, optional] :cutoff the minimum level over which comparisons should be returned. default is 0.2
28
- # @option params [Fixnum, optional] :connection_limit the maximum number of connections each user should have. default is 6
29
- # @see http://www.last.fm/api/show?service=500
30
- # @deprecated This service has been deprecated and is no longer available
31
- def compare_group(params)
32
- LastFM.get( "#{TYPE}.compareGroup", params )
33
- end
34
-
35
- end
36
- end
37
- end