/tmdby

Topic fork of tmdby, for bugfixes.

Primary LanguageRubyMIT LicenseMIT

work in progress

TMDBY : a Ruby wrapper for the TMDB API

Features

  • Full integration of all the TMDB API

Installation

Add this line to your application's Gemfile:

gem 'tmdby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tmdby

How to use

Every API is encapsulated in its own ruby class. For example, the Movie API is in lib/wrappers/movie.rb

Configuration

Set up your api key :

Tmdby::Setup.key = "your_api_key"

By default, every call to TMDB Api is set in insecure mode (HTTP). If you want to enable HTTPS :

Tmdby::Setup.secure = true

If you want, you can set a default language value :

Tmdby::Setup.default_language = "fr"

Example of use

  • Get Movie by id :
Tmdby::Movies.get 550
  • Find by IMDB id :
Tmdby::Find.get "tt0266543", 'imdb_id', language:'es'
  • Discover Movies by criterias :
Tmdby::Discover.movie year: 1994, with_cast: 1269

You can take a look in the tests directory to view a lot of examples.

Helpers

todo

Running tests

First you have to enter your credentials (API_KEY, ACCOUNT_ID, USERNAME and PASSWORD) in tests/credentials.rb

Then you can run the test suite :

% ruby tests/minitest_all.rb

Run options: --seed 60805

# Running:

.......................................................S...................................................................S.

Finished in 53.308930s, 2.3448 runs/s, 16.0573 assertions/s.

125 runs, 856 assertions, 0 failures, 0 errors, 2 skips

You have skipped tests. Run with --verbose for details.

More to come

  • callback parameter support
  • images helpers

Contributing

  1. Fork it ( https://github.com/a-legrand/tmdby/fork )
  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 a new Pull Request