Class: LastFM::Album
Instance Attribute Summary collapse
-
#artist ⇒ LastFM::Artist, String
The current value of artist.
-
#id ⇒ Fixnum
The current value of id.
-
#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.
-
#release_date ⇒ Time
The current value of release_date.
-
#streamable ⇒ Boolean
The current value of streamable.
-
#tags ⇒ Array<LastFM::Tag>
The current value of tags.
-
#tracks ⇒ Array<LastFM::Track>
The current value of tracks.
-
#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 album using a list of user supplied tags.
-
.get_buylinks(params) ⇒ Array<LastFM::Buylink>
Get a list of buy links for an album.
-
.get_info(params) ⇒ LastFM::Album
Get the metadata for an album.
-
.get_shouts(params) ⇒ Array<LastFM::Shout>
Get shouts for an album.
-
.get_tags(params) ⇒ Object
Get the tags applied by an individual user to an album.
-
.get_top_tags(params) ⇒ Array<LastFM::Tag>
Get the top tags for an album, ordered by popularity.
-
.remove_tag(params) ⇒ Object
Remove a user’s tag from an album.
-
.search(params) ⇒ Array<LastFM::Album>
Search for an album by name.
-
.share(params) ⇒ Object
Share an album with one or more Last.fm users or other friends.
Methods inherited from Struct
from_xml, inherited, #initialize, package, #to_json
Constructor Details
This class inherits a constructor from LastFM::Struct
Instance Attribute Details
#artist ⇒ LastFM::Artist, String
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def artist @artist end |
#id ⇒ Fixnum
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def id @id end |
#images ⇒ Hash
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def images @images end |
#listeners ⇒ Fixnum
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def listeners @listeners end |
#mbid ⇒ String
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def mbid @mbid end |
#name ⇒ String
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def name @name end |
#playcount ⇒ Fixnum
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def playcount @playcount end |
#release_date ⇒ Time
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def release_date @release_date end |
#streamable ⇒ Boolean
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def streamable @streamable end |
#tags ⇒ Array<LastFM::Tag>
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def end |
#tracks ⇒ Array<LastFM::Track>
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def tracks @tracks end |
#url ⇒ String
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def url @url end |
#wiki ⇒ LastFM::Wiki
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def wiki @wiki end |
Class Method Details
.add_tags(params) ⇒ Object
Tag an album using a list of user supplied tags.
27 28 29 30 |
# File 'lib/lastfm/album.rb', line 27 def ( params ) LastFM.requires_authentication LastFM.post( "album.addTags", params ) end |
.get_buylinks(params) ⇒ Array<LastFM::Buylink>
Get a list of buy links for an album.
41 42 43 44 45 46 47 48 |
# File 'lib/lastfm/album.rb', line 41 def get_buylinks( params ) xml = LastFM.get( "album.getBuylinks", params ) [:physical, :download].each_with_object([]) do |type, buylinks| xml.find("affiliations/#{type}s/affiliation").each do |buylink| buylinks << LastFM::Buylink.from_xml( buylink, :type => type ) end end end |
.get_info(params) ⇒ LastFM::Album
Get the metadata for an album.
60 61 62 63 |
# File 'lib/lastfm/album.rb', line 60 def get_info( params ) xml = LastFM.get( "album.getInfo", params ) LastFM::Album.from_xml( xml ) end |
.get_shouts(params) ⇒ Array<LastFM::Shout>
Get shouts for an album.
75 76 77 78 79 80 |
# File 'lib/lastfm/album.rb', line 75 def get_shouts( params ) xml = LastFM.get( "album.getShouts", params ) xml.find('shouts/shout').map do |shout| LastFM::Shout.from_xml( shout ) end end |
.get_tags(params) ⇒ Object
Get the tags applied by an individual user to an album.
90 91 92 93 94 95 96 97 |
# File 'lib/lastfm/album.rb', line 90 def ( params ) secure = !params.include?(:user) LastFM.requires_authentication if secure xml = LastFM.get( "album.getTags", params, secure ) xml.find('tags/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |
.get_top_tags(params) ⇒ Array<LastFM::Tag>
Get the top tags for an album, ordered by popularity.
107 108 109 110 111 112 |
# File 'lib/lastfm/album.rb', line 107 def ( params ) xml = LastFM.get( "album.getTopTags", params ) xml.find('toptags/tag').map do |tag| LastFM::Tag.from_xml( tag ) end end |
.remove_tag(params) ⇒ Object
Remove a user’s tag from an album.
120 121 122 123 |
# File 'lib/lastfm/album.rb', line 120 def remove_tag( params ) LastFM.requires_authentication LastFM.post( "album.removeTag", params ) end |
.search(params) ⇒ Array<LastFM::Album>
Search for an album by name. Returns album matches sorted by relevance.
132 133 134 135 136 137 |
# File 'lib/lastfm/album.rb', line 132 def search( params ) xml = LastFM.get( "album.search", params ) xml.find('results/albummatches/album').map do |album| LastFM::Album.from_xml( album ) end end |
.share(params) ⇒ Object
Share an album with one or more Last.fm users or other friends.
147 148 149 150 |
# File 'lib/lastfm/album.rb', line 147 def share( params ) LastFM.requires_authentication LastFM.post( "album.share", params ) end |