Class: Rlastfm::Album

Inherits:
Object
  • Object
show all
Includes:
Helpers::Scraper
Defined in:
lib/rlastfm/album.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Scraper

included

Constructor Details

#initialize(hash = {}) ⇒ Album

Returns a new instance of Album.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rlastfm/album.rb', line 8

def initialize(hash={})
  @raw = hash.stringify_keys!
  @images = hash['images'] || hash['image']
  @name = hash['name']
  @play_count = hash['play_count'] || hash['playcount']
  @rank = hash['rank']
  @url = hash['url']
  if (a = hash['artist'])
    @artist = a.is_a?(Hash) ? a['name'] : a
  end
end

Instance Attribute Details

#artistObject

Returns the value of attribute artist.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def artist
  @artist
end

#imagesObject

Returns the value of attribute images.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def images
  @images
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def name
  @name
end

#play_countObject

Returns the value of attribute play_count.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def play_count
  @play_count
end

#rankObject

Returns the value of attribute rank.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def rank
  @rank
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/rlastfm/album.rb', line 5

def raw
  @raw
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/rlastfm/album.rb', line 6

def url
  @url
end

Instance Method Details

#tracksObject



20
21
22
# File 'lib/rlastfm/album.rb', line 20

def tracks
  @tracks ||= get_tracks
end