Skip to content

mr-wildcard/rotten-node

Repository files navigation

Simple, promise based, client for Rotten Tomatoes API.

Build Status

Installation

Using Yarn :

$ yarn add rotten-node

Or npm :

$ npm i --save rotten-node

Usage

import RT from 'rotten-node';

var api = new RT({ apiKey: YOUR_API_KEY });

api.movie(12989).infos() // <- promise
  .then(result => console.log(result))
  .catch(error => console.error('An error occured while getting movie infos : %s', error));

Available methods :

// List movies
api.lists.movies.boxOffice();
api.lists.movies.inTheaters();
api.lists.movies.opening();
api.lists.movies.upcoming();

// List DVDs
api.lists.dvds.topRentals();
api.lists.dvds.currentReleases();
api.lists.dvds.newReleases();
api.lists.dvds.upcoming();

// Movie infos
const movieRequest = api.movie(MOVIE_ID);

movieRequest.infos();
movieRequest.cast();
movieRequest.clips();
movieRequest.reviews();
movieRequest.similar();
movieRequest.alias();

// Search
api.search(words, params, callback = null);

Passing params to queries : (available params)

api.lists.movies.boxOffice({
  limit: 16,
  country: 'us'
});

Using callback :

api.lists.movies.boxOffice(null, function(error, result) {
  // jawad here
});

Develop

$ yarn dev

Build

$ yarn build

Test

$ yarn test