class FilmOn::Genre

Genre is a group of movies bundled together such as “Sports” or “Horror” takes a raw hash and converts it into a nice ruby object

Constants

Image

Attributes

content_count[R]
description[R]
id[R]
images[R]
name[R]
position[R]
retina_image[R]
slug[R]
standard_image[R]
updated_at[R]
vendorka_id[R]

Public Class Methods

new(hash) click to toggle source
# File lib/film_on/models/genre.rb, line 16
def initialize(hash)
  @id = hash["id"]
  @vendorka_id = hash["vendorka_id"]
  @name = hash["name"]
  @slug = hash["slug"]
  @position = hash["position"]
  @content_count = hash["content_count"]
  @updated_at = hash["updated_at"]
  @description = hash["description"]
  @images = get_images(hash["images"])
end

Public Instance Methods

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