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.
Instance Method Summary collapse
Methods inherited from Struct
from_xml, #initialize, package
Constructor Details
This class inherits a constructor from LastFM::Struct
Instance Attribute Details
#artist ⇒ LastFM::Artist, String
Returns the current value of artist.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def artist @artist end |
#id ⇒ Fixnum
Returns the current value of id.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def id @id end |
#images ⇒ Hash
Returns the current value of images.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def images @images end |
#listeners ⇒ Fixnum
Returns the current value of listeners.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def listeners @listeners end |
#mbid ⇒ String
Returns the current value of mbid.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def mbid @mbid end |
#name ⇒ String
Returns the current value of name.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def name @name end |
#playcount ⇒ Fixnum
Returns the current value of playcount.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def playcount @playcount end |
#release_date ⇒ Time
Returns the current value of release_date.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def release_date @release_date end |
#streamable ⇒ Boolean
Returns the current value of streamable.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def streamable @streamable end |
#tags ⇒ Array<LastFM::Tag>
Returns the current value of tags.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def @tags end |
#tracks ⇒ Array<LastFM::Track>
Returns the current value of tracks.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def tracks @tracks end |
#url ⇒ String
Returns the current value of url.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def url @url end |
#wiki ⇒ LastFM::Wiki
Returns the current value of wiki.
16 17 18 |
# File 'lib/lastfm/album.rb', line 16 def wiki @wiki end |
Instance Method Details
#update_from_node(node) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/lastfm/album.rb', line 18 def update_from_node(node) case node.name.to_sym when :name, :title self.name = node.content when :artist self.artist = (node.find('*').count == 0) ? node.content : LastFM::Artist.from_xml(node) when :id self.id = node.content.to_i when :mbid self.mbid = node.content when :url self.url = node.content when :releasedate self.release_date = Time.parse(node.content) rescue nil when :image self.images ||= {} self.images.merge!({node['size'].to_sym => node.content}) when :listeners self.listeners = node.content.to_i when :playcount self.playcount = node.content.to_i when :streamable self.streamable = (node.content == '1') when :tracks self.tracks = node.find('track').map do |track| LastFM::Track.from_xml(track, :album => self.name, :position => track['rank'].to_i) end when :toptags self. = node.find('tag').map do |tag| LastFM::Tag.from_xml(tag) end when :wiki self.wiki = LastFM::Wiki.from_xml(node) end end |