Class: GuideboxWrapper::Movie
- Inherits:
-
Object
- Object
- GuideboxWrapper::Movie
- Defined in:
- lib/GuideboxWrapper/movie/movie.rb
Instance Attribute Summary collapse
-
#alternate_titles ⇒ Object
readonly
Returns the value of attribute alternate_titles.
-
#android_trailers ⇒ Object
readonly
Returns the value of attribute android_trailers.
-
#backgrounds ⇒ Object
Returns the value of attribute backgrounds.
-
#banners ⇒ Object
Returns the value of attribute banners.
-
#cast ⇒ Object
readonly
Returns the value of attribute cast.
-
#directors ⇒ Object
readonly
Returns the value of attribute directors.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#facebook_link ⇒ Object
readonly
Returns the value of attribute facebook_link.
-
#free_android_sources ⇒ Object
readonly
Returns the value of attribute free_android_sources.
-
#free_ios_sources ⇒ Object
readonly
Returns the value of attribute free_ios_sources.
-
#free_web_sources ⇒ Object
readonly
Returns the value of attribute free_web_sources.
-
#freebase ⇒ Object
readonly
Returns the value of attribute freebase.
-
#genres ⇒ Object
readonly
Returns the value of attribute genres.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#imdb ⇒ Object
readonly
Returns the value of attribute imdb.
-
#ios_trailers ⇒ Object
readonly
Returns the value of attribute ios_trailers.
-
#metacritic ⇒ Object
readonly
Returns the value of attribute metacritic.
-
#overview ⇒ Object
readonly
Returns the value of attribute overview.
-
#posters ⇒ Object
Returns the value of attribute posters.
-
#purchase_android_sources ⇒ Object
readonly
Returns the value of attribute purchase_android_sources.
-
#purchase_ios_sources ⇒ Object
readonly
Returns the value of attribute purchase_ios_sources.
-
#purchase_web_sources ⇒ Object
readonly
Returns the value of attribute purchase_web_sources.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
-
#release_date ⇒ Object
readonly
Returns the value of attribute release_date.
-
#release_year ⇒ Object
readonly
Returns the value of attribute release_year.
-
#rottentomatoes ⇒ Object
readonly
Returns the value of attribute rottentomatoes.
-
#subscription_web_sources ⇒ Object
readonly
Returns the value of attribute subscription_web_sources.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#themoviedb ⇒ Object
readonly
Returns the value of attribute themoviedb.
-
#thumbnails ⇒ Object
Returns the value of attribute thumbnails.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#tv_everywhere_android_sources ⇒ Object
readonly
Returns the value of attribute tv_everywhere_android_sources.
-
#tv_everywhere_ios_sources ⇒ Object
readonly
Returns the value of attribute tv_everywhere_ios_sources.
-
#tv_everywhere_web_sources ⇒ Object
readonly
Returns the value of attribute tv_everywhere_web_sources.
-
#web_trailers ⇒ Object
readonly
Returns the value of attribute web_trailers.
-
#wikipedia_id ⇒ Object
readonly
Returns the value of attribute wikipedia_id.
-
#writers ⇒ Object
readonly
Returns the value of attribute writers.
Instance Method Summary collapse
- #images=(api_key) ⇒ Object
-
#initialize(movie_info) ⇒ Movie
constructor
A new instance of Movie.
- #large_banners ⇒ Object
- #large_posters ⇒ Object
- #large_thumbnails ⇒ Object
- #medium_banners ⇒ Object
- #medium_posters ⇒ Object
- #medium_thumbnails ⇒ Object
- #small_banners ⇒ Object
- #small_posters ⇒ Object
- #small_thumbnails ⇒ Object
- #xlarge_banners ⇒ Object
- #xlarge_thumbnails ⇒ Object
Constructor Details
#initialize(movie_info) ⇒ Movie
Returns a new instance of Movie.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 6 def initialize(movie_info) excluded_keys = ["common_sense_media", "poster_120x171", "poster_240x342", "poster_400x570", "social", "trailers"] movie_info.each do |key, value| unless excluded_keys.include?(key) instance_variable_set("@#{key}", value) end end @facebook_link = movie_info["social"]["facebook"]["link"] @web_trailers = movie_info["trailers"]["web"] @ios_trailers = movie_info["trailers"]["ios"] @android_trailers = movie_info["trailers"]["android"] end |
Instance Attribute Details
#alternate_titles ⇒ Object (readonly)
Returns the value of attribute alternate_titles.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def alternate_titles @alternate_titles end |
#android_trailers ⇒ Object (readonly)
Returns the value of attribute android_trailers.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def android_trailers @android_trailers end |
#backgrounds ⇒ Object
Returns the value of attribute backgrounds.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def backgrounds @backgrounds end |
#banners ⇒ Object
Returns the value of attribute banners.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def @banners end |
#cast ⇒ Object (readonly)
Returns the value of attribute cast.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def cast @cast end |
#directors ⇒ Object (readonly)
Returns the value of attribute directors.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def directors @directors end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def duration @duration end |
#facebook_link ⇒ Object (readonly)
Returns the value of attribute facebook_link.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def facebook_link @facebook_link end |
#free_android_sources ⇒ Object (readonly)
Returns the value of attribute free_android_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def free_android_sources @free_android_sources end |
#free_ios_sources ⇒ Object (readonly)
Returns the value of attribute free_ios_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def free_ios_sources @free_ios_sources end |
#free_web_sources ⇒ Object (readonly)
Returns the value of attribute free_web_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def free_web_sources @free_web_sources end |
#freebase ⇒ Object (readonly)
Returns the value of attribute freebase.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def freebase @freebase end |
#genres ⇒ Object (readonly)
Returns the value of attribute genres.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def genres @genres end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def id @id end |
#imdb ⇒ Object (readonly)
Returns the value of attribute imdb.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def imdb @imdb end |
#ios_trailers ⇒ Object (readonly)
Returns the value of attribute ios_trailers.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def ios_trailers @ios_trailers end |
#metacritic ⇒ Object (readonly)
Returns the value of attribute metacritic.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def @metacritic end |
#overview ⇒ Object (readonly)
Returns the value of attribute overview.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def overview @overview end |
#posters ⇒ Object
Returns the value of attribute posters.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def posters @posters end |
#purchase_android_sources ⇒ Object (readonly)
Returns the value of attribute purchase_android_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def purchase_android_sources @purchase_android_sources end |
#purchase_ios_sources ⇒ Object (readonly)
Returns the value of attribute purchase_ios_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def purchase_ios_sources @purchase_ios_sources end |
#purchase_web_sources ⇒ Object (readonly)
Returns the value of attribute purchase_web_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def purchase_web_sources @purchase_web_sources end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def @rating end |
#release_date ⇒ Object (readonly)
Returns the value of attribute release_date.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def release_date @release_date end |
#release_year ⇒ Object (readonly)
Returns the value of attribute release_year.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def release_year @release_year end |
#rottentomatoes ⇒ Object (readonly)
Returns the value of attribute rottentomatoes.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def rottentomatoes @rottentomatoes end |
#subscription_web_sources ⇒ Object (readonly)
Returns the value of attribute subscription_web_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def subscription_web_sources @subscription_web_sources end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def @tags end |
#themoviedb ⇒ Object (readonly)
Returns the value of attribute themoviedb.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def themoviedb @themoviedb end |
#thumbnails ⇒ Object
Returns the value of attribute thumbnails.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def thumbnails @thumbnails end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def title @title end |
#tv_everywhere_android_sources ⇒ Object (readonly)
Returns the value of attribute tv_everywhere_android_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def tv_everywhere_android_sources @tv_everywhere_android_sources end |
#tv_everywhere_ios_sources ⇒ Object (readonly)
Returns the value of attribute tv_everywhere_ios_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def tv_everywhere_ios_sources @tv_everywhere_ios_sources end |
#tv_everywhere_web_sources ⇒ Object (readonly)
Returns the value of attribute tv_everywhere_web_sources.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def tv_everywhere_web_sources @tv_everywhere_web_sources end |
#web_trailers ⇒ Object (readonly)
Returns the value of attribute web_trailers.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def web_trailers @web_trailers end |
#wikipedia_id ⇒ Object (readonly)
Returns the value of attribute wikipedia_id.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def wikipedia_id @wikipedia_id end |
#writers ⇒ Object (readonly)
Returns the value of attribute writers.
3 4 5 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 3 def writers @writers end |
Instance Method Details
#images=(api_key) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 19 def images=(api_key) if @posters == nil wrapper = GuideboxWrapper::GuideboxMovie.new(api_key, "all") url = wrapper.base_url url += "/movie/" + @id.to_s + "/images/all" images = wrapper.client.query(url)["results"] @posters = images["posters"] @backgrounds = images["backgrounds"] @banners = images["banners"] @thumbnails = images["thumbnails"] end end |
#large_banners ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 64 def ||= [] for in @banners << ["large"] end end |
#large_posters ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 32 def large_posters lg_posters ||= [] for poster in @posters lg_posters << poster["large"] end lg_posters end |
#large_thumbnails ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 96 def large_thumbnails lg_thumbnails ||= [] for thumbnail in @thumbnails lg_thumbnails << thumbnail["large"] end lg_thumbnails end |
#medium_banners ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 72 def ||= [] for in @banners << ["medium"] end end |
#medium_posters ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 40 def medium_posters md_posters ||= [] for poster in @posters md_posters << poster["medium"] end md_posters end |
#medium_thumbnails ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 104 def medium_thumbnails md_thumbnails ||= [] for thumbnail in @thumbnails md_thumbnails << thumbnail["medium"] end md_thumbnails end |
#small_banners ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 80 def ||= [] for in @banners << ["small"] end end |
#small_posters ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 48 def small_posters sm_posters ||= [] for poster in @posters sm_posters << poster["small"] end sm_posters end |
#small_thumbnails ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 112 def small_thumbnails sm_thumbnails ||= [] for thumbnail in @thumbnails sm_thumbnails << thumbnail["small"] end sm_thumbnails end |
#xlarge_banners ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 56 def ||= [] for in @banners << ["xlarge"] end end |
#xlarge_thumbnails ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/GuideboxWrapper/movie/movie.rb', line 88 def xlarge_thumbnails xlg_thumbnails ||= [] for thumbnail in @thumbnails xlg_thumbnails << thumbnail["xlarge"] end xlg_thumbnails end |