Class: RottenTomatoes::RottenMovie
- Inherits:
-
Object
- Object
- RottenTomatoes::RottenMovie
- Defined in:
- lib/rottentomatoes/rotten_movie.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find(options) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/rottentomatoes/rotten_movie.rb', line 5 def self.find() raise ArgumentError, "You must search by title, id or imdb id" if ([:title].nil? && [:id].nil? && [:imdb].nil?) results = [] results << Rotten.api_call([:imdb].nil? ? "movies" : "movie_alias", ) return Rotten.process_results(results, ) end |
.new(raw_data, expand_results = false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rottentomatoes/rotten_movie.rb', line 14 def self.new(raw_data, = false) if ( && !(raw_data)) raw_data = Rotten.api_call("movies", :id => raw_data["id"]) if !raw_data["links"].nil? reviews = Rotten.api_call("direct", raw_data["links"]["reviews"]) if (!raw_data["links"]["reviews"].nil?) cast = Rotten.api_call("direct", raw_data["links"]["cast"]) if (!raw_data["links"]["cast"].nil?) raw_data = raw_data.merge(reviews) if (!reviews.nil?) raw_data = raw_data.merge(cast) if (!cast.nil?) end end return Rotten.data_to_object(raw_data) end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 |
# File 'lib/rottentomatoes/rotten_movie.rb', line 28 def ==(other) return false unless (other.is_a?(RottenMovie)) return @raw_data == other.raw_data end |