Project

tmdb-api

0.01
No commit activity in last 3 years
No release in over 3 years
The Movie Database API v3
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
>= 0
~> 3.1.0

Runtime

~> 0.13.0
 Project Readme

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:

  • language - ISO 639-1 code.

The available attributes are: id, adult, backdrop_path, belongs_to_collection, budget, genres, homepage, imdb_id, original_title, overview, popularity, poster_path, production_companies, runtime, production_countries, release_date, revenue, spoken_languages, status, tagline, title, vote_average, vote_count.

Search movies

Search for movies by title.

TMDb::Movie.search('Forrest')

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

Optional parameters:

  • page - Minimum 1, maximum 1000.
  • language - ISO 639-1 code.
  • include_adult - Toggle the inclusion of adult titles. Expected value is: true or false.
  • year - Filter the results release dates to matches that include this value.
  • primary_release_year - Filter the results so that only the primary release dates have this value.
  • search_type - By default, the search type is 'phrase'. This is almost guaranteed the option you will want. It's a great all purpose search type and by far the most tuned for every day querying. For those wanting more of an "autocomplete" type search, set this option to 'ngram'.

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:

  • country - ISO 3166-1 code.

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_known_as, biography birthday, deathday, homepage, place_of_birth, profile_path, popularity, imdb_id.

Search people

Search for people by name.

TMDb::Person.search('Paul')

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

Optional parameters:

  • page - Minimum 1, maximum 1000.
  • include_adult - Toggle the inclusion of adult titles. Expected value is: true or false.

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:

  • page - Minimum 1, maximum 1000.

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:

  • page - Minimum 1, maximum 1000.
  • start_date - YYYY-MM-DD.
  • end_date - YYYY-MM-DD.

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.