Class: BBC::Music::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/bbc/music/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/bbc/music/link.rb', line 5

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/bbc/music/link.rb', line 5

def type
  @type
end

#urlObject (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_hObject



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(options={})
  JSON.generate(to_h)
end