Class: Bandcamp::Album

Inherits:
Object
  • Object
show all
Includes:
Associated, Methodical
Defined in:
lib/bandcamp/album.rb

Instance Method Summary collapse

Constructor Details

#initialize(album_hash) ⇒ Album

Returns a new instance of Album.



11
12
13
14
15
16
17
# File 'lib/bandcamp/album.rb', line 11

def initialize album_hash
  @album_hash = album_hash
  to_methods @album_hash
  if instance_variable_defined? "@tracks"
    @tracks = @tracks.map{|track| Track.new(track)}
  end
end

Instance Method Details

#bandObject



19
20
21
# File 'lib/bandcamp/album.rb', line 19

def band
  retrieve_associated :band
end

#to_jsonObject



23
24
25
# File 'lib/bandcamp/album.rb', line 23

def to_json
  MultiJson.encode @album_hash
end