thetvdb_api 0.3.1 → 0.3.2
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/.travis.yml +2 -1
- data/CHANGELOG.md +11 -0
- data/lib/thetvdb_api/attributes_mapping/search/get_episode.rb +1 -0
- data/lib/thetvdb_api/series.rb +2 -2
- data/lib/thetvdb_api/version.rb +1 -1
- data/spec/functionals/episode_spec.rb +124 -32
- data/spec/functionals/search_spec.rb +127 -33
- data/spec/functionals/series_spec.rb +54 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3740260dd6af0b5e4b3c7c93b7fbdc511a14efd
|
4
|
+
data.tar.gz: 8fb1c91dd7536b7b67a502388dd79c1b285620bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771075d0e3a430cfc18635cc1a4568f2311b2dfb603e1a146f7c0ddc73bc4c885a763f27c0fa2b687d4858e2e408eac8e55b458a6c654d8902202a4d494ff67f
|
7
|
+
data.tar.gz: 9e7d3a5d4a120130d6d2e4d970621c8c6bb02809c361b0af41a75a05a51abdf69342c4debdfd68e25523125b68f37a8a5b4318501cee5e4867b03e0d3b9284d1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.3.2 (January 20, 2015)
|
2
|
+
|
3
|
+
- fix series method
|
4
|
+
- add more test for better test coverage
|
5
|
+
|
6
|
+
## 0.3.1 (January 20, 2015)
|
7
|
+
|
8
|
+
- use ov gem for multimethod
|
9
|
+
- use hashie for normalize params key names
|
10
|
+
- fix zap2it url params after updated official documentation
|
11
|
+
|
1
12
|
## 0.3.0 (September 5, 2014)
|
2
13
|
|
3
14
|
- two way to pass attributes: hash attributes or simple multi attributes (in correct order)
|
data/lib/thetvdb_api/series.rb
CHANGED
@@ -50,7 +50,7 @@ class ThetvdbApi::Series < ThetvdbApi::Base
|
|
50
50
|
# param:
|
51
51
|
# find_url(1234, 'de')
|
52
52
|
# output: url string
|
53
|
-
let :find_url, Any do |id, language|
|
53
|
+
let :find_url, Any, String do |id, language|
|
54
54
|
find_url(id: id, language: language)
|
55
55
|
end
|
56
56
|
|
@@ -113,7 +113,7 @@ class ThetvdbApi::Series < ThetvdbApi::Base
|
|
113
113
|
# param:
|
114
114
|
# find_full_url(1234, 'de')
|
115
115
|
# output: url string
|
116
|
-
let :find_full_url, Any do |id, language|
|
116
|
+
let :find_full_url, Any, String do |id, language|
|
117
117
|
find_full_url(id: id, language: language)
|
118
118
|
end
|
119
119
|
|
data/lib/thetvdb_api/version.rb
CHANGED
@@ -9,9 +9,13 @@ describe ThetvdbApi::Episode do
|
|
9
9
|
let(:faraday_stubs) do
|
10
10
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
11
|
stub.get('/api/123456789/series/1234/default/1/1/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
12
|
+
stub.get('/api/123456789/series/1234/default/1/1/de.xml') { [200, { content_type: 'xml' }, episode_data] }
|
12
13
|
stub.get('/api/123456789/series/1234/dvd/1/1/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
14
|
+
stub.get('/api/123456789/series/1234/dvd/1/1/de.xml') { [200, { content_type: 'xml' }, episode_data] }
|
13
15
|
stub.get('/api/123456789/series/1234/absolute/1/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
16
|
+
stub.get('/api/123456789/series/1234/absolute/1/de.xml') { [200, { content_type: 'xml' }, episode_data] }
|
14
17
|
stub.get('/api/123456789/episodes/1234/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
18
|
+
stub.get('/api/123456789/episodes/1234/de.xml') { [200, { content_type: 'xml' }, episode_data] }
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
@@ -27,12 +31,24 @@ describe ThetvdbApi::Episode do
|
|
27
31
|
end
|
28
32
|
|
29
33
|
context 'normal attributes' do
|
30
|
-
|
31
|
-
|
34
|
+
context 'without optional attribute' do
|
35
|
+
it 'should return Faraday::Response class' do
|
36
|
+
expect(model.find_by_default_order(1234, 1, 1)).to be_a(Faraday::Response)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return Hash class for body reponse' do
|
40
|
+
expect(model.find_by_default_order(1234, 1, 1).body).to be_a(Hash)
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
|
-
|
35
|
-
|
44
|
+
context 'with optional attribute' do
|
45
|
+
it 'should return Faraday::Response class' do
|
46
|
+
expect(model.find_by_default_order(1234, 1, 1, 'de')).to be_a(Faraday::Response)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return Hash class for body reponse' do
|
50
|
+
expect(model.find_by_default_order(1234, 1, 1, 'de').body).to be_a(Hash)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
38
54
|
end
|
@@ -47,10 +63,20 @@ describe ThetvdbApi::Episode do
|
|
47
63
|
end
|
48
64
|
|
49
65
|
context 'normal attributes' do
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
66
|
+
context 'without optional attribute' do
|
67
|
+
it 'should return correct url' do
|
68
|
+
expect(
|
69
|
+
model.find_by_default_order_url(1234, 1, 1)
|
70
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/default/1/1/en.xml')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with optional attribute' do
|
75
|
+
it 'should return correct url' do
|
76
|
+
expect(
|
77
|
+
model.find_by_default_order_url(1234, 1, 1, 'de')
|
78
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/default/1/1/de.xml')
|
79
|
+
end
|
54
80
|
end
|
55
81
|
end
|
56
82
|
end
|
@@ -67,12 +93,24 @@ describe ThetvdbApi::Episode do
|
|
67
93
|
end
|
68
94
|
|
69
95
|
context 'normal attributes' do
|
70
|
-
|
71
|
-
|
96
|
+
context 'without optional attribute' do
|
97
|
+
it 'should return Faraday::Response class' do
|
98
|
+
expect(model.find_by_dvd_order(1234, 1, 1)).to be_a(Faraday::Response)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should return Hash class for body reponse' do
|
102
|
+
expect(model.find_by_dvd_order(1234, 1, 1).body).to be_a(Hash)
|
103
|
+
end
|
72
104
|
end
|
73
105
|
|
74
|
-
|
75
|
-
|
106
|
+
context 'without optional attribute' do
|
107
|
+
it 'should return Faraday::Response class' do
|
108
|
+
expect(model.find_by_dvd_order(1234, 1, 1, 'de')).to be_a(Faraday::Response)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should return Hash class for body reponse' do
|
112
|
+
expect(model.find_by_dvd_order(1234, 1, 1, 'de').body).to be_a(Hash)
|
113
|
+
end
|
76
114
|
end
|
77
115
|
end
|
78
116
|
end
|
@@ -87,10 +125,20 @@ describe ThetvdbApi::Episode do
|
|
87
125
|
end
|
88
126
|
|
89
127
|
context 'normal attributes' do
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
128
|
+
context 'without optional attribute' do
|
129
|
+
it 'should return correct url' do
|
130
|
+
expect(
|
131
|
+
model.find_by_dvd_order_url(1234, 1, 1)
|
132
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/dvd/1/1/en.xml')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'without optional attribute' do
|
137
|
+
it 'should return correct url' do
|
138
|
+
expect(
|
139
|
+
model.find_by_dvd_order_url(1234, 1, 1, 'de')
|
140
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/dvd/1/1/de.xml')
|
141
|
+
end
|
94
142
|
end
|
95
143
|
end
|
96
144
|
end
|
@@ -107,12 +155,24 @@ describe ThetvdbApi::Episode do
|
|
107
155
|
end
|
108
156
|
|
109
157
|
context 'normal attributes' do
|
110
|
-
|
111
|
-
|
158
|
+
context 'without optional attribute' do
|
159
|
+
it 'should return Faraday::Response class' do
|
160
|
+
expect(model.find_by_absolute_order(1234, 1)).to be_a(Faraday::Response)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'should return Hash class for body reponse' do
|
164
|
+
expect(model.find_by_absolute_order(1234, 1).body).to be_a(Hash)
|
165
|
+
end
|
112
166
|
end
|
113
167
|
|
114
|
-
|
115
|
-
|
168
|
+
context 'without optional attribute' do
|
169
|
+
it 'should return Faraday::Response class' do
|
170
|
+
expect(model.find_by_absolute_order(1234, 1, 'de')).to be_a(Faraday::Response)
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'should return Hash class for body reponse' do
|
174
|
+
expect(model.find_by_absolute_order(1234, 1, 'de').body).to be_a(Hash)
|
175
|
+
end
|
116
176
|
end
|
117
177
|
end
|
118
178
|
end
|
@@ -127,10 +187,20 @@ describe ThetvdbApi::Episode do
|
|
127
187
|
end
|
128
188
|
|
129
189
|
context 'normal attributes' do
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
190
|
+
context 'without optional attribute' do
|
191
|
+
it 'should return correct url' do
|
192
|
+
expect(
|
193
|
+
model.find_by_absolute_order_url(1234, 1)
|
194
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/absolute/1/en.xml')
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context 'without optional attribute' do
|
199
|
+
it 'should return correct url' do
|
200
|
+
expect(
|
201
|
+
model.find_by_absolute_order_url(1234, 1, 'de')
|
202
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/absolute/1/de.xml')
|
203
|
+
end
|
134
204
|
end
|
135
205
|
end
|
136
206
|
end
|
@@ -147,12 +217,24 @@ describe ThetvdbApi::Episode do
|
|
147
217
|
end
|
148
218
|
|
149
219
|
context 'normal attributes' do
|
150
|
-
|
151
|
-
|
220
|
+
context 'without optional attribute' do
|
221
|
+
it 'should return Faraday::Response class' do
|
222
|
+
expect(model.find(1234)).to be_a(Faraday::Response)
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'should return Hash class for body reponse' do
|
226
|
+
expect(model.find(1234).body).to be_a(Hash)
|
227
|
+
end
|
152
228
|
end
|
153
229
|
|
154
|
-
|
155
|
-
|
230
|
+
context 'without optional attribute' do
|
231
|
+
it 'should return Faraday::Response class' do
|
232
|
+
expect(model.find(1234, 'de')).to be_a(Faraday::Response)
|
233
|
+
end
|
234
|
+
|
235
|
+
it 'should return Hash class for body reponse' do
|
236
|
+
expect(model.find(1234, 'de').body).to be_a(Hash)
|
237
|
+
end
|
156
238
|
end
|
157
239
|
end
|
158
240
|
end
|
@@ -167,10 +249,20 @@ describe ThetvdbApi::Episode do
|
|
167
249
|
end
|
168
250
|
|
169
251
|
context 'normal attributes' do
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
252
|
+
context 'without optional attribute' do
|
253
|
+
it 'should return correct url' do
|
254
|
+
expect(
|
255
|
+
model.find_url(1234)
|
256
|
+
).to eq('http://thetvdb.com/api/123456789/episodes/1234/en.xml')
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
context 'without optional attribute' do
|
261
|
+
it 'should return correct url' do
|
262
|
+
expect(
|
263
|
+
model.find_url(1234, 'de')
|
264
|
+
).to eq('http://thetvdb.com/api/123456789/episodes/1234/de.xml')
|
265
|
+
end
|
174
266
|
end
|
175
267
|
end
|
176
268
|
end
|
@@ -11,9 +11,15 @@ describe ThetvdbApi::Search do
|
|
11
11
|
let(:faraday_stubs) 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
|
+
stub.get('/api/GetSeries.php?language=de&seriesname=Supernatural') { [200, { content_type: 'xml' }, get_series_data] }
|
14
15
|
stub.get('/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
16
|
+
stub.get('/api/GetSeriesByRemoteID.php?language=de&imdbid=tt0290978') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
15
17
|
stub.get('/api/GetSeriesByRemoteID.php?language=en&zap2it=SH01234') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
16
|
-
stub.get('/api/
|
18
|
+
stub.get('/api/GetSeriesByRemoteID.php?language=de&zap2it=SH01234') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
|
19
|
+
stub.get('/api/GetEpisodeByAirDate.php?language=en&airdate=2007-09-24&apikey=123456789&seriesid=80348') do
|
20
|
+
[200, { content_type: 'xml' }, get_episode_data]
|
21
|
+
end
|
22
|
+
stub.get('/api/GetEpisodeByAirDate.php?language=de&airdate=2007-09-24&apikey=123456789&seriesid=80348') do
|
17
23
|
[200, { content_type: 'xml' }, get_episode_data]
|
18
24
|
end
|
19
25
|
end
|
@@ -31,12 +37,24 @@ describe ThetvdbApi::Search do
|
|
31
37
|
end
|
32
38
|
|
33
39
|
context 'normal attributes' do
|
34
|
-
|
35
|
-
|
40
|
+
context 'without optional attribute' do
|
41
|
+
it 'should return Faraday::Response class' do
|
42
|
+
expect(model.get_series('Supernatural')).to be_a(Faraday::Response)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should return Hash class for body reponse' do
|
46
|
+
expect(model.get_series('Supernatural').body).to be_a(Hash)
|
47
|
+
end
|
36
48
|
end
|
37
49
|
|
38
|
-
|
39
|
-
|
50
|
+
context 'without optional attribute' do
|
51
|
+
it 'should return Faraday::Response class' do
|
52
|
+
expect(model.get_series('Supernatural', 'de')).to be_a(Faraday::Response)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should return Hash class for body reponse' do
|
56
|
+
expect(model.get_series('Supernatural', 'de').body).to be_a(Hash)
|
57
|
+
end
|
40
58
|
end
|
41
59
|
end
|
42
60
|
end
|
@@ -51,10 +69,20 @@ describe ThetvdbApi::Search do
|
|
51
69
|
end
|
52
70
|
|
53
71
|
context 'normal attributes' do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
72
|
+
context 'without optional attribute' do
|
73
|
+
it 'should return correct url' do
|
74
|
+
expect(
|
75
|
+
model.get_series_url('Supernatural')
|
76
|
+
).to eq('http://thetvdb.com/api/GetSeries.php?language=en&seriesname=Supernatural')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'without optional attribute' do
|
81
|
+
it 'should return correct url' do
|
82
|
+
expect(
|
83
|
+
model.get_series_url('Supernatural', 'de')
|
84
|
+
).to eq('http://thetvdb.com/api/GetSeries.php?language=de&seriesname=Supernatural')
|
85
|
+
end
|
58
86
|
end
|
59
87
|
end
|
60
88
|
end
|
@@ -105,44 +133,88 @@ describe ThetvdbApi::Search do
|
|
105
133
|
|
106
134
|
describe '.get_series_by_imdb_id' do
|
107
135
|
context 'normal attributes' do
|
108
|
-
|
109
|
-
|
136
|
+
context 'without optional attribute' do
|
137
|
+
it 'should return Faraday::Response class' do
|
138
|
+
expect(model.get_series_by_imdb_id('tt0290978')).to be_a(Faraday::Response)
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'should return Hash class for body reponse' do
|
142
|
+
expect(model.get_series_by_imdb_id('tt0290978').body).to be_a(Hash)
|
143
|
+
end
|
110
144
|
end
|
111
145
|
|
112
|
-
|
113
|
-
|
146
|
+
context 'without optional attribute' do
|
147
|
+
it 'should return Faraday::Response class' do
|
148
|
+
expect(model.get_series_by_imdb_id('tt0290978', 'de')).to be_a(Faraday::Response)
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'should return Hash class for body reponse' do
|
152
|
+
expect(model.get_series_by_imdb_id('tt0290978', 'de').body).to be_a(Hash)
|
153
|
+
end
|
114
154
|
end
|
115
155
|
end
|
116
156
|
end
|
117
157
|
|
118
158
|
describe '.get_series_by_imdb_id_url' do
|
119
159
|
context 'normal attributes' do
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
160
|
+
context 'without optional attribute' do
|
161
|
+
it 'should return correct url' do
|
162
|
+
expect(
|
163
|
+
model.get_series_by_imdb_id_url('tt0290978')
|
164
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978')
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'without optional attribute' do
|
169
|
+
it 'should return correct url' do
|
170
|
+
expect(
|
171
|
+
model.get_series_by_imdb_id_url('tt0290978', 'de')
|
172
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=de&imdbid=tt0290978')
|
173
|
+
end
|
124
174
|
end
|
125
175
|
end
|
126
176
|
end
|
127
177
|
|
128
178
|
describe '.get_series_by_zap2it_id' do
|
129
179
|
context 'normal attributes' do
|
130
|
-
|
131
|
-
|
180
|
+
context 'without optional attribute' do
|
181
|
+
it 'should return Faraday::Response class' do
|
182
|
+
expect(model.get_series_by_zap2it_id('SH01234')).to be_a(Faraday::Response)
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'should return Hash class for body reponse' do
|
186
|
+
expect(model.get_series_by_zap2it_id('SH01234').body).to be_a(Hash)
|
187
|
+
end
|
132
188
|
end
|
133
189
|
|
134
|
-
|
135
|
-
|
190
|
+
context 'without optional attribute' do
|
191
|
+
it 'should return Faraday::Response class' do
|
192
|
+
expect(model.get_series_by_zap2it_id('SH01234', 'de')).to be_a(Faraday::Response)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should return Hash class for body reponse' do
|
196
|
+
expect(model.get_series_by_zap2it_id('SH01234', 'de').body).to be_a(Hash)
|
197
|
+
end
|
136
198
|
end
|
137
199
|
end
|
138
200
|
end
|
139
201
|
|
140
202
|
describe '.get_series_by_zap2it_id_url' do
|
141
203
|
context 'normal attributes' do
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
204
|
+
context 'without optional attribute' do
|
205
|
+
it 'should return correct url' do
|
206
|
+
expect(
|
207
|
+
model.get_series_by_zap2it_id_url('SH01234')
|
208
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&zap2it=SH01234')
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'without optional attribute' do
|
213
|
+
it 'should return correct url' do
|
214
|
+
expect(
|
215
|
+
model.get_series_by_zap2it_id_url('SH01234', 'de')
|
216
|
+
).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=de&zap2it=SH01234')
|
217
|
+
end
|
146
218
|
end
|
147
219
|
end
|
148
220
|
end
|
@@ -159,12 +231,24 @@ describe ThetvdbApi::Search do
|
|
159
231
|
end
|
160
232
|
|
161
233
|
context 'normal attributes' do
|
162
|
-
|
163
|
-
|
234
|
+
context 'without optional attribute' do
|
235
|
+
it 'should return Faraday::Response class' do
|
236
|
+
expect(model.get_episode(80348, '2007-09-24')).to be_a(Faraday::Response)
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'should return Hash class for body reponse' do
|
240
|
+
expect(model.get_episode(80348, '2007-09-24').body).to be_a(Hash)
|
241
|
+
end
|
164
242
|
end
|
165
243
|
|
166
|
-
|
167
|
-
|
244
|
+
context 'without optional attribute' do
|
245
|
+
it 'should return Faraday::Response class' do
|
246
|
+
expect(model.get_episode(80348, '2007-09-24', 'de')).to be_a(Faraday::Response)
|
247
|
+
end
|
248
|
+
|
249
|
+
it 'should return Hash class for body reponse' do
|
250
|
+
expect(model.get_episode(80348, '2007-09-24', 'de').body).to be_a(Hash)
|
251
|
+
end
|
168
252
|
end
|
169
253
|
end
|
170
254
|
end
|
@@ -179,10 +263,20 @@ describe ThetvdbApi::Search do
|
|
179
263
|
end
|
180
264
|
|
181
265
|
context 'normal attributes' do
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
266
|
+
context 'without optional attribute' do
|
267
|
+
it 'should return correct url' do
|
268
|
+
expect(
|
269
|
+
model.get_episode_url(80348, '2007-09-24')
|
270
|
+
).to eq('http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=123456789&language=en&seriesid=80348&airdate=2007-09-24')
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context 'without optional attribute' do
|
275
|
+
it 'should return correct url' do
|
276
|
+
expect(
|
277
|
+
model.get_episode_url(80348, '2007-09-24', 'de')
|
278
|
+
).to eq('http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=123456789&language=de&seriesid=80348&airdate=2007-09-24')
|
279
|
+
end
|
186
280
|
end
|
187
281
|
end
|
188
282
|
end
|
@@ -10,7 +10,9 @@ describe ThetvdbApi::Series do
|
|
10
10
|
let(:faraday_stubs) do
|
11
11
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
12
12
|
stub.get('/api/123456789/series/1234/en.xml') { [200, { content_type: 'xml' }, series_data] }
|
13
|
+
stub.get('/api/123456789/series/1234/de.xml') { [200, { content_type: 'xml' }, series_data] }
|
13
14
|
stub.get('/api/123456789/series/1234/all/en.xml') { [200, { content_type: 'xml' }, full_series_data] }
|
15
|
+
stub.get('/api/123456789/series/1234/all/de.xml') { [200, { content_type: 'xml' }, full_series_data] }
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -26,12 +28,24 @@ describe ThetvdbApi::Series do
|
|
26
28
|
end
|
27
29
|
|
28
30
|
context 'normal attributes' do
|
29
|
-
|
30
|
-
|
31
|
+
context 'without optional attribute' do
|
32
|
+
it 'should return Faraday::Response class' do
|
33
|
+
expect(model.find(1234)).to be_a(Faraday::Response)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should return Hash class for body reponse' do
|
37
|
+
expect(model.find(1234).body).to be_a(Hash)
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
|
-
|
34
|
-
|
41
|
+
context 'without optional attribute' do
|
42
|
+
it 'should return Faraday::Response class' do
|
43
|
+
expect(model.find(1234, 'de')).to be_a(Faraday::Response)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should return Hash class for body reponse' do
|
47
|
+
expect(model.find(1234, 'de').body).to be_a(Hash)
|
48
|
+
end
|
35
49
|
end
|
36
50
|
end
|
37
51
|
end
|
@@ -44,8 +58,16 @@ describe ThetvdbApi::Series do
|
|
44
58
|
end
|
45
59
|
|
46
60
|
context 'normal attributes' do
|
47
|
-
|
48
|
-
|
61
|
+
context 'without optional attribute' do
|
62
|
+
it 'should return correct url' do
|
63
|
+
expect(model.find_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/en.xml')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'without optional attribute' do
|
68
|
+
it 'should return correct url' do
|
69
|
+
expect(model.find_url(1234, 'de')).to eq('http://thetvdb.com/api/123456789/series/1234/de.xml')
|
70
|
+
end
|
49
71
|
end
|
50
72
|
end
|
51
73
|
end
|
@@ -62,12 +84,24 @@ describe ThetvdbApi::Series do
|
|
62
84
|
end
|
63
85
|
|
64
86
|
context 'normal attributes' do
|
65
|
-
|
66
|
-
|
87
|
+
context 'without optional attribute' do
|
88
|
+
it 'should return Faraday::Response class' do
|
89
|
+
expect(model.find_full(1234)).to be_a(Faraday::Response)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should return Hash class for body reponse' do
|
93
|
+
expect(model.find_full(1234).body).to be_a(Hash)
|
94
|
+
end
|
67
95
|
end
|
68
96
|
|
69
|
-
|
70
|
-
|
97
|
+
context 'without optional attribute' do
|
98
|
+
it 'should return Faraday::Response class' do
|
99
|
+
expect(model.find_full(1234, 'de')).to be_a(Faraday::Response)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should return Hash class for body reponse' do
|
103
|
+
expect(model.find_full(1234, 'de').body).to be_a(Hash)
|
104
|
+
end
|
71
105
|
end
|
72
106
|
end
|
73
107
|
end
|
@@ -80,8 +114,16 @@ describe ThetvdbApi::Series do
|
|
80
114
|
end
|
81
115
|
|
82
116
|
context 'normal attributes' do
|
83
|
-
|
84
|
-
|
117
|
+
context 'without optional attribute' do
|
118
|
+
it 'should return correct url' do
|
119
|
+
expect(model.find_full_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/all/en.xml')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context 'without optional attribute' do
|
124
|
+
it 'should return correct url' do
|
125
|
+
expect(model.find_full_url(1234, 'de')).to eq('http://thetvdb.com/api/123456789/series/1234/all/de.xml')
|
126
|
+
end
|
85
127
|
end
|
86
128
|
end
|
87
129
|
end
|