ThetvdbApi
thetvdb_api is a simple ruby client for accessing TV shows information from the thetvdb.com API.
Getting started
You can add it to your Gemfile with:
gem 'thetvdb_api'
Run the bundle command to install it.
After you install ThetvdbApi and add it to your Gemfile, you need to run the generator (if you use Ruby on Rails application):
rails generate thetvdb_api:install
The generator will install an initializer where you must past your api_key, and can past: language (2 letters abbrevation).
How to use
There is one entry point, in initialize you can past hash with api_key and language values, or leave empty:
client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
Search series by name
client = ThetvdbApi::Client.new
client.search.get_series('buffy', = {})
client.search.get_series_url('buffy', = {}) # return only full url
client.search.get_series_by_imdb_id(id, = {})
client.search.get_series_by_imdb_id_url(id, = {}) # return only full url
client.search.get_series_by_zap2it_id(id)
client.search.get_series_by_zap2it_id_url(id, = {}) # return only full url
client.search.get_episode('123', air_date, = {})
client.search.get_episode_url('123', air_date, = {}) # return only full url
Search series by id
client = ThetvdbApi::Client.new
client.series.find('123', = {})
client.series.find_url('123', = {}) # return only full url
client.series.find_full('123', = {})
client.series.find_full_url('123', = {}) # return only full url
Return series actors
client = ThetvdbApi::Client.new
client.actor.all(series_id, = {})
client.actor.all_url(series_id, = {}) # return only full url
Return series banners
client = ThetvdbApi::Client.new
client..all(series_id, = {})
client..all_url(series_id, = {}) # return only full url
Return series episode
client = ThetvdbApi::Client.new
client.episode.find_by_default_order(series_id, season, episode, = {})
client.episode.find_by_default_order_url(series_id, season, episode, = {}) # return only full url
client.episode.find_by_dvd_order(series_id, season, episode, = {})
client.episode.find_by_dvd_order_url(series_id, season, episode, = {}) # return only full url
client.episode.find_by_absolute_order(series_id, absolute, = {})
client.episode.find_by_absolute_order_url(series_id, absolute, = {}) # return only full url
client.episode.find(episode_id, = {})
client.episode.find_url(episode_id, = {}) # return only full url
Get updates
client = ThetvdbApi::Client.new
client.update.day( = {})
client.update.day_url( = {}) # return only full url
client.update.week( = {})
client.update.week_url( = {}) # return only full url
client.update.month( = {})
client.update.month_url( = {}) # return only full url
client.update.all( = {})
client.update.all_url( = {}) # return only full url
ThetvdbApi default return response class with pure xml (in body method) string fetched by Faraday. You can pass
mapping: true
options, and ThetvdbApi will return hash/array objects.
ThetvdbApi give you chance to write own mapper where mapping preformance could be better.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request




