Class: BBC::Music::Release
- Inherits:
-
Object
- Object
- BBC::Music::Release
- Defined in:
- lib/bbc/music/release.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(params) ⇒ Release
constructor
A new instance of Release.
- #to_h ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(params) ⇒ Release
Returns a new instance of Release.
7 8 9 10 11 12 |
# File 'lib/bbc/music/release.rb', line 7 def initialize(params) @name = params['name'] @year = params['release_year'] @type = params['release_type'] @status = params['official'] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/bbc/music/release.rb', line 5 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/bbc/music/release.rb', line 5 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/bbc/music/release.rb', line 5 def type @type end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
5 6 7 |
# File 'lib/bbc/music/release.rb', line 5 def year @year end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/bbc/music/release.rb', line 14 def to_h { :name => name, :year => year, :type => type, :status => status } end |
#to_json(options = {}) ⇒ Object
23 24 25 |
# File 'lib/bbc/music/release.rb', line 23 def to_json(={}) JSON.generate(to_h) end |