Class: TomatoPower::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/tomato_power/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



11
12
13
# File 'lib/tomato_power/client.rb', line 11

def initialize 
  @api = TomatoPower::api
end

Instance Method Details

#search_by_id(movie_id) ⇒ Object

Note:

As of Rotten Tomatoes API v1.0,they only support ID look up via IMDB ids.

Searches for a movie by IMDB id.

Parameters:

  • movie_id (String)

    movie’s id



38
39
40
41
42
43
# File 'lib/tomato_power/client.rb', line 38

def search_by_id(movie_id)
  options = {}
  options[:type] = 'imdb' 
  options[:id] = movie_id
  @api.movie_alias(options)
end

#search_by_title(movie_title, options = {}) ⇒ Object

Note:

See / Rotten Tomatoes API for possible options.

Searches for a movie by title.

Parameters:

  • movie_title (String)

    The movie title to search for

  • options (Hash) (defaults to: {})

    An optional hash for passing options to the API.



30
31
32
33
# File 'lib/tomato_power/client.rb', line 30

def search_by_title(movie_title, options={})
  options[:q] = movie_title
  @api.movies_search(options)
end