Class: Bandcamp::Track
- Inherits:
-
Object
- Object
- Bandcamp::Track
- Includes:
- Associated, Methodical
- Defined in:
- lib/bandcamp/track.rb
Instance Method Summary collapse
- #album ⇒ Object
- #band ⇒ Object
- #free? ⇒ Boolean
-
#initialize(attrs) ⇒ Track
constructor
A new instance of Track.
- #paid? ⇒ Boolean
- #to_json ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Track
Returns a new instance of Track.
12 13 14 15 |
# File 'lib/bandcamp/track.rb', line 12 def initialize attrs @attrs_hash = attrs to_methods @attrs_hash end |
Instance Method Details
#album ⇒ Object
29 30 31 |
# File 'lib/bandcamp/track.rb', line 29 def album retrieve_associated :album end |
#band ⇒ Object
25 26 27 |
# File 'lib/bandcamp/track.rb', line 25 def band retrieve_associated :band end |
#free? ⇒ Boolean
21 22 23 |
# File 'lib/bandcamp/track.rb', line 21 def free? downloadable == 1 ? true : false end |
#paid? ⇒ Boolean
17 18 19 |
# File 'lib/bandcamp/track.rb', line 17 def paid? downloadable == 2 ? true : false end |
#to_json ⇒ Object
33 34 35 |
# File 'lib/bandcamp/track.rb', line 33 def to_json MultiJson.encode @attrs_hash end |