Module: TomatoPower

Defined in:
lib/tomato_power.rb,
lib/tomato_power/client.rb,
lib/tomato_power/api/api.rb,
lib/tomato_power/version.rb,
lib/tomato_power/movie/clip.rb,
lib/tomato_power/movie/actor.rb,
lib/tomato_power/movie/movie.rb,
lib/tomato_power/movie/poster.rb,
lib/tomato_power/movie/review.rb,
lib/tomato_power/api/api_service.rb,
lib/tomato_power/helpers/parsers.rb,
lib/tomato_power/api/tomato_methods.rb

Defined Under Namespace

Modules: Parser Classes: API, APIService, Actor, Client, Clip, Movie, Poster, Review

Constant Summary collapse

VERSION =
"0.1.4"
TOMATO_METHODS =

List of urls and whitelist of allowed API methods for the corresponding RottenTomatoes API call.

rotten_tomatoes_api_method => 
{ 
   :url => "resource_url", 
   :whitelist => [allowed options] 
}

{
  :movies_search => 
  {
    :url       => "/movies.json?",
    :whitelist => [:q, :page, :page_limit],
  },
  :box_office_movies => 
  {
    :url       => "movies/box_office.json?",
    :whitelist => [:limit, :country]
  },
    :in_theaters_movies => 
  {
    :url       => "movies/in_theaters.json?",
    :whitelist => [:page, :page_limit, :country]
  },
    :opening_movies => 
  {
    :url       => "movies/opening.json?",
    :whitelist => [:limit, :country]
  },
    :upcoming_movies => 
  {
    :url       => "movies/upcoming.json?",
    :whitelist => [:page, :page_limit, :country]
  },
    :top_rentals => 
  { 
    :url       => "dvds/top_rentals.json?",
    :whitelist => [:limit, :country]
  },
    :current_release_dvds => 
  {
    :url       => "dvds/current_releases.json?",
    :whitelist => [:page, :page_limit,:country]
  }, 
    :new_release_dvds => 
  {
    :url       => "dvds/new_releases.json?",
    :whitelist => [:page, :page_limit, :country]
  },
    :upcoming_dvds => 
  {
    :url       => "dvds/upcoming.json?",
    :whitelist => [:page, :page_limit, :country]
  },
    :movie_info => 
  {
    :url       => ".json?",
    :whitelist => [:movie_id]
  },
    :movie_cast => 
  {
    :url       => "/cast.json?",
    :whitelist => [:movie_id]
  },
    :movie_clips => 
  {
    :url       => "/clips.json?",
    :whitelist => [:movie_id]
  },
    :movie_reviews => 
  {
    :url       => "/reviews.json?",
    :whitelist => [:movie_id, :review_type, :page_limit, :page, :country]
  },
    :movie_similar => 
  {
    :url       => "/similar.json?",
    :whitelist => [:movie_id, :limit]
  },
    :movie_alias => 
  {
    :url       => "/movie_alias.json?",
    :whitelist => [:type, :id]
  },
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



27
28
29
# File 'lib/tomato_power.rb', line 27

def api
  @api
end

Class Method Details

.new(api_key = ENV.fetch("ROTTEN_TOMATOES_API_KEY")) ⇒ Object

Handles Rotten Tomatoes API key assignment and creates a new client for the end user.



19
20
21
22
# File 'lib/tomato_power.rb', line 19

def self.new api_key=ENV.fetch("ROTTEN_TOMATOES_API_KEY")
  self.api = API.new api_key
  Client.new 
end