Class: LastFM::Api::Artist
- Inherits:
-
Object
- Object
- LastFM::Api::Artist
- Defined in:
- lib/lastfm/api/artist.rb
Class Method Summary collapse
-
.add_tags(params) ⇒ Object
Tag an artist with one or more user supplied tags.
-
.get_correction(params) ⇒ Array<LastFM::Artist>
Check whether the supplied artist has a correction to a canonical artist.
-
.get_events(params) ⇒ Object
Get a list of upcoming events for this artist.
-
.get_images(params) ⇒ Object
Get images for this artist in a variety of sizes.
-
.get_info(params) ⇒ LastFM::Artist
Get the metadata for an artist.
-
.get_past_events(params) ⇒ Object
Get a paginated list of all the events this artist has played at in the past.
-
.get_podcast(params) ⇒ Object
Get a podcast of free mp3s based on an artist.
-
.get_shouts(params) ⇒ Array<LastFM::Shout>
Get shouts for this artist.
-
.get_similar(params) ⇒ Array<LastFM::Artist>
Get all the artists similar to this artist.
-
.get_tags(params) ⇒ Object
Get the tags applied by an individual user to an artist on Last.fm.
-
.get_top_albums(params) ⇒ Array<LastFM::Album>
Get the top albums for an artist, ordered by popularity.
-
.get_top_fans(params) ⇒ Object
Get the top fans for an artist on Last.fm, based on listening data.
-
.get_top_tags(params) ⇒ Array<LastFM::Tag>
Get the top tags for an artist, ordered by popularity.
-
.get_top_tracks(params) ⇒ Array<LastFM::Track>
Get the top tracks by an artist, ordered by popularity.
-
.remove_tag(params) ⇒ Object
Remove a user’s tag from an artist.
-
.search(params) ⇒ Array<LastFM::Artist>
Search for an artist by name.
-
.share(params) ⇒ Object
Share an artist with Last.fm users or other friends.
-
.shout(params) ⇒ Object
Shout in this artist’s shoutbox.
Class Method Details
.add_tags(params) ⇒ Object
Tag an artist with one or more user supplied tags.
11 12 13 14 |
# File 'lib/lastfm/api/artist.rb', line 11 def ( params ) LastFM.requires_authentication LastFM.post( "artist.addTags", params ) end |
.get_correction(params) ⇒ Array<LastFM::Artist>
Check whether the supplied artist has a correction to a canonical artist.
21 22 23 24 25 26 |
# File 'lib/lastfm/api/artist.rb', line 21 def get_correction( params ) xml = LastFM.get( "artist.getCorrection", params ) xml.find('corrections/correction/artist').map do |correction| LastFM::Artist.from_xml( correction ) end end |
.get_events(params) ⇒ Object
Get a list of upcoming events for this artist.
37 38 39 40 41 42 |
# File 'lib/lastfm/api/artist.rb', line 37 def get_events( params ) xml = LastFM.get( "artist.getEvents", params ) xml.find('events/event').map do |event| LastFM::Event.from_xml( event ) end end |
.get_images(params) ⇒ Object
Get images for this artist in a variety of sizes.
53 54 55 |
# File 'lib/lastfm/api/artist.rb', line 53 def get_images( params ) LastFM.get( "artist.getImages", params ) end |
.get_info(params) ⇒ LastFM::Artist
Get the metadata for an artist. Includes biography.
66 67 68 69 |
# File 'lib/lastfm/api/artist.rb', line 66 def get_info( params ) xml = LastFM.get( "artist.getInfo", params ) LastFM::Artist.from_xml( xml ) end |
.get_past_events(params) ⇒ Object
Get a paginated list of all the events this artist has played at in the past.
79 80 81 |
# File 'lib/lastfm/api/artist.rb', line 79 def get_past_events( params ) LastFM.get( "artist.getPastEvents", params ) end |
.get_podcast(params) ⇒ Object
Get a podcast of free mp3s based on an artist.
89 90 91 |
# File 'lib/lastfm/api/artist.rb', line 89 def get_podcast( params ) LastFM.get( "artist.getPodcast", params ) end |
.get_shouts(params) ⇒ Array<LastFM::Shout>
Get shouts for this artist.
102 103 104 105 106 107 |
# File 'lib/lastfm/api/artist.rb', line 102 def get_shouts( params ) xml = LastFM.get( "artist.getShouts", params ) xml.find('shouts/shout').map do |shout| LastFM::Shout.from_xml( shout ) end end |
.get_similar(params) ⇒ Array<LastFM::Artist>
Get all the artists similar to this artist.
117 118 119 120 121 122 |
# File 'lib/lastfm/api/artist.rb', line 117 def get_similar( params ) xml = LastFM.get( "artist.getSimilar", params ) xml.find('similarartists/artist').map do |artist| LastFM::Artist.from_xml( artist ) end end |
.get_tags(params) ⇒ Object
Get the tags applied by an individual user to an artist on Last.fm. If accessed as an authenticated service and you don’t supply a user parameter then this service will return tags for the authenticated user.
132 133 134 135 136 |
# File 'lib/lastfm/api/artist.rb', line 132 def ( params ) secure = !params.include?(:user) LastFM.requires_authentication if secure LastFM.get( "artist.getTags", params, secure ) end |
.get_top_albums(params) ⇒ Array<LastFM::Album>
Get the top albums for an artist, ordered by popularity.
147 148 149 150 151 152 |
# File 'lib/lastfm/api/artist.rb', line 147 def get_top_albums( params ) xml = LastFM.get( "artist.getTopAlbums", params ) xml.find('topalbums/album').map do |album| LastFM::Album.from_xml( album ) end end |
.get_top_fans(params) ⇒ Object
Get the top fans for an artist on Last.fm, based on listening data.
160 161 162 |
# File 'lib/lastfm/api/artist.rb', line 160 def get_top_fans( params ) LastFM.get( "artist.getTopFans", params ) end |
.get_top_tags(params) ⇒ Array<LastFM::Tag>
Get the top tags for an artist, ordered by popularity.
171 172 173 174 175 176 |
# File 'lib/lastfm/api/artist.rb', line 171 def ( params ) xml = LastFM.get( "artist.getTopTags", params ) xml.find('toptags/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |
.get_top_tracks(params) ⇒ Array<LastFM::Track>
Get the top tracks by an artist, ordered by popularity.
187 188 189 190 191 192 |
# File 'lib/lastfm/api/artist.rb', line 187 def get_top_tracks( params ) xml = LastFM.get( "artist.getTopTracks", params ) xml.find('toptracks/track').map do |track| LastFM::Track.from_xml( track ) end end |
.remove_tag(params) ⇒ Object
Remove a user’s tag from an artist.
199 200 201 202 |
# File 'lib/lastfm/api/artist.rb', line 199 def remove_tag( params ) LastFM.requires_authentication LastFM.post( "artist.removeTag", params ) end |
.search(params) ⇒ Array<LastFM::Artist>
Search for an artist by name. Returns artist matches sorted by relevance.
211 212 213 214 215 216 |
# File 'lib/lastfm/api/artist.rb', line 211 def search( params ) xml = LastFM.get( "artist.search", params ) xml.find('results/artistmatches/artist').map do |artist| LastFM::Artist.from_xml( artist ) end end |
.share(params) ⇒ Object
Share an artist with Last.fm users or other friends.
225 226 227 228 |
# File 'lib/lastfm/api/artist.rb', line 225 def share( params ) LastFM.requires_authentication LastFM.post( "artist.share", params ) end |
.shout(params) ⇒ Object
Shout in this artist’s shoutbox.
235 236 237 238 |
# File 'lib/lastfm/api/artist.rb', line 235 def shout( params ) LastFM.requires_authentication LastFM.post( "artist.shout", params ) end |