Class: LastFM::Api::Library
- Inherits:
-
Object
- Object
- LastFM::Api::Library
- Defined in:
- lib/lastfm/api/library.rb
Class Method Summary collapse
-
.add_album(params) ⇒ Object
Add an album or collection of albums to a user’s Last.fm library.
-
.add_artist(params) ⇒ Object
Add an artist or collection of artists to a user’s Last.fm library.
-
.add_track(params) ⇒ Object
Add a track or collection of tracks to a user’s Last.fm library.
-
.get_albums(params) ⇒ Object
A paginated list of all the albums in a user’s library, with play counts and tag counts.
-
.get_artists(params) ⇒ Object
A paginated list of all the artists in a user’s library, with play counts and tag counts.
-
.get_tracks(params) ⇒ Object
A paginated list of all the tracks in a user’s library, with play counts and tag counts.
-
.remove_album(params) ⇒ Object
Remove an album from a user’s Last.fm library.
-
.remove_artist(params) ⇒ Object
Remove an artist from a user’s Last.fm library.
-
.remove_scrobble(params) ⇒ Object
Remove a scrobble from a user’s Last.fm library.
-
.remove_track(params) ⇒ Object
Remove a track from a user’s Last.fm library.
Class Method Details
.add_album(params) ⇒ Object
Add an album or collection of albums to a user’s Last.fm library.
11 12 13 14 15 16 17 |
# File 'lib/lastfm/api/library.rb', line 11 def add_album( params ) LastFM.requires_authentication # convert :artists and :albums to individual artist[i] and album[i] Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} Array(params.delete(:albums)).each_with_index{|val, i| params["album[#{i}]"] = val} LastFM.post( "library.addAlbum", params ) end |
.add_artist(params) ⇒ Object
Add an artist or collection of artists to a user’s Last.fm library.
23 24 25 26 27 |
# File 'lib/lastfm/api/library.rb', line 23 def add_artist( params ) LastFM.requires_authentication Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} LastFM.post( "library.addArtist", params ) end |
.add_track(params) ⇒ Object
Add a track or collection of tracks to a user’s Last.fm library.
34 35 36 37 38 39 |
# File 'lib/lastfm/api/library.rb', line 34 def add_track( params ) LastFM.requires_authentication Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} Array(params.delete(:tracks)).each_with_index{|val, i| params["track[#{i}]"] = val} LastFM.post( "library.addTrack", params ) end |
.get_albums(params) ⇒ Object
A paginated list of all the albums in a user’s library, with play counts and tag counts.
48 49 50 |
# File 'lib/lastfm/api/library.rb', line 48 def get_albums( params ) LastFM.get( "library.getAlbums", params ) end |
.get_artists(params) ⇒ Object
A paginated list of all the artists in a user’s library, with play counts and tag counts.
58 59 60 |
# File 'lib/lastfm/api/library.rb', line 58 def get_artists( params ) LastFM.get( "library.getArtists", params ) end |
.get_tracks(params) ⇒ Object
A paginated list of all the tracks in a user’s library, with play counts and tag counts.
70 71 72 |
# File 'lib/lastfm/api/library.rb', line 70 def get_tracks( params ) LastFM.get( "library.getTracks", params ) end |
.remove_album(params) ⇒ Object
Remove an album from a user’s Last.fm library.
79 80 81 82 |
# File 'lib/lastfm/api/library.rb', line 79 def remove_album( params ) LastFM.requires_authentication LastFM.post( "library.removeAlbum", params ) end |
.remove_artist(params) ⇒ Object
Remove an artist from a user’s Last.fm library.
88 89 90 91 |
# File 'lib/lastfm/api/library.rb', line 88 def remove_artist( params ) LastFM.requires_authentication LastFM.post( "library.removeArtist", params ) end |
.remove_scrobble(params) ⇒ Object
Remove a scrobble from a user’s Last.fm library.
99 100 101 102 |
# File 'lib/lastfm/api/library.rb', line 99 def remove_scrobble( params ) LastFM.requires_authentication LastFM.post( "library.removeScrobble", params ) end |
.remove_track(params) ⇒ Object
Remove a track from a user’s Last.fm library.
109 110 111 112 |
# File 'lib/lastfm/api/library.rb', line 109 def remove_track( params ) LastFM.requires_authentication LastFM.post( "library.removeTrack", params ) end |