0.03
No commit activity in last 3 years
No release in over 3 years
An ActiveRecord-style API wrapper for RottenTomatoes.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
~> 2.0.0.beta.22
>= 1.6.2

Runtime

>= 0
 Project Readme

rottentomatoes ¶ ↑

rottentomatoes is an ActiveRecord-style API wrapper for RottenTomatoes.com. rottentomatoes is designed to make common tasks much easier than they would be if dealing directly with the URL based API.

Installation¶ ↑

gem install rottentomatoes

Example¶ ↑

require 'rubygems'
require 'rottentomatoes'
include RottenTomatoes

# setup your API key
Rotten.api_key = "t478f8de5776c799de5a"

@movie = RottenMovie.find(:title => "Fight Club", :limit => 1)
# => <OpenStruct>

@movie = RottenMovie.find(:imdb => 137523)
# => <OpenStruct>

@movie.title
# => "Fight Club"

@movie.ratings.critics_score
# => 81

@movie.synopsis
# => "An office employee and a soap salesman build a global organization to help vent male aggression."

Usage¶ ↑

RottenTomatoes provides two main object that you will use to query the API.

RottenMovie
RottenList

These objects provide access to movies and lists of movies respectively.

Each object provides a find() method which accepts a number of options:

RottenMovie.find(:id => 123, :title => "Fight Club", :limit => 10, :expand_results => true)
:id

specifies an individual movie via it’s RottenTomatoes id

:imdb

specifies an individual movie via it’s IMDb id

:title

specifies a query string to look for in the movie titles

:limit

specifies the maximum number of results to be returned

:expand_results

The RottenTomatoes API by default returns only partial info for any API method that can return multiple results, or single movie lookups. When :expand_results is set to true rottentomatoes automatically makes extra API calls to fetch the full information for each item, such as the full cast and reviews. This can result in very slow requests though. If you need extra information for a search listing then set this to true. Defaults to ‘false’. On average the overhead of the extra lookups takes 4x longer to return info.

RottenList.find(:type => "upcoming", :limit => 10, :expand_results => true)
:type

specifies a list type to retrieve. Valid options are ‘box_office’, ‘in_theaters’, ‘opening’, ‘upcoming’, ‘new_releases’, ‘top_rentals’.

:limit

see RottenMovie

:expand_results

see RottenMovie

Usage Examples¶ ↑

Find all movies whose titles match a given string:

@movies = RottenMovie.find(:title => 'Iron Man')

Find the movie most likely to be associated with a given title:

@movie = RottenMovie.find(:title => 'Sin City', :limit => 1)

Find a single movie by its RottenTomatoes ID:

@movie = RottenMovie.find(:id => 13153)

Find a single movie by its IMDb ID:

@movie = RottenMovie.find(:imdb => 137523)

Find a single movie and all associated information

@movie = RottenMovie.find(:title => 'Fight Club', :expand_results => true, :limit => 1)

Find movies that are playing in theatres

@movie = RottenList.find(:type => 'in_theaters')

Item information¶ ↑

To find out more about the information each object offers on retrieved items have a look at the RottenTomatoes API Docs. For the most accurate information about the information available have a look at the data directly through rottentomatoes by calling @item.raw_data.inspect

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history.

  • Send me a pull request.

Author & Credits¶ ↑

Author

Nicholas Munson

Credits

Aaron Gough

Copyright © 2011 Nicholas Munson (nmunson.com), released under the MIT license