Class: TVDBApi
- Inherits:
-
Object
- Object
- TVDBApi
- Defined in:
- lib/tvdb_api/tvdb_api.rb
Constant Summary collapse
- BASE_URL =
'https://api4.thetvdb.com'- COMMON_PARAMS =
{ meta: 'translations', short: 'false' }.freeze
- ENDPOINTS =
{ search: '/v4/search', movie: '/v4/movies/%{id}/extended', series: '/v4/series/%{id}/extended', person: '/v4/people/%{id}/extended' }.freeze
- DEFAULT_PARAMS =
{ movie: COMMON_PARAMS, series: COMMON_PARAMS }.freeze
Instance Method Summary collapse
-
#initialize ⇒ TVDBApi
constructor
A new instance of TVDBApi.
- #movie(id) ⇒ Object
- #person(id) ⇒ Object
- #search(query) ⇒ Object
- #search_by_type(query, type) ⇒ Object
- #series(id) ⇒ Object
Constructor Details
#initialize ⇒ TVDBApi
Returns a new instance of TVDBApi.
22 23 24 25 |
# File 'lib/tvdb_api/tvdb_api.rb', line 22 def initialize register_middleware setup_connection end |
Instance Method Details
#movie(id) ⇒ Object
35 36 37 |
# File 'lib/tvdb_api/tvdb_api.rb', line 35 def movie(id) request(:movie, id: id) end |
#person(id) ⇒ Object
43 44 45 |
# File 'lib/tvdb_api/tvdb_api.rb', line 43 def person(id) request(:person, id: id) end |
#search(query) ⇒ Object
27 28 29 |
# File 'lib/tvdb_api/tvdb_api.rb', line 27 def search(query) request(:search, query: query) end |
#search_by_type(query, type) ⇒ Object
31 32 33 |
# File 'lib/tvdb_api/tvdb_api.rb', line 31 def search_by_type(query, type) request(:search, query: query, type: type) end |
#series(id) ⇒ Object
39 40 41 |
# File 'lib/tvdb_api/tvdb_api.rb', line 39 def series(id) request(:series, id: id) end |