Class: BBC::Music::Release

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

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



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