Class: TVTid::Channel

Inherits:
Object
  • Object
show all
Defined in:
library/tvtid/channel.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, title) ⇒ Channel

Constructs a new channel with an id and a title.



9
10
11
12
# File 'library/tvtid/channel.rb', line 9

def initialize id, title
  @id = id
  @title = title
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def category
  @category
end

#iconObject

Returns the value of attribute icon.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def icon
  @icon
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'library/tvtid/channel.rb', line 6

def id
  @id
end

#languageObject

Returns the value of attribute language.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def language
  @language
end

#logoObject

Returns the value of attribute logo.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def 
  @logo
end

#logo_svgObject

Returns the value of attribute logo_svg.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def logo_svg
  @logo_svg
end

#regionObject

Returns the value of attribute region.



5
6
7
# File 'library/tvtid/channel.rb', line 5

def region
  @region
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'library/tvtid/channel.rb', line 6

def title
  @title
end

Class Method Details

.from_json(json) ⇒ Object

Creates a new channel from a json object.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'library/tvtid/channel.rb', line 17

def self.from_json json
  return nil unless json['id'] and json['title']

  Channel.new(json['id'], json['title']).tap do |channel|
    channel.icon = json['icon']
    channel. = json['logo']
    channel.logo_svg = json['svgLogo']
    channel.category = json['category']
    channel.region = json['region']
    channel.language = json['lang']
  end
end