class FilmOn::Programme

Programme holds the detail of a TV programme, it takes a raw hash and converts it into a nice ruby object

Constants

Image

Attributes

allow_dvr[R]
allow_reminder[R]
channel_id[R]
duration[R]
enddatetime[R]
episode_number[R]
images[R]
is_series[R]
length[R]
programme[R]
programme_description[R]
programme_name[R]
provider[R]
series_id[R]
series_number[R]
startdatetime[R]
vendor_id[R]

Public Class Methods

new(hash) click to toggle source
# File lib/film_on/models/programme.rb, line 13
def initialize(hash)
  @programme = hash["programme"]
  @startdatetime = hash["startdatetime"]
  @enddatetime = hash["enddatetime"]
  @duration = hash["duration"]
  @length = hash["length"]
  @programme_description = hash["programme_description"]
  @programme_name = hash["programme_name"]
  @allow_dvr = hash["allow_dvr"]
  @allow_reminder = hash["allow_reminder"]
  @channel_id = hash["channel_id"]
  @images = get_images(hash["images"])
  @provider = hash["provider"]
  @vendor_id = hash["vendor_id"]
  @series_number = hash["seriesNumber"]
  @episode_number = hash["episodeNumber"]
  @series_id = hash["seriesId"]
  @is_series = hash["isSeries"]
end

Public Instance Methods

get_images(imgs) click to toggle source
# File lib/film_on/models/programme.rb, line 33
def get_images(imgs)
  return [] unless imgs.is_a?(Array)
  imgs.map{|img| Image.new(img["id"], img["type"], img["size"], img["width"], img["height"], img["url"], img["copyright"]) }
end