class FilmOn::Movie

FilmOn::Movie Movie can have either a basic set of data or a more verbose set depending on whether it is called as part of a vod_search or as in individual call from movie, takes a raw hash and converts it into a nice ruby object

Constants

Image

Attributes

artwork[R]
cast[R]
content_blocked[R]
content_host[R]
crew[R]
deleted_at[R]
description[R]
episode_number[R]
episodes[R]
episodes_count[R]
exists_on_edgecast[R]
genres[R]
georule[R]
high_quality_file_id[R]
id[R]
is_enabled[R]
low_quality_file_id[R]
parent_id[R]
poster[R]
poster_large[R]
poster_medium[R]
poster_small[R]
series_number[R]
slug[R]
streams[R]
title[R]
type[R]
type_id[R]
vendor_id[R]
vendorka_id[R]

Public Class Methods

new(hash) click to toggle source
# File lib/film_on/models/movie.rb, line 18
def initialize(hash)
  @id = hash["id"]
  @title = hash["title"]
  @slug = hash["slug"]
  @description = hash["description"]
  @type_id = hash["type_id"]
  @series_number = hash["series_number"]
  @episode_number = hash["episode_number"]
  @episodes_count = hash["episodes_count"]
  @episodes = hash["episodes"]
  @vendor_id = hash["vendor_id"]
  @vendorka_id = hash["vendorka_id"]
  @content_host = hash["content_host"]
  @low_quality_file_id = hash["low_quality_file_id"]
  @high_quality_file_id = hash["high_quality_file_id"]
  @parent_id = hash["parent_id"]
  @exists_on_edgecast = hash["exists_on_edgecast"]
  @is_featured = hash["is_featured"]
  @is_enabled = hash["is_enabled"]
  @deleted_at = hash["deleted_at"]
  @genres = hash["genres"]
  @cast = hash["cast"]
  @crew = hash["crew"]
  @artwork = hash["artwork"] #TODO convert to image structs
  @poster = hash["poster"]
  @poster_small = get_image(:small, hash["poster"])
  @poster_medium = get_image(:medium, hash["poster"])
  @poster_large = get_image(:large, hash["poster"])
  @georule = hash["georule"]
  @type = hash["type"]
  @streams = hash["streams"]
  @content_blocked = hash["content_blocked"]
end

Public Instance Methods

get_image(type, image) click to toggle source
# File lib/film_on/models/movie.rb, line 52
def get_image(type, image)
  return {} unless image.is_a?(Hash)
  case type
  when :small
    image = (image["thumbs"] && image["thumbs"]["thumb_120p"]) ? image["thumbs"]["thumb_120p"] : image
  when :medium
    image = (image["thumbs"] && image["thumbs"]["thumb_220p"]) ? image["thumbs"]["thumb_220p"] : image
  end
  Image.new(image["type"], image["width"], image["height"], image["url"])
end