Class: TVTid::Channel
- Inherits:
-
Object
- Object
- TVTid::Channel
- Defined in:
- library/tvtid/channel.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#logo ⇒ Object
Returns the value of attribute logo.
-
#logo_svg ⇒ Object
Returns the value of attribute logo_svg.
-
#region ⇒ Object
Returns the value of attribute region.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
Creates a new channel from a json object.
Instance Method Summary collapse
-
#initialize(id, title) ⇒ Channel
constructor
Constructs a new channel with an id and a title.
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
#category ⇒ Object
Returns the value of attribute category.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def category @category end |
#icon ⇒ Object
Returns the value of attribute icon.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def icon @icon end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'library/tvtid/channel.rb', line 6 def id @id end |
#language ⇒ Object
Returns the value of attribute language.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def language @language end |
#logo ⇒ Object
Returns the value of attribute logo.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def logo @logo end |
#logo_svg ⇒ Object
Returns the value of attribute logo_svg.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def logo_svg @logo_svg end |
#region ⇒ Object
Returns the value of attribute region.
5 6 7 |
# File 'library/tvtid/channel.rb', line 5 def region @region end |
#title ⇒ Object (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.logo = json['logo'] channel.logo_svg = json['svgLogo'] channel.category = json['category'] channel.region = json['region'] channel.language = json['lang'] end end |