andrielfn / tmdb-api

Ruby wrapper for the The Movie Database API v3
MIT License
14 stars 4 forks source link

The Movie Database API

Build Status Code Climate

A simple Ruby wrapper for the The Movie Database API v3.

About the TMDb API documentation and everything else you can se here: http://docs.themoviedb.apiary.io/.

Installation

Add this line to your application's Gemfile:

gem 'tmdb-api'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install tmdb-api

API Key

First of all, you need set your API Key provided by TMDb.

TMDb.api_key = '56565958363476674e5e63643c787867'

Also it's possible set the API in the TMDB_API_KEY environment variable:

$ export TMDB_API_KEY='56565958363476674e5e63643c787867'

Usage

Find a movie by id

Get the basic movie information for a specific movie id.

TMDB::Movie.find(24)

TMDB::Movie.find(603, language: 'pt')

Optional parameters:

The available attributes are: id, adult, _backdroppath, _belongs_tocollection, budget, genres, homepage, _imdbid, _originaltitle, overview, popularity, _posterpath, _productioncompanies, runtime, _productioncountries, _releasedate, revenue, _spokenlanguages, status, tagline, title, _voteaverage, _votecount.

Search movies

Search for movies by title.

TMDb::Movie.search('Forrest')

TMDb::Movie.search('wall e', year: 2003)

Optional parameters:

Alternative titles

Get the alternative titles for a specific movie id.

TMDB::Movie.alternative_titles(598)

TMDB::Movie.alternative_titles(598, country: 'br')

Optional parameters:

Cast

Get the cast for a specific movie id.

TMDb::Movie.cast(550)

TMDb::Movie.cast(550, language: 'pt')

Crew

Get the crew for a specific movie id.

TMDb::Movie.crew(550)

TMDb::Movie.crew(550, language: 'fr')

Movie images

Get the images (posters and backdrops) for a specific movie id.

TMDb::Movie.images(598)

TMDb::Movie.images(598, language: 'pt')

Movie keywords

Get the plot keywords for a specific movie id.

TMDb::Movie.keywords(68721)

Movie trailers

Get the trailers for a specific movie id.

TMDb::Movie.trailers(68721)

Movie releases

Get the release date by country for a specific movie id.

TMDb::Movie.releases(68721)

Upcoming movies

Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.

TMDb::Movie.upcoming

Find a person by id

Get the basic person information for a specific person id.

TMDB::Person.find(138)

Available attributes: id, name, adult, _also_knownas, biography birthday, deathday, homepage, _place_ofbirth, _profilepath, popularity, _imdbid.

Search people

Search for people by name.

TMDb::Person.search('Paul')

TMDb::Person.search('Paul', page: 4)

Optional parameters:

Person images

Gets the images for a specific person id.

TMDb::Person.images(138)

Popular people

Gets a list of popular people. This list refreshes every day.

TMDb::Person.popular

Optional parameters:

Changes

Movie changes

Get a list of movie ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14.

TMDb::Changes.movies

TMDb::Changes.movies(page: 1, start_date: '2013-03-22')

Optional parameters:

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create new Pull Request.