Class: Bandcamp::Album

Inherits:
Base
  • Object
show all
Defined in:
lib/bandcamp.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

url

Constructor Details

#initialize(album) ⇒ Album

Returns a new instance of Album.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/bandcamp.rb', line 69

def initialize(album)      
  @title         = album['title']
  @release_date  = Time.at(album['release_date'])
  @downloadable  = album['downloadable']
  @url           = album['url']
  @about         = album['about']
  @credits       = album['credits']      
  @small_art_url = album['small_art_url']
  @large_art_url = album['large_art_url']
  @artist        = album['artist']
  @album_id      = album['album_id']
  @band_id       = album['band_id']
  @tracks        = album['tracks'].map{ |track| Track.new(track) }
end

Instance Attribute Details

#aboutObject (readonly)

Returns the value of attribute about.



66
67
68
# File 'lib/bandcamp.rb', line 66

def about
  @about
end

#album_idObject (readonly)

Returns the value of attribute album_id.



66
67
68
# File 'lib/bandcamp.rb', line 66

def album_id
  @album_id
end

#artistObject (readonly)

Returns the value of attribute artist.



66
67
68
# File 'lib/bandcamp.rb', line 66

def artist
  @artist
end

#band_idObject (readonly)

Returns the value of attribute band_id.



66
67
68
# File 'lib/bandcamp.rb', line 66

def band_id
  @band_id
end

#creditsObject (readonly)

Returns the value of attribute credits.



66
67
68
# File 'lib/bandcamp.rb', line 66

def credits
  @credits
end

#downloadableObject (readonly)

Returns the value of attribute downloadable.



66
67
68
# File 'lib/bandcamp.rb', line 66

def downloadable
  @downloadable
end

#large_art_urlObject (readonly)

Returns the value of attribute large_art_url.



66
67
68
# File 'lib/bandcamp.rb', line 66

def large_art_url
  @large_art_url
end

#release_dateObject (readonly)

Returns the value of attribute release_date.



66
67
68
# File 'lib/bandcamp.rb', line 66

def release_date
  @release_date
end

#small_art_urlObject (readonly)

Returns the value of attribute small_art_url.



66
67
68
# File 'lib/bandcamp.rb', line 66

def small_art_url
  @small_art_url
end

#titleObject (readonly)

Returns the value of attribute title.



66
67
68
# File 'lib/bandcamp.rb', line 66

def title
  @title
end

#tracksObject (readonly)

Returns the value of attribute tracks.



66
67
68
# File 'lib/bandcamp.rb', line 66

def tracks
  @tracks
end

#urlObject (readonly)

Returns the value of attribute url.



66
67
68
# File 'lib/bandcamp.rb', line 66

def url
  @url
end

Class Method Details

.load(id) ⇒ Object



89
90
91
92
# File 'lib/bandcamp.rb', line 89

def load(id)
  response = get("/album/2/info", :query => { :key => Bandcamp::Base.api_key, :album_id => id })
  new(response) if response
end

Instance Method Details

#bandObject



84
85
86
# File 'lib/bandcamp.rb', line 84

def band
  @band ||= Band.load(band_id)
end