Class: LastFM::Artist
Instance Attribute Summary collapse
-
#images ⇒ Hash
The current value of images.
-
#listeners ⇒ Fixnum
The current value of listeners.
-
#mbid ⇒ String
The current value of mbid.
-
#name ⇒ String
The current value of name.
-
#playcount ⇒ Fixnum
The current value of playcount.
-
#similar ⇒ Array
The current value of similar.
-
#streamable ⇒ Boolean
The current value of streamable.
-
#tags ⇒ Array
The current value of tags.
-
#url ⇒ String
The current value of url.
-
#wiki ⇒ LastFM::Wiki
The current value of wiki.
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.
Methods inherited from Struct
from_xml, inherited, #initialize, package, #to_json
Constructor Details
This class inherits a constructor from LastFM::Struct
Instance Attribute Details
#images ⇒ Hash
Returns the current value of images.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def images @images end |
#listeners ⇒ Fixnum
Returns the current value of listeners.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def listeners @listeners end |
#mbid ⇒ String
Returns the current value of mbid.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def mbid @mbid end |
#name ⇒ String
Returns the current value of name.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def name @name end |
#playcount ⇒ Fixnum
Returns the current value of playcount.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def playcount @playcount end |
#similar ⇒ Array
Returns the current value of similar.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def similar @similar end |
#streamable ⇒ Boolean
Returns the current value of streamable.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def streamable @streamable end |
#tags ⇒ Array
Returns the current value of tags.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def end |
#url ⇒ String
Returns the current value of url.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def url @url end |
#wiki ⇒ LastFM::Wiki
Returns the current value of wiki.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def wiki @wiki end |
Class Method Details
.add_tags(params) ⇒ Object
Tag an artist with one or more user supplied tags.
23 24 25 26 |
# File 'lib/lastfm/artist.rb', line 23 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.
33 34 35 36 37 38 |
# File 'lib/lastfm/artist.rb', line 33 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.
49 50 51 52 53 54 |
# File 'lib/lastfm/artist.rb', line 49 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.
65 66 67 |
# File 'lib/lastfm/artist.rb', line 65 def get_images( params ) LastFM.get( "artist.getImages", params ) end |
.get_info(params) ⇒ LastFM::Artist
Get the metadata for an artist. Includes biography.
78 79 80 81 |
# File 'lib/lastfm/artist.rb', line 78 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.
91 92 93 |
# File 'lib/lastfm/artist.rb', line 91 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.
101 102 103 |
# File 'lib/lastfm/artist.rb', line 101 def get_podcast( params ) LastFM.get( "artist.getPodcast", params ) end |
.get_shouts(params) ⇒ Array<LastFM::Shout>
Get shouts for this artist.
114 115 116 117 118 119 |
# File 'lib/lastfm/artist.rb', line 114 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.
129 130 131 132 133 134 |
# File 'lib/lastfm/artist.rb', line 129 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.
144 145 146 147 148 |
# File 'lib/lastfm/artist.rb', line 144 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.
159 160 161 162 163 164 |
# File 'lib/lastfm/artist.rb', line 159 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.
172 173 174 |
# File 'lib/lastfm/artist.rb', line 172 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.
183 184 185 186 187 188 |
# File 'lib/lastfm/artist.rb', line 183 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.
199 200 201 202 203 204 |
# File 'lib/lastfm/artist.rb', line 199 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.
211 212 213 214 |
# File 'lib/lastfm/artist.rb', line 211 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.
223 224 225 226 227 228 |
# File 'lib/lastfm/artist.rb', line 223 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.
237 238 239 240 |
# File 'lib/lastfm/artist.rb', line 237 def share( params ) LastFM.requires_authentication LastFM.post( "artist.share", params ) end |
.shout(params) ⇒ Object
Shout in this artist’s shoutbox.
247 248 249 250 |
# File 'lib/lastfm/artist.rb', line 247 def shout( params ) LastFM.requires_authentication LastFM.post( "artist.shout", params ) end |