tmdb
Simple ruby wrapper for The MovieDB based on HTTParty (starting to transform into more of an abstraction than a wrapper: http://wynnnetherland.com/journal/what-makes-a-good-api-wrapper)
Installation
tmdb is hosted at rubygems.org
gem install tmdb
Compatability
I wrote this gem while using ruby 2.0.0, I haven't tested compatability with other versions.
API Coverage
Current available:
- API
- ::api_key=
- ::config
- ::genres(source)
- Movie
- ::search
- ::advanced_search
- ::id
- ::imdb_id
- ::popular
- #poster(size)
- #backdrop(size)
- TV
Todo:
Examples
API
require 'tmdb'
TMDB::API.api_key = "YOUR_API_KEY"
TMDB::API.config
TMDB::API.genres
TMDB::API.genres("tv")
Movies
Class Methods
::search
movies = TMDB::Movie.search('the matrix')
backdrop_path="/yQeEMjnBOIAtFqIuEphyesH0a6y.jpg"
id=603
original_title="The Matrix"
popularity=5.06402605254135
poster_path="/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg"
release_date="1999-03-30"
title="The Matrix"
vote_average=7.5
vote_count=3773>
movies.first.title
::advanced_search
movies = TMDB::Movie.advanced_search('release_date.gte' => '2014-01-01',
'release_date.lte' => (Time.now.strftime("%Y-%m-%d")),
primary_release_year: 2014)
::id
movie = TMDB::Movie.id(603)
backdrop_path="/yQeEMjnBOIAtFqIuEphyesH0a6y.jpg"
...
budget=63000000
genres=>
[{ id=28 name="Action",
id=12 name="Adventure",
id=878 name="Science Fiction",
id=53 name="Thriller" {}]
homepage="http://www.warnerbros.com/movies/home-entertainment/the-matrix/37313ac7-9229-474d-a423-44b7a6bc1a54.html"
...
id=603
imdb_id="tt0133093"
::imdb_id
movie = TMDB::Movie.imdb_id('tt0133093')
```ruby
# Use .popular to final recent popular movies (according to The Movie Database)
movies = TMDB::Movie.popular
# => Array of <TMDB:Movie>s
Instance Methods
#poster
TMDB::Movie.id(550).poster
#backdrop
TMDB::Movie.id(550).backdrop('w300')
TV
Class Methods
::search
TMDB::TV.search(query: 'walking dead')
"created_by"=>
[{"id"=>4027,
"name"=>"Frank Darabont",
"profile_path"=>"/fLKzpG3J88lPr8y8dCJbcFKN6iX.jpg"}],
"episode_run_time"=>[60, 45],
"first_air_date"=>"2010-10-31",
"genres"=>
[{"id"=>18, "name"=>"Drama"},
{"id"=>27, "name"=>"Horror"},
{"id"=>53, "name"=>"Thriller"}],
"homepage"=>"http://www.amctv.com/shows/the-walking-dead/",
"id"=>1402,
"in_production"=>true,
"languages"=>["en"],
"last_air_date"=>"2014-03-30",
"name"=>"The Walking Dead" ...>
More Examples
You can look through the tests for more examples
Usage
TODO
tmdb is a work in progress and isn't really usable at the moment. It's my first gem so I'm going to take some time working on it
Testing
Make sure to create an 'api_key' file at 'test/api_key' in order to run the tests. I'll work offline testing into the gem later.
Copyright
Copyright © 2014 Cody Barr. See LICENSE.md for
further details.