class TVTid::Channel

Attributes

category[RW]
icon[RW]
id[R]
language[RW]
logo_svg[RW]
region[RW]
title[R]

Public Class Methods

from_json(json) click to toggle source

Creates a new channel from a json object.

@returns a channel.

# 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
new(id, title) click to toggle source

Constructs a new channel with an id and a title.

# File library/tvtid/channel.rb, line 9
def initialize id, title
  @id = id
  @title = title
end