Class: Encosion::Playlist

Inherits:
Object
  • Object
show all
Defined in:
lib/encosion/playlist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Playlist

Returns a new instance of Playlist.



7
8
9
10
11
12
# File 'lib/encosion/playlist.rb', line 7

def initialize(obj)
  @id = obj['id']
  @name = obj['name']
  @short_description = obj['shortDescription']
  @videos = obj['videos'].collect { |video| Video.new(video) }
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/encosion/playlist.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/encosion/playlist.rb', line 5

def name
  @name
end

#reference_idObject (readonly)

Returns the value of attribute reference_id.



5
6
7
# File 'lib/encosion/playlist.rb', line 5

def reference_id
  @reference_id
end

#short_descriptionObject (readonly)

Returns the value of attribute short_description.



5
6
7
# File 'lib/encosion/playlist.rb', line 5

def short_description
  @short_description
end

#videosObject (readonly)

Returns the value of attribute videos.



5
6
7
# File 'lib/encosion/playlist.rb', line 5

def videos
  @videos
end

Instance Method Details

#to_jsonObject



14
15
16
17
18
19
20
# File 'lib/encosion/playlist.rb', line 14

def to_json
  { :id => @id,
    :name => @name,
    :short_description => @short_description,
    :reference_id => @reference_id,
    :videos => @videos }.to_json
end