Class: BadFruit::Movie
- Inherits:
-
Object
- Object
- BadFruit::Movie
- Defined in:
- lib/badfruit/Movies/movie.rb
Instance Attribute Summary collapse
-
#cast ⇒ Object
Returns the value of attribute cast.
-
#directors ⇒ Object
Returns the value of attribute directors.
-
#genres ⇒ Object
Returns the value of attribute genres.
-
#id ⇒ Object
Returns the value of attribute id.
-
#links ⇒ Object
Returns the value of attribute links.
-
#mpaa_rating ⇒ Object
Returns the value of attribute mpaa_rating.
-
#name ⇒ Object
Returns the value of attribute name.
-
#posters ⇒ Object
Returns the value of attribute posters.
-
#release_dates ⇒ Object
Returns the value of attribute release_dates.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#scores ⇒ Object
Returns the value of attribute scores.
-
#synopsis ⇒ Object
Returns the value of attribute synopsis.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#full_cast ⇒ Object
returns an array of Actor objects.
- #info ⇒ Object
-
#initialize(movieHash, badfruit) ⇒ Movie
constructor
A new instance of Movie.
-
#reviews ⇒ Object
returns an array of Review objects.
Constructor Details
#initialize(movieHash, badfruit) ⇒ Movie
Returns a new instance of Movie.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/badfruit/Movies/movie.rb', line 6 def initialize(movieHash, badfruit) @id = movieHash["id"] @name = movieHash["title"] @year = movieHash["year"] @genres = movieHash["genres"] @mpaa_rating = movieHash["mpaa_rating"] @runtime = movieHash["runtime"] @release_dates = movieHash["release_dates"] @synopsis = movieHash["synopsis"] @cast = movieHash["abridged_cast"] @directors = movieHash["abridged_directors"] @links = movieHash["links"] @scores = Scores.new(movieHash["ratings"]) #single score object containing two scores @posters = Posters.new(movieHash["posters"]) #single posters object containing four poster urls @badfruit = badfruit @moviehash = movieHash end |
Instance Attribute Details
#cast ⇒ Object
Returns the value of attribute cast.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def cast @cast end |
#directors ⇒ Object
Returns the value of attribute directors.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def directors @directors end |
#genres ⇒ Object
Returns the value of attribute genres.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def genres @genres end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def id @id end |
#links ⇒ Object
Returns the value of attribute links.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def links @links end |
#mpaa_rating ⇒ Object
Returns the value of attribute mpaa_rating.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def @mpaa_rating end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def name @name end |
#posters ⇒ Object
Returns the value of attribute posters.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def posters @posters end |
#release_dates ⇒ Object
Returns the value of attribute release_dates.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def release_dates @release_dates end |
#runtime ⇒ Object
Returns the value of attribute runtime.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def runtime @runtime end |
#scores ⇒ Object
Returns the value of attribute scores.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def scores @scores end |
#synopsis ⇒ Object
Returns the value of attribute synopsis.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def synopsis @synopsis end |
#year ⇒ Object
Returns the value of attribute year.
3 4 5 |
# File 'lib/badfruit/Movies/movie.rb', line 3 def year @year end |
Instance Method Details
#full_cast ⇒ Object
returns an array of Actor objects
25 26 27 |
# File 'lib/badfruit/Movies/movie.rb', line 25 def full_cast return @badfruit.parse_actors_array(JSON.parse(@badfruit.get_movie_info(@id, "cast"))) end |
#info ⇒ Object
39 40 41 |
# File 'lib/badfruit/Movies/movie.rb', line 39 def info @moviehash end |
#reviews ⇒ Object
returns an array of Review objects
30 31 32 33 34 35 36 37 |
# File 'lib/badfruit/Movies/movie.rb', line 30 def reviews data = JSON.parse(@badfruit.get_movie_info(@id, "reviews")) reviews = Array.new data["reviews"].each do |review| reviews.push(Review.new(review)) end return reviews end |