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