Module: Tvdb2::API
- Included in:
- Client
- Defined in:
- lib/tvdb2/api.rb
Overview
Missing endpoints are:
-
Series
-
filter:
GET /series/{id}/filter
-
-
Updates
-
updadad:
GET /updated/query
-
-
Users
-
user:
GET /user
-
favorites:
GET /user/favorites
-
delete favorites:
DELETE /user/favorites/{id}
-
add favorites:
PUT /user/favorites/{id}
-
ratings:
GET /user/ratings
-
ratings with query:
GET /user/ratings/query
-
delete rating:
DELETE /user/ratings/{itemType}/{itemId}
-
add rating:
PUT /user/ratings/{itemType}/{itemId}/{itemRating}
-
Methods in this module wrap the TVDB api endpoints.
Instance Method Summary collapse
-
#actors(id) ⇒ Array<TvdbStruct>
Perform a request to the endpoint
GET /series/{id}/actors
. -
#best_search(name) ⇒ Series
The series that best match the
name
passed as parameter. -
#episode(id) ⇒ Episode
Perform a request to the endpoint
GET /episodes/{id}
. -
#episodes(id, params = {}) ⇒ Array<Episode>
Perform a request to the endpoint
GET /series/{id}/episodes
. -
#images(id, params) ⇒ Array<TvdbStruct>
Perform a request to the endpoint
GET /series/{id}/images/query
. -
#images_summary(id) ⇒ Array<TvdbStruct>
Perform a request to the endpoint
GET /series/{id}/images
. -
#language(id) ⇒ TvdbStruct
Perform a request to the endpoint
GET /languages/{id}
. -
#languages ⇒ Array<TvdbStruct>
Perform a request to the endpoint
GET /languages
. -
#search(params) ⇒ Array<Series>
Perform a request to the endpoint
GET /search/series
. -
#series(id) ⇒ Series
Perform a request to the endpoint
GET /series/{id}
. -
#series_summary(id) ⇒ TvdbStruct
Perform a request to the endpoint
GET /series/{id}/episodes/summary
.
Instance Method Details
#actors(id) ⇒ Array<TvdbStruct>
Perform a request to the endpoint GET /series/{id}/actors
.
114 115 116 |
# File 'lib/tvdb2/api.rb', line 114 def actors(id) build_array_result("/series/#{id}/actors") end |
#best_search(name) ⇒ Series
Returns the series that best match the name
passed as
parameter.
58 59 60 61 62 63 |
# File 'lib/tvdb2/api.rb', line 58 def best_search(name) results = search(name: name) chosen = results.select{|x| x.seriesName.downcase == name.downcase}.first chosen ||= results.select{|x| x.aliases.map(&:downcase).include?(name.downcase)}.first return chosen || results.first end |
#episode(id) ⇒ Episode
Perform a request to the endpoint GET /episodes/{id}
.
123 124 125 |
# File 'lib/tvdb2/api.rb', line 123 def episode(id) build_object_result("/episodes/#{id}", {}, Episode) end |
#episodes(id, params = {}) ⇒ Array<Episode>
Perform a request to the endpoint GET /series/{id}/episodes
.
101 102 103 104 105 106 107 |
# File 'lib/tvdb2/api.rb', line 101 def episodes(id, params = {}) if params.nil? || params.empty? build_array_result("/series/#{id}/episodes", {}, Episode) else build_array_result("/series/#{id}/episodes/query", params, Episode) end end |
#images(id, params) ⇒ Array<TvdbStruct>
Perform a request to the endpoint GET
/series/{id}/images/query
.
148 149 150 |
# File 'lib/tvdb2/api.rb', line 148 def images(id, params) build_array_result("/series/#{id}/images/query", params) end |
#images_summary(id) ⇒ Array<TvdbStruct>
Perform a request to the endpoint GET /series/{id}/images
.
133 134 135 |
# File 'lib/tvdb2/api.rb', line 133 def images_summary(id) build_object_result("/series/#{id}/images") end |
#language(id) ⇒ TvdbStruct
Perform a request to the endpoint GET /languages/{id}
.
39 40 41 |
# File 'lib/tvdb2/api.rb', line 39 def language(id) build_object_result("/languages/#{id}") end |
#languages ⇒ Array<TvdbStruct>
Perform a request to the endpoint GET /languages
.
30 31 32 |
# File 'lib/tvdb2/api.rb', line 30 def languages build_array_result('/languages') end |
#search(params) ⇒ Array<Series>
Perform a request to the endpoint GET /search/series
.
51 52 53 |
# File 'lib/tvdb2/api.rb', line 51 def search(params) build_array_result('/search/series', params, Series) end |
#series(id) ⇒ Series
Perform a request to the endpoint GET /series/{id}
.
71 72 73 |
# File 'lib/tvdb2/api.rb', line 71 def series(id) build_object_result("/series/#{id}", {}, Series) end |
#series_summary(id) ⇒ TvdbStruct
Perform a request to the endpoint GET
/series/{id}/episodes/summary
.
81 82 83 |
# File 'lib/tvdb2/api.rb', line 81 def series_summary(id) build_object_result("/series/#{id}/episodes/summary") end |