thetvdb_api 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/CHANGELOG.md +5 -1
- data/README.md +15 -4
- data/lib/thetvdb_api/actor.rb +29 -12
- data/lib/thetvdb_api/attributes_mapping/search/get_episode.rb +6 -0
- data/lib/thetvdb_api/attributes_mapping/search/get_series.rb +6 -0
- data/lib/thetvdb_api/attributes_mapping/search/get_series_by_remote_id.rb +7 -0
- data/lib/thetvdb_api/banner.rb +29 -12
- data/lib/thetvdb_api/base.rb +0 -24
- data/lib/thetvdb_api/client.rb +4 -0
- data/lib/thetvdb_api/episode.rb +205 -53
- data/lib/thetvdb_api/search.rb +166 -44
- data/lib/thetvdb_api/series.rb +105 -31
- data/lib/thetvdb_api/server.rb +15 -0
- data/lib/thetvdb_api/version.rb +1 -1
- data/lib/thetvdb_api.rb +9 -1
- data/spec/fixtures/server_time.xml +4 -0
- data/spec/functionals/episode_spec.rb +3 -3
- data/spec/functionals/search_spec.rb +9 -9
- data/spec/functionals/series_spec.rb +6 -6
- data/spec/functionals/server_spec.rb +36 -0
- data/spec/integrations/actor_spec.rb +3 -1
- data/spec/integrations/banner_spec.rb +3 -1
- data/spec/integrations/client_spec.rb +54 -11
- data/spec/integrations/episode_spec.rb +11 -3
- data/spec/integrations/search_spec.rb +13 -5
- data/spec/integrations/series_spec.rb +6 -2
- data/spec/integrations/server_spec.rb +16 -0
- data/spec/integrations/update_spec.rb +6 -0
- data/spec/spec_helper.rb +1 -0
- data/thetvdb_api.gemspec +6 -3
- metadata +63 -12
- data/spec/functionals/base_spec.rb +0 -79
data/lib/thetvdb_api/search.rb
CHANGED
@@ -1,40 +1,78 @@
|
|
1
1
|
class ThetvdbApi::Search < ThetvdbApi::Base
|
2
|
+
include Ov
|
3
|
+
|
2
4
|
# Find the series data based on its name.
|
3
5
|
#
|
4
6
|
# access: FREE
|
5
|
-
# param
|
6
|
-
# get_series(
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
7
|
+
# param:
|
8
|
+
# get_series('buffy')
|
9
|
+
# output: Faraday::Response instance with parsed XML string
|
10
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeries
|
11
|
+
let :get_series, String do |seriesname|
|
12
|
+
get_series(name: seriesname)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Find the series data based on its name.
|
16
|
+
#
|
17
|
+
# access: FREE
|
18
|
+
# param:
|
19
|
+
# get_series('buffy', 'de')
|
20
|
+
# output: Faraday::Response instance with parsed XML string
|
21
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeries
|
22
|
+
let :get_series, String, String do |seriesname, language|
|
23
|
+
get_series(name: seriesname, language: language)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Find the series data based on its name.
|
27
|
+
#
|
28
|
+
# access: FREE
|
29
|
+
# param:
|
30
|
+
# get_series(name: 'buffy')
|
10
31
|
# output: Faraday::Response instance with parsed XML string
|
11
32
|
# example: http://thetvdb.com/wiki/index.php/API:GetSeries
|
12
|
-
|
13
|
-
get_series_path_with_params(
|
33
|
+
let :get_series, Hash do |options|
|
34
|
+
get_series_path_with_params(options).get
|
14
35
|
end
|
15
36
|
|
16
37
|
# Find the series data based on its name - return only url.
|
17
38
|
#
|
18
39
|
# access: FREE
|
19
|
-
# param
|
20
|
-
# get_series_url(
|
21
|
-
#
|
22
|
-
|
23
|
-
|
40
|
+
# param:
|
41
|
+
# get_series_url('buffy')
|
42
|
+
# output: url string
|
43
|
+
let :get_series_url, String do |series|
|
44
|
+
get_series_url(name: series)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Find the series data based on its name - return only url.
|
48
|
+
#
|
49
|
+
# access: FREE
|
50
|
+
# param:
|
51
|
+
# get_series_url('buffy', 'de')
|
52
|
+
# output: url string
|
53
|
+
let :get_series_url, String, String do |series, language|
|
54
|
+
get_series_url(name: series, language: language)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Find the series data based on its name - return only url.
|
58
|
+
#
|
59
|
+
# access: FREE
|
60
|
+
# param:
|
61
|
+
# get_series_url(name: 1234)
|
24
62
|
# output: url string
|
25
|
-
|
26
|
-
get_series_path_with_params(
|
63
|
+
let :get_series_url, Hash do |options|
|
64
|
+
get_series_path_with_params(options).url
|
27
65
|
end
|
28
66
|
|
29
67
|
# Find the series data by unique ID's used on other sites.
|
30
68
|
#
|
31
69
|
# access: FREE
|
32
70
|
# param: options hash
|
33
|
-
#
|
34
|
-
#
|
71
|
+
# imdb_id: IMDb ID (don't use with zap2it_id)
|
72
|
+
# zap2_it: Zap2it ID (don't use with imdb_id)
|
35
73
|
# output: Faraday::Response instance with parsed XML string
|
36
74
|
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
37
|
-
|
75
|
+
let :get_series_by_remote_id, Hash do |options|
|
38
76
|
get_series_by_remote_id_path_with_params(options).get
|
39
77
|
end
|
40
78
|
|
@@ -42,10 +80,10 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
42
80
|
#
|
43
81
|
# access: FREE
|
44
82
|
# param: options hash
|
45
|
-
#
|
46
|
-
#
|
83
|
+
# imdb_id: IMDb ID (don't use with zap2it_id)
|
84
|
+
# zap2it_id: Zap2it ID (don't use with imdb_id)
|
47
85
|
# output: url string
|
48
|
-
|
86
|
+
let :get_series_by_remote_id_url, Hash do |options|
|
49
87
|
get_series_by_remote_id_path_with_params(options).url
|
50
88
|
end
|
51
89
|
|
@@ -53,81 +91,157 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
53
91
|
#
|
54
92
|
# access: FREE
|
55
93
|
# param (flat params):
|
56
|
-
# get_series_by_imdb_id(imdb_id)
|
57
94
|
# get_series_by_imdb_id('tt01234')
|
58
95
|
# output: Faraday::Response instance with parsed XML string
|
59
96
|
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
60
|
-
|
61
|
-
get_series_by_remote_id_path_with_params(
|
97
|
+
let :get_series_by_imdb_id, String do |imdb_id|
|
98
|
+
get_series_by_remote_id_path_with_params(imdb_id: imdb_id).get
|
99
|
+
end
|
100
|
+
|
101
|
+
# Find the series data by unique IMDB ID
|
102
|
+
#
|
103
|
+
# access: FREE
|
104
|
+
# param (flat params):
|
105
|
+
# get_series_by_imdb_id('tt01234', 'de')
|
106
|
+
# output: Faraday::Response instance with parsed XML string
|
107
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
108
|
+
let :get_series_by_imdb_id, String, String do |imdb_id, language|
|
109
|
+
get_series_by_remote_id_path_with_params(imdb_id: imdb_id, language: language).get
|
110
|
+
end
|
111
|
+
|
112
|
+
# Find the series data by unique IMDB ID - return only url.
|
113
|
+
#
|
114
|
+
# access: FREE
|
115
|
+
# param (flat params):
|
116
|
+
# get_series_by_imdb_id_url('tt01234')
|
117
|
+
# output: url string
|
118
|
+
let :get_series_by_imdb_id_url, String do |imdb_id|
|
119
|
+
get_series_by_remote_id_path_with_params(imdb_id: imdb_id).url
|
62
120
|
end
|
63
121
|
|
64
122
|
# Find the series data by unique IMDB ID - return only url.
|
65
123
|
#
|
66
124
|
# access: FREE
|
67
125
|
# param (flat params):
|
68
|
-
# get_series_by_imdb_id_url(imdb_id)
|
69
126
|
# get_series_by_imdb_id_url('tt01234')
|
70
127
|
# output: url string
|
71
|
-
|
72
|
-
get_series_by_remote_id_path_with_params(
|
128
|
+
let :get_series_by_imdb_id_url, String, String do |imdb_id, language|
|
129
|
+
get_series_by_remote_id_path_with_params(imdb_id: imdb_id, language: language).url
|
73
130
|
end
|
74
131
|
|
75
132
|
# Find the series data by unique zap2it ID
|
76
133
|
#
|
77
134
|
# access: FREE
|
78
135
|
# param (flat params):
|
79
|
-
# get_series_by_zap2it_id(zap2it_id)
|
80
136
|
# get_series_by_zap2it_id('SH01234')
|
81
137
|
# output: Faraday::Response instance with parsed XML string
|
82
138
|
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
83
|
-
|
84
|
-
get_series_by_remote_id_path_with_params(
|
139
|
+
let :get_series_by_zap2it_id, String do |zap2it_id|
|
140
|
+
get_series_by_remote_id_path_with_params(zap2it_id: zap2it_id).get
|
141
|
+
end
|
142
|
+
|
143
|
+
# Find the series data by unique zap2it ID
|
144
|
+
#
|
145
|
+
# access: FREE
|
146
|
+
# param (flat params):
|
147
|
+
# get_series_by_zap2it_id('SH01234', 'de')
|
148
|
+
# output: Faraday::Response instance with parsed XML string
|
149
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
150
|
+
let :get_series_by_zap2it_id, String, String do |zap2it_id, language|
|
151
|
+
get_series_by_remote_id_path_with_params(zap2it_id: zap2it_id, language: language).get
|
85
152
|
end
|
86
153
|
|
87
154
|
# Find the series data by unique zap2it ID - return only url.
|
88
155
|
#
|
89
156
|
# access: FREE
|
90
157
|
# param: options hash
|
91
|
-
# get_series_by_zap2it_id_url(zap2it_id)
|
92
158
|
# get_series_by_zap2it_id_url('SH01234')
|
93
159
|
# output: url string
|
94
|
-
|
95
|
-
get_series_by_remote_id_path_with_params(
|
160
|
+
let :get_series_by_zap2it_id_url, String do |zap2it_id|
|
161
|
+
get_series_by_remote_id_path_with_params(zap2it_id: zap2it_id).url
|
96
162
|
end
|
97
163
|
|
164
|
+
# Find the series data by unique zap2it ID - return only url.
|
165
|
+
#
|
166
|
+
# access: FREE
|
167
|
+
# param: options hash
|
168
|
+
# get_series_by_zap2it_id_url('SH01234', 'de')
|
169
|
+
# output: url string
|
170
|
+
let :get_series_by_zap2it_id_url, String, String do |zap2it_id, language|
|
171
|
+
get_series_by_remote_id_path_with_params(zap2it_id: zap2it_id, language: language).url
|
172
|
+
end
|
98
173
|
|
99
174
|
# Find the episode data by episode air date.
|
100
175
|
#
|
101
176
|
# access: FREE
|
102
177
|
# param (flat params):
|
103
|
-
# get_episode(series_id, air date)
|
104
178
|
# get_episode(1234, '2000-01-01')
|
179
|
+
# output: Faraday::Response instance with parsed XML string
|
180
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetEpisodeByAirDate
|
181
|
+
let :get_episode, Any, String do |series_id, air_date|
|
182
|
+
get_episode(series_id: series_id, air_date: air_date)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Find the episode data by episode air date.
|
186
|
+
#
|
187
|
+
# access: FREE
|
188
|
+
# param (flat params):
|
189
|
+
# get_episode(1234, '2000-01-01', 'de')
|
190
|
+
# output: Faraday::Response instance with parsed XML string
|
191
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetEpisodeByAirDate
|
192
|
+
let :get_episode, Any, String, String do |series_id, air_date, language|
|
193
|
+
get_episode(series_id: series_id, air_date: air_date, language: language)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Find the episode data by episode air date.
|
197
|
+
#
|
198
|
+
# access: FREE
|
105
199
|
# param (hash params):
|
106
200
|
# get_episode(series_id: 1234, air_date: '2000-01-01')
|
107
201
|
# output: Faraday::Response instance with parsed XML string
|
108
202
|
# example: http://thetvdb.com/wiki/index.php/API:GetEpisodeByAirDate
|
109
|
-
|
110
|
-
get_episode_path_with_params(
|
203
|
+
let :get_episode, Hash do |options|
|
204
|
+
get_episode_path_with_params(options).get
|
111
205
|
end
|
112
206
|
|
113
|
-
|
114
207
|
# Find the episode data by episode air date - return only url.
|
115
208
|
#
|
116
209
|
# access: FREE
|
117
210
|
# param (flat params):
|
118
|
-
# get_episode_url(series_id, air date)
|
119
211
|
# get_episode_url(1234, '2000-01-01')
|
212
|
+
# output: url string
|
213
|
+
let :get_episode_url, Any, String do |series_id, air_date|
|
214
|
+
get_episode_url(series_id: series_id, air_date: air_date)
|
215
|
+
end
|
216
|
+
|
217
|
+
# Find the episode data by episode air date - return only url.
|
218
|
+
#
|
219
|
+
# access: FREE
|
220
|
+
# param (flat params):
|
221
|
+
# get_episode_url(1234, '2000-01-01', 'de')
|
222
|
+
# output: url string
|
223
|
+
let :get_episode_url, Any, String, String do |series_id, air_date, language|
|
224
|
+
get_episode_url(series_id: series_id, air_date: air_date, language: language)
|
225
|
+
end
|
226
|
+
|
227
|
+
# Find the episode data by episode air date - return only url.
|
228
|
+
#
|
229
|
+
# access: FREE
|
120
230
|
# param (hash params):
|
121
231
|
# get_episode_url(series_id: 1234, air_date: '2000-01-01')
|
122
232
|
# output: url string
|
123
|
-
|
124
|
-
get_episode_path_with_params(
|
233
|
+
let :get_episode_url, Hash do |options|
|
234
|
+
get_episode_path_with_params(options).url
|
125
235
|
end
|
126
236
|
|
127
237
|
private
|
128
238
|
|
129
|
-
def get_series_path_with_params(
|
130
|
-
path(get_series_path).params(language_options.merge(
|
239
|
+
def get_series_path_with_params(options)
|
240
|
+
path(get_series_path).params(language_options.merge(get_series_mapped_options(options)))
|
241
|
+
end
|
242
|
+
|
243
|
+
def get_series_mapped_options(options)
|
244
|
+
ThetvdbApi::AttributesMapping::Search::GetSeries.new(options).to_hash
|
131
245
|
end
|
132
246
|
|
133
247
|
def get_series_path
|
@@ -135,15 +249,23 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
135
249
|
end
|
136
250
|
|
137
251
|
def get_series_by_remote_id_path_with_params(options)
|
138
|
-
path(get_series_by_remote_id_path).params(language_options.merge(options))
|
252
|
+
path(get_series_by_remote_id_path).params(language_options.merge(get_serie_by_remote_id_mapped_options(options)))
|
253
|
+
end
|
254
|
+
|
255
|
+
def get_serie_by_remote_id_mapped_options(options)
|
256
|
+
ThetvdbApi::AttributesMapping::Search::GetSeriesByRemoteId.new(options).to_hash
|
139
257
|
end
|
140
258
|
|
141
259
|
def get_series_by_remote_id_path
|
142
260
|
'GetSeriesByRemoteID.php'
|
143
261
|
end
|
144
262
|
|
145
|
-
def get_episode_path_with_params(
|
146
|
-
path(get_episode_path).params(api_key_with_language_options.merge(
|
263
|
+
def get_episode_path_with_params(options)
|
264
|
+
path(get_episode_path).params(api_key_with_language_options.merge(get_episode_mapped_options(options)))
|
265
|
+
end
|
266
|
+
|
267
|
+
def get_episode_mapped_options(options)
|
268
|
+
ThetvdbApi::AttributesMapping::Search::GetEpisode.new(options).to_hash
|
147
269
|
end
|
148
270
|
|
149
271
|
def get_episode_path
|
data/lib/thetvdb_api/series.rb
CHANGED
@@ -1,73 +1,147 @@
|
|
1
1
|
class ThetvdbApi::Series < ThetvdbApi::Base
|
2
|
+
include Ov
|
3
|
+
|
2
4
|
# Find the series data by series id.
|
3
5
|
#
|
4
6
|
# access: FREE
|
5
|
-
# param
|
6
|
-
# find(series_id)
|
7
|
+
# param:
|
7
8
|
# find(1234)
|
8
|
-
# param (hash params):
|
9
|
-
# find(series_id: 1234)
|
10
9
|
# output: Faraday::Response instance with parsed XML string
|
11
10
|
# example: http://thetvdb.com/wiki/index.php/API:Base_Series_Record
|
12
|
-
|
13
|
-
|
11
|
+
let :find, Any do |id|
|
12
|
+
find(id: id)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Find the series data by series id.
|
16
|
+
#
|
17
|
+
# access: FREE
|
18
|
+
# param:
|
19
|
+
# find(1234, 'de')
|
20
|
+
# output: Faraday::Response instance with parsed XML string
|
21
|
+
# example: http://thetvdb.com/wiki/index.php/API:Base_Series_Record
|
22
|
+
let :find, Any, String do |id, language|
|
23
|
+
find(id: id, language: language)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Find the series data by series id.
|
27
|
+
#
|
28
|
+
# access: FREE
|
29
|
+
# param:
|
30
|
+
# find(id: 1234)
|
31
|
+
# output: Faraday::Response instance with parsed XML string
|
32
|
+
# example: http://thetvdb.com/wiki/index.php/API:Base_Series_Record
|
33
|
+
let :find, Hash do |options|
|
34
|
+
find_path_with_params(options).get
|
14
35
|
end
|
15
36
|
|
16
37
|
# Find the series data by series id - return only url.
|
17
38
|
#
|
18
39
|
# access: FREE
|
19
|
-
# param
|
20
|
-
# find_url(series_id)
|
40
|
+
# param:
|
21
41
|
# find_url(1234)
|
22
|
-
# param (hash params):
|
23
|
-
# find_url(series_id: 1234)
|
24
42
|
# output: url string
|
25
|
-
|
26
|
-
|
43
|
+
let :find_url, Any do |id|
|
44
|
+
find_url(id: id)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Find the series data by series id - return only url.
|
48
|
+
#
|
49
|
+
# access: FREE
|
50
|
+
# param:
|
51
|
+
# find_url(1234, 'de')
|
52
|
+
# output: url string
|
53
|
+
let :find_url, Any do |id, language|
|
54
|
+
find_url(id: id, language: language)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Find the series data by series id - return only url.
|
58
|
+
#
|
59
|
+
# access: FREE
|
60
|
+
# param:
|
61
|
+
# find_url(id: 1234)
|
62
|
+
# output: url string
|
63
|
+
let :find_url, Hash do |options|
|
64
|
+
find_path_with_params(options).url
|
27
65
|
end
|
28
66
|
|
29
67
|
# Find the full series data by series id.
|
30
68
|
#
|
31
69
|
# access: FREE
|
32
|
-
# param
|
33
|
-
# find_full(series_id)
|
70
|
+
# param:
|
34
71
|
# find_full(1234)
|
35
|
-
# param (hash params):
|
36
|
-
# find_full(series_id: 1234)
|
37
72
|
# output: Faraday::Response instance with parsed XML string
|
38
73
|
# example: http://thetvdb.com/wiki/index.php/API:Full_Series_Record
|
39
|
-
|
40
|
-
|
74
|
+
let :find_full, Any do |id|
|
75
|
+
find_full(id: id)
|
41
76
|
end
|
42
77
|
|
43
|
-
# Find the full series data by series id
|
78
|
+
# Find the full series data by series id.
|
79
|
+
#
|
80
|
+
# access: FREE
|
81
|
+
# param:
|
82
|
+
# find_full(1234, 'de')
|
83
|
+
# output: Faraday::Response instance with parsed XML string
|
84
|
+
# example: http://thetvdb.com/wiki/index.php/API:Full_Series_Record
|
85
|
+
let :find_full, Any, String do |id, language|
|
86
|
+
find_full(id: id, language: language)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Find the full series data by series id.
|
44
90
|
#
|
45
91
|
# access: FREE
|
46
|
-
# param
|
47
|
-
#
|
92
|
+
# param:
|
93
|
+
# find_full(id: 1234)
|
94
|
+
# output: Faraday::Response instance with parsed XML string
|
95
|
+
# example: http://thetvdb.com/wiki/index.php/API:Full_Series_Record
|
96
|
+
let :find_full, Hash do |options|
|
97
|
+
find_full_path_with_params(options).get
|
98
|
+
end
|
99
|
+
|
100
|
+
# Find the series data by series id - return only url.
|
101
|
+
#
|
102
|
+
# access: FREE
|
103
|
+
# param:
|
48
104
|
# find_full_url(1234)
|
49
|
-
# param (hash params):
|
50
|
-
# find_full_url(series_id: 1234)
|
51
105
|
# output: url string
|
52
|
-
|
53
|
-
|
106
|
+
let :find_full_url, Any do |id|
|
107
|
+
find_full_url(id: id)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Find the series data by series id - return only url.
|
111
|
+
#
|
112
|
+
# access: FREE
|
113
|
+
# param:
|
114
|
+
# find_full_url(1234, 'de')
|
115
|
+
# output: url string
|
116
|
+
let :find_full_url, Any do |id, language|
|
117
|
+
find_full_url(id: id, language: language)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Find the series data by series id - return only url.
|
121
|
+
#
|
122
|
+
# access: FREE
|
123
|
+
# param:
|
124
|
+
# find_full_url(id: 1234)
|
125
|
+
# output: url string
|
126
|
+
let :find_full_url, Hash do |options|
|
127
|
+
find_full_path_with_params(options).url
|
54
128
|
end
|
55
129
|
|
56
130
|
private
|
57
131
|
|
58
|
-
def find_path_with_params(
|
59
|
-
path(find_path).params(api_key_with_language_options.merge(
|
132
|
+
def find_path_with_params(options)
|
133
|
+
path(find_path).params(api_key_with_language_options.merge(options))
|
60
134
|
end
|
61
135
|
|
62
136
|
def find_path
|
63
|
-
':apikey/series/:
|
137
|
+
':apikey/series/:id/:language.xml'
|
64
138
|
end
|
65
139
|
|
66
|
-
def find_full_path_with_params(
|
67
|
-
path(find_full_path).params(api_key_with_language_options.merge(
|
140
|
+
def find_full_path_with_params(options)
|
141
|
+
path(find_full_path).params(api_key_with_language_options.merge(options))
|
68
142
|
end
|
69
143
|
|
70
144
|
def find_full_path
|
71
|
-
':apikey/series/:
|
145
|
+
':apikey/series/:id/all/:language.xml'
|
72
146
|
end
|
73
147
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ThetvdbApi::Server < ThetvdbApi::Base
|
2
|
+
# Returns server time.
|
3
|
+
#
|
4
|
+
# access: FREE
|
5
|
+
# output: Faraday::Response instance with parsed XML string
|
6
|
+
def time
|
7
|
+
path(find_path).get
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def find_path
|
13
|
+
'Updates.php?type=none'
|
14
|
+
end
|
15
|
+
end
|
data/lib/thetvdb_api/version.rb
CHANGED
data/lib/thetvdb_api.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
+
require 'ov'
|
2
|
+
|
1
3
|
module ThetvdbApi
|
2
|
-
module
|
4
|
+
module AttributesMapping
|
5
|
+
module Search; end
|
6
|
+
end
|
3
7
|
end
|
4
8
|
|
9
|
+
require 'thetvdb_api/attributes_mapping/search/get_episode'
|
10
|
+
require 'thetvdb_api/attributes_mapping/search/get_series'
|
11
|
+
require 'thetvdb_api/attributes_mapping/search/get_series_by_remote_id'
|
5
12
|
require 'thetvdb_api/version'
|
6
13
|
require 'thetvdb_api/client'
|
7
14
|
require 'thetvdb_api/base'
|
@@ -11,3 +18,4 @@ require 'thetvdb_api/series'
|
|
11
18
|
require 'thetvdb_api/episode'
|
12
19
|
require 'thetvdb_api/actor'
|
13
20
|
require 'thetvdb_api/banner'
|
21
|
+
require 'thetvdb_api/server'
|
@@ -138,11 +138,11 @@ describe ThetvdbApi::Episode do
|
|
138
138
|
describe '.find' do
|
139
139
|
context 'hash attributes' do
|
140
140
|
it 'should return Faraday::Response class' do
|
141
|
-
expect(model.find(
|
141
|
+
expect(model.find(id: 1234)).to be_a(Faraday::Response)
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'should return Hash class for body reponse' do
|
145
|
-
expect(model.find(
|
145
|
+
expect(model.find(id: 1234).body).to be_a(Hash)
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
@@ -161,7 +161,7 @@ describe ThetvdbApi::Episode do
|
|
161
161
|
context 'hash attributes' do
|
162
162
|
it 'should return correct url' do
|
163
163
|
expect(
|
164
|
-
model.find_url(
|
164
|
+
model.find_url(id: 1234)
|
165
165
|
).to eq('http://thetvdb.com/api/123456789/episodes/1234/en.xml')
|
166
166
|
end
|
167
167
|
end
|
@@ -12,7 +12,7 @@ describe ThetvdbApi::Search do
|
|
12
12
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
13
13
|
stub.get('/api/GetSeries.php?language=en&seriesname=Supernatural') { [200, { content_type: 'xml' }, get_series_data] }
|
14
14
|
stub.get('/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
15
|
-
stub.get('/api/GetSeriesByRemoteID.php?language=en&
|
15
|
+
stub.get('/api/GetSeriesByRemoteID.php?language=en&zap2it=SH01234') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
16
16
|
stub.get('/api/GetEpisodeByAirDate.php?language=en&airdate=2007-09-24&apikey=123456789&language=en&seriesid=80348') do
|
17
17
|
[200, { content_type: 'xml' }, get_episode_data]
|
18
18
|
end
|
@@ -62,11 +62,11 @@ describe ThetvdbApi::Search do
|
|
62
62
|
describe '.get_series_by_remote_id' do
|
63
63
|
context 'hash attributes' do
|
64
64
|
it 'should return Faraday::Response class' do
|
65
|
-
expect(model.get_series_by_remote_id(
|
65
|
+
expect(model.get_series_by_remote_id(imdb_id: 'tt0290978')).to be_a(Faraday::Response)
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'should return Hash class for body reponse' do
|
69
|
-
expect(model.get_series_by_remote_id(
|
69
|
+
expect(model.get_series_by_remote_id(imdb_id: 'tt0290978').body).to be_a(Hash)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -75,7 +75,7 @@ describe ThetvdbApi::Search do
|
|
75
75
|
context 'hash attributes' do
|
76
76
|
it 'should return correct url' do
|
77
77
|
expect(
|
78
|
-
model.get_series_by_remote_id_url(
|
78
|
+
model.get_series_by_remote_id_url(imdb_id: 'tt0290978')
|
79
79
|
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978')
|
80
80
|
end
|
81
81
|
end
|
@@ -84,11 +84,11 @@ describe ThetvdbApi::Search do
|
|
84
84
|
describe '.get_series_by_remote_id' do
|
85
85
|
context 'hash attributes' do
|
86
86
|
it 'should return Faraday::Response class' do
|
87
|
-
expect(model.get_series_by_remote_id(
|
87
|
+
expect(model.get_series_by_remote_id(zap2it_id: 'SH01234')).to be_a(Faraday::Response)
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'should return Hash class for body reponse' do
|
91
|
-
expect(model.get_series_by_remote_id(
|
91
|
+
expect(model.get_series_by_remote_id(zap2it_id: 'SH01234').body).to be_a(Hash)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -97,8 +97,8 @@ describe ThetvdbApi::Search do
|
|
97
97
|
context 'hash attributes' do
|
98
98
|
it 'should return correct url' do
|
99
99
|
expect(
|
100
|
-
model.get_series_by_remote_id_url(
|
101
|
-
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&
|
100
|
+
model.get_series_by_remote_id_url(zap2it_id: 'SH01234')
|
101
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&zap2it=SH01234')
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
@@ -142,7 +142,7 @@ describe ThetvdbApi::Search do
|
|
142
142
|
it 'should return correct url' do
|
143
143
|
expect(
|
144
144
|
model.get_series_by_zap2it_id_url('SH01234')
|
145
|
-
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&
|
145
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&zap2it=SH01234')
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
@@ -17,11 +17,11 @@ describe ThetvdbApi::Series do
|
|
17
17
|
describe '.find' do
|
18
18
|
context 'hash attributes' do
|
19
19
|
it 'should return Faraday::Response class' do
|
20
|
-
expect(model.find(
|
20
|
+
expect(model.find(id: 1234)).to be_a(Faraday::Response)
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should return Hash class for body reponse' do
|
24
|
-
expect(model.find(
|
24
|
+
expect(model.find(id: 1234).body).to be_a(Hash)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -39,7 +39,7 @@ describe ThetvdbApi::Series do
|
|
39
39
|
describe '.find_url' do
|
40
40
|
context 'hash attributes' do
|
41
41
|
it 'should return correct url' do
|
42
|
-
expect(model.find_url(
|
42
|
+
expect(model.find_url(id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/en.xml')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -53,11 +53,11 @@ describe ThetvdbApi::Series do
|
|
53
53
|
describe '.find_full' do
|
54
54
|
context 'hash attributes' do
|
55
55
|
it 'should return Faraday::Response class' do
|
56
|
-
expect(model.find_full(
|
56
|
+
expect(model.find_full(id: 1234)).to be_a(Faraday::Response)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should return Hash class for body reponse' do
|
60
|
-
expect(model.find_full(
|
60
|
+
expect(model.find_full(id: 1234).body).to be_a(Hash)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -75,7 +75,7 @@ describe ThetvdbApi::Series do
|
|
75
75
|
describe '.find_full_url' do
|
76
76
|
context 'hash attributes' do
|
77
77
|
it 'should return correct url' do
|
78
|
-
expect(model.find_full_url(
|
78
|
+
expect(model.find_full_url(id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/all/en.xml')
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|