Class: FilmOn::Movie
- Inherits:
-
Object
- Object
- FilmOn::Movie
- Defined in:
- lib/film_on/models/movie.rb
Overview
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
Defined Under Namespace
Classes: Image
Instance Attribute Summary collapse
-
#artwork ⇒ Object
readonly
Returns the value of attribute artwork.
-
#cast ⇒ Object
readonly
Returns the value of attribute cast.
-
#content_blocked ⇒ Object
readonly
Returns the value of attribute content_blocked.
-
#content_host ⇒ Object
readonly
Returns the value of attribute content_host.
-
#crew ⇒ Object
readonly
Returns the value of attribute crew.
-
#deleted_at ⇒ Object
readonly
Returns the value of attribute deleted_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#episodes_count ⇒ Object
readonly
Returns the value of attribute episodes_count.
-
#exists_on_edgecast ⇒ Object
readonly
Returns the value of attribute exists_on_edgecast.
-
#genres ⇒ Object
readonly
Returns the value of attribute genres.
-
#georule ⇒ Object
readonly
Returns the value of attribute georule.
-
#high_quality_file_id ⇒ Object
readonly
Returns the value of attribute high_quality_file_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_enabled ⇒ Object
readonly
Returns the value of attribute is_enabled.
-
#is_featured ⇒ Object
readonly
Returns the value of attribute is_featured.
-
#low_quality_file_id ⇒ Object
readonly
Returns the value of attribute low_quality_file_id.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#poster ⇒ Object
readonly
Returns the value of attribute poster.
-
#poster_large ⇒ Object
readonly
Returns the value of attribute poster_large.
-
#poster_medium ⇒ Object
readonly
Returns the value of attribute poster_medium.
-
#poster_small ⇒ Object
readonly
Returns the value of attribute poster_small.
-
#series_number ⇒ Object
readonly
Returns the value of attribute series_number.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#streams ⇒ Object
readonly
Returns the value of attribute streams.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_id ⇒ Object
readonly
Returns the value of attribute type_id.
-
#vendor_id ⇒ Object
readonly
Returns the value of attribute vendor_id.
-
#vendorka_id ⇒ Object
readonly
Returns the value of attribute vendorka_id.
Instance Method Summary collapse
- #get_image(type, image) ⇒ Object
-
#initialize(hash) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(hash) ⇒ Movie
Returns a new instance of Movie.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 |
Instance Attribute Details
#artwork ⇒ Object (readonly)
Returns the value of attribute artwork.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def artwork @artwork end |
#cast ⇒ Object (readonly)
Returns the value of attribute cast.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def cast @cast end |
#content_blocked ⇒ Object (readonly)
Returns the value of attribute content_blocked.
16 17 18 |
# File 'lib/film_on/models/movie.rb', line 16 def content_blocked @content_blocked end |
#content_host ⇒ Object (readonly)
Returns the value of attribute content_host.
14 15 16 |
# File 'lib/film_on/models/movie.rb', line 14 def content_host @content_host end |
#crew ⇒ Object (readonly)
Returns the value of attribute crew.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def crew @crew end |
#deleted_at ⇒ Object (readonly)
Returns the value of attribute deleted_at.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def deleted_at @deleted_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def description @description end |
#episodes_count ⇒ Object (readonly)
Returns the value of attribute episodes_count.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def episodes_count @episodes_count end |
#exists_on_edgecast ⇒ Object (readonly)
Returns the value of attribute exists_on_edgecast.
14 15 16 |
# File 'lib/film_on/models/movie.rb', line 14 def exists_on_edgecast @exists_on_edgecast end |
#genres ⇒ Object (readonly)
Returns the value of attribute genres.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def genres @genres end |
#georule ⇒ Object (readonly)
Returns the value of attribute georule.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def georule @georule end |
#high_quality_file_id ⇒ Object (readonly)
Returns the value of attribute high_quality_file_id.
14 15 16 |
# File 'lib/film_on/models/movie.rb', line 14 def high_quality_file_id @high_quality_file_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def id @id end |
#is_enabled ⇒ Object (readonly)
Returns the value of attribute is_enabled.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def is_enabled @is_enabled end |
#is_featured ⇒ Object (readonly)
Returns the value of attribute is_featured.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def is_featured @is_featured end |
#low_quality_file_id ⇒ Object (readonly)
Returns the value of attribute low_quality_file_id.
14 15 16 |
# File 'lib/film_on/models/movie.rb', line 14 def low_quality_file_id @low_quality_file_id end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
14 15 16 |
# File 'lib/film_on/models/movie.rb', line 14 def parent_id @parent_id end |
#poster ⇒ Object (readonly)
Returns the value of attribute poster.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def poster @poster end |
#poster_large ⇒ Object (readonly)
Returns the value of attribute poster_large.
16 17 18 |
# File 'lib/film_on/models/movie.rb', line 16 def poster_large @poster_large end |
#poster_medium ⇒ Object (readonly)
Returns the value of attribute poster_medium.
16 17 18 |
# File 'lib/film_on/models/movie.rb', line 16 def poster_medium @poster_medium end |
#poster_small ⇒ Object (readonly)
Returns the value of attribute poster_small.
16 17 18 |
# File 'lib/film_on/models/movie.rb', line 16 def poster_small @poster_small end |
#series_number ⇒ Object (readonly)
Returns the value of attribute series_number.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def series_number @series_number end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def slug @slug end |
#streams ⇒ Object (readonly)
Returns the value of attribute streams.
16 17 18 |
# File 'lib/film_on/models/movie.rb', line 16 def streams @streams end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
15 16 17 |
# File 'lib/film_on/models/movie.rb', line 15 def type @type end |
#type_id ⇒ Object (readonly)
Returns the value of attribute type_id.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def type_id @type_id end |
#vendor_id ⇒ Object (readonly)
Returns the value of attribute vendor_id.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def vendor_id @vendor_id end |
#vendorka_id ⇒ Object (readonly)
Returns the value of attribute vendorka_id.
13 14 15 |
# File 'lib/film_on/models/movie.rb', line 13 def vendorka_id @vendorka_id end |
Instance Method Details
#get_image(type, image) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# 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 |