class LastFM::Album

Attributes

artist[R]
mbid[R]
released[R]
tracks[R]

Public Class Methods

get_info(artist, album) click to toggle source
# File lib/last_fm/album.rb, line 29
def get_info(artist, album)
  Query.get_info({ method: 'album.getInfo', artist: artist, album: album })
end
new(attributes) click to toggle source
Calls superclass method
# File lib/last_fm/album.rb, line 5
def initialize(attributes)
  super(attributes)

  @mbid = attributes['mbid'] if attributes['mbid']
  @artist = attributes['artist'] if attributes['artist']


  if attributes['releasedate'] and attributes['releasedate'].gsub(/\s+/, '').length > 0
    @released = Date.parse(attributes['releasedate'])
  end

  @tracks = []
  if attributes['tracks'] and attributes['tracks']['track']
    attributes['tracks']['track'].each do |track|
      @tracks << Track.new(track['name'], track['duration'], track['mbid'], track['url'])
    end
  end
end