Class: Bandcamp::Track

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(track) ⇒ Track

Returns a new instance of Track.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/bandcamp.rb', line 100

def initialize(track)
  @lyrics        = track['lyrics']
  @downloadable  = track['downloadable']
  @duration      = track['duration']
  @about         = track['about']
  @album_id      = track['album_id']
  @credits       = track['credits']
  @streaming_url = track['streaming_url']
  @number        = track['number']
  @title         = track['title']
  @url           = track['url']
  @track_id      = track['track_id']
  @band_id       = track['band_id']
end

Instance Attribute Details

#aboutObject (readonly)

Returns the value of attribute about.



97
98
99
# File 'lib/bandcamp.rb', line 97

def about
  @about
end

#album_idObject (readonly)

Returns the value of attribute album_id.



97
98
99
# File 'lib/bandcamp.rb', line 97

def album_id
  @album_id
end

#band_idObject (readonly)

Returns the value of attribute band_id.



97
98
99
# File 'lib/bandcamp.rb', line 97

def band_id
  @band_id
end

#creditsObject (readonly)

Returns the value of attribute credits.



97
98
99
# File 'lib/bandcamp.rb', line 97

def credits
  @credits
end

#downloadableObject (readonly)

Returns the value of attribute downloadable.



97
98
99
# File 'lib/bandcamp.rb', line 97

def downloadable
  @downloadable
end

#durationObject (readonly)

Returns the value of attribute duration.



97
98
99
# File 'lib/bandcamp.rb', line 97

def duration
  @duration
end

#lyricsObject (readonly)

Returns the value of attribute lyrics.



97
98
99
# File 'lib/bandcamp.rb', line 97

def lyrics
  @lyrics
end

#numberObject (readonly)

Returns the value of attribute number.



97
98
99
# File 'lib/bandcamp.rb', line 97

def number
  @number
end

#streaming_urlObject (readonly)

Returns the value of attribute streaming_url.



97
98
99
# File 'lib/bandcamp.rb', line 97

def streaming_url
  @streaming_url
end

#titleObject (readonly)

Returns the value of attribute title.



97
98
99
# File 'lib/bandcamp.rb', line 97

def title
  @title
end

#track_idObject (readonly)

Returns the value of attribute track_id.



97
98
99
# File 'lib/bandcamp.rb', line 97

def track_id
  @track_id
end

#urlObject (readonly)

Returns the value of attribute url.



97
98
99
# File 'lib/bandcamp.rb', line 97

def url
  @url
end

Class Method Details

.load(id) ⇒ Object



124
125
126
127
# File 'lib/bandcamp.rb', line 124

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

Instance Method Details

#albumObject



115
116
117
# File 'lib/bandcamp.rb', line 115

def album
  @album ||= Album.load(album_id)
end

#bandObject



119
120
121
# File 'lib/bandcamp.rb', line 119

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