thetvdb_api 0.2.3.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +30 -51
- data/lib/thetvdb_api/actor.rb +9 -9
- data/lib/thetvdb_api/banner.rb +9 -9
- data/lib/thetvdb_api/base.rb +10 -56
- data/lib/thetvdb_api/client.rb +6 -4
- data/lib/thetvdb_api/episode.rb +33 -34
- data/lib/thetvdb_api/search.rb +23 -35
- data/lib/thetvdb_api/series.rb +17 -17
- data/lib/thetvdb_api/update.rb +32 -32
- data/lib/thetvdb_api/version.rb +1 -1
- data/lib/thetvdb_api.rb +0 -12
- data/spec/fixtures/get_episode.xml +30 -0
- data/spec/fixtures/get_series.xml +24 -0
- data/spec/fixtures/get_series_by_remote.xml +14 -0
- data/spec/fixtures/updates.xml +35 -0
- data/spec/functionals/actor_spec.rb +30 -0
- data/spec/functionals/banner_spec.rb +30 -0
- data/spec/functionals/episode_spec.rb +85 -0
- data/spec/functionals/search_spec.rb +71 -0
- data/spec/functionals/series_spec.rb +48 -0
- data/spec/functionals/update_spec.rb +81 -0
- data/thetvdb_api.gemspec +2 -2
- metadata +34 -82
- data/lib/generators/templates/thetvdb_api.rb +0 -3
- data/lib/generators/thetvdb_api/install_generator.rb +0 -12
- data/lib/thetvdb_api/configuration.rb +0 -10
- data/lib/thetvdb_api/response/actors.rb +0 -7
- data/lib/thetvdb_api/response/banners.rb +0 -7
- data/lib/thetvdb_api/response/collection.rb +0 -9
- data/lib/thetvdb_api/response/episode.rb +0 -5
- data/lib/thetvdb_api/response/full_series.rb +0 -21
- data/lib/thetvdb_api/response/search_multiple_episode.rb +0 -7
- data/lib/thetvdb_api/response/search_multiple_series.rb +0 -7
- data/lib/thetvdb_api/response/search_series.rb +0 -5
- data/lib/thetvdb_api/response/series.rb +0 -5
- data/lib/thetvdb_api/response/update.rb +0 -31
- data/lib/thetvdb_api/response.rb +0 -52
- data/spec/functionals/classes/actor_spec.rb +0 -41
- data/spec/functionals/classes/banner_spec.rb +0 -42
- data/spec/functionals/classes/episode_spec.rb +0 -93
- data/spec/functionals/classes/series_spec.rb +0 -91
- data/spec/functionals/functional_spec_helper.rb +0 -7
- data/spec/functionals/support/stub_faraday.rb +0 -5
- data/spec/integrations/support/.keep +0 -0
- data/spec/units/classes/actor_spec.rb +0 -49
- data/spec/units/classes/banner_spec.rb +0 -49
- data/spec/units/classes/base_spec.rb +0 -123
- data/spec/units/classes/client_spec.rb +0 -41
- data/spec/units/classes/episode_spec.rb +0 -167
- data/spec/units/classes/response/actors_spec.rb +0 -15
- data/spec/units/classes/response/banners_spec.rb +0 -15
- data/spec/units/classes/response/collection_spec.rb +0 -38
- data/spec/units/classes/response/episode_spec.rb +0 -15
- data/spec/units/classes/response/full_series_spec.rb +0 -51
- data/spec/units/classes/response/search_multiple_episode_spec.rb +0 -15
- data/spec/units/classes/response/search_multiple_series_spec.rb +0 -15
- data/spec/units/classes/response/search_series_spec.rb +0 -15
- data/spec/units/classes/response/series_spec.rb +0 -15
- data/spec/units/classes/response/update_spec.rb +0 -79
- data/spec/units/classes/response_spec.rb +0 -100
- data/spec/units/classes/search_spec.rb +0 -178
- data/spec/units/classes/series_spec.rb +0 -92
- data/spec/units/classes/update_spec.rb +0 -178
- data/spec/units/unit_spec_helper.rb +0 -5
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thetvdb_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wawer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.9.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.9.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: uri_template
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: multi_xml
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.5.5
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.5.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: service_api
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.0.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.0.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,26 +135,12 @@ files:
|
|
135
135
|
- LICENSE.txt
|
136
136
|
- README.md
|
137
137
|
- Rakefile
|
138
|
-
- lib/generators/templates/thetvdb_api.rb
|
139
|
-
- lib/generators/thetvdb_api/install_generator.rb
|
140
138
|
- lib/thetvdb_api.rb
|
141
139
|
- lib/thetvdb_api/actor.rb
|
142
140
|
- lib/thetvdb_api/banner.rb
|
143
141
|
- lib/thetvdb_api/base.rb
|
144
142
|
- lib/thetvdb_api/client.rb
|
145
|
-
- lib/thetvdb_api/configuration.rb
|
146
143
|
- lib/thetvdb_api/episode.rb
|
147
|
-
- lib/thetvdb_api/response.rb
|
148
|
-
- lib/thetvdb_api/response/actors.rb
|
149
|
-
- lib/thetvdb_api/response/banners.rb
|
150
|
-
- lib/thetvdb_api/response/collection.rb
|
151
|
-
- lib/thetvdb_api/response/episode.rb
|
152
|
-
- lib/thetvdb_api/response/full_series.rb
|
153
|
-
- lib/thetvdb_api/response/search_multiple_episode.rb
|
154
|
-
- lib/thetvdb_api/response/search_multiple_series.rb
|
155
|
-
- lib/thetvdb_api/response/search_series.rb
|
156
|
-
- lib/thetvdb_api/response/series.rb
|
157
|
-
- lib/thetvdb_api/response/update.rb
|
158
144
|
- lib/thetvdb_api/search.rb
|
159
145
|
- lib/thetvdb_api/series.rb
|
160
146
|
- lib/thetvdb_api/update.rb
|
@@ -163,13 +149,17 @@ files:
|
|
163
149
|
- spec/fixtures/banners.xml
|
164
150
|
- spec/fixtures/episode.xml
|
165
151
|
- spec/fixtures/full_series.xml
|
152
|
+
- spec/fixtures/get_episode.xml
|
153
|
+
- spec/fixtures/get_series.xml
|
154
|
+
- spec/fixtures/get_series_by_remote.xml
|
166
155
|
- spec/fixtures/series.xml
|
167
|
-
- spec/
|
168
|
-
- spec/functionals/
|
169
|
-
- spec/functionals/
|
170
|
-
- spec/functionals/
|
171
|
-
- spec/functionals/
|
172
|
-
- spec/functionals/
|
156
|
+
- spec/fixtures/updates.xml
|
157
|
+
- spec/functionals/actor_spec.rb
|
158
|
+
- spec/functionals/banner_spec.rb
|
159
|
+
- spec/functionals/episode_spec.rb
|
160
|
+
- spec/functionals/search_spec.rb
|
161
|
+
- spec/functionals/series_spec.rb
|
162
|
+
- spec/functionals/update_spec.rb
|
173
163
|
- spec/integrations/classes/actor_spec.rb
|
174
164
|
- spec/integrations/classes/banner_spec.rb
|
175
165
|
- spec/integrations/classes/client_spec.rb
|
@@ -178,28 +168,7 @@ files:
|
|
178
168
|
- spec/integrations/classes/series_spec.rb
|
179
169
|
- spec/integrations/classes/update_spec.rb
|
180
170
|
- spec/integrations/integration_spec_helper.rb
|
181
|
-
- spec/integrations/support/.keep
|
182
171
|
- spec/spec_helper.rb
|
183
|
-
- spec/units/classes/actor_spec.rb
|
184
|
-
- spec/units/classes/banner_spec.rb
|
185
|
-
- spec/units/classes/base_spec.rb
|
186
|
-
- spec/units/classes/client_spec.rb
|
187
|
-
- spec/units/classes/episode_spec.rb
|
188
|
-
- spec/units/classes/response/actors_spec.rb
|
189
|
-
- spec/units/classes/response/banners_spec.rb
|
190
|
-
- spec/units/classes/response/collection_spec.rb
|
191
|
-
- spec/units/classes/response/episode_spec.rb
|
192
|
-
- spec/units/classes/response/full_series_spec.rb
|
193
|
-
- spec/units/classes/response/search_multiple_episode_spec.rb
|
194
|
-
- spec/units/classes/response/search_multiple_series_spec.rb
|
195
|
-
- spec/units/classes/response/search_series_spec.rb
|
196
|
-
- spec/units/classes/response/series_spec.rb
|
197
|
-
- spec/units/classes/response/update_spec.rb
|
198
|
-
- spec/units/classes/response_spec.rb
|
199
|
-
- spec/units/classes/search_spec.rb
|
200
|
-
- spec/units/classes/series_spec.rb
|
201
|
-
- spec/units/classes/update_spec.rb
|
202
|
-
- spec/units/unit_spec_helper.rb
|
203
172
|
- thetvdb_api.gemspec
|
204
173
|
homepage: http://github.com/wafcio/thetvdb_api
|
205
174
|
licenses:
|
@@ -230,13 +199,17 @@ test_files:
|
|
230
199
|
- spec/fixtures/banners.xml
|
231
200
|
- spec/fixtures/episode.xml
|
232
201
|
- spec/fixtures/full_series.xml
|
202
|
+
- spec/fixtures/get_episode.xml
|
203
|
+
- spec/fixtures/get_series.xml
|
204
|
+
- spec/fixtures/get_series_by_remote.xml
|
233
205
|
- spec/fixtures/series.xml
|
234
|
-
- spec/
|
235
|
-
- spec/functionals/
|
236
|
-
- spec/functionals/
|
237
|
-
- spec/functionals/
|
238
|
-
- spec/functionals/
|
239
|
-
- spec/functionals/
|
206
|
+
- spec/fixtures/updates.xml
|
207
|
+
- spec/functionals/actor_spec.rb
|
208
|
+
- spec/functionals/banner_spec.rb
|
209
|
+
- spec/functionals/episode_spec.rb
|
210
|
+
- spec/functionals/search_spec.rb
|
211
|
+
- spec/functionals/series_spec.rb
|
212
|
+
- spec/functionals/update_spec.rb
|
240
213
|
- spec/integrations/classes/actor_spec.rb
|
241
214
|
- spec/integrations/classes/banner_spec.rb
|
242
215
|
- spec/integrations/classes/client_spec.rb
|
@@ -245,25 +218,4 @@ test_files:
|
|
245
218
|
- spec/integrations/classes/series_spec.rb
|
246
219
|
- spec/integrations/classes/update_spec.rb
|
247
220
|
- spec/integrations/integration_spec_helper.rb
|
248
|
-
- spec/integrations/support/.keep
|
249
221
|
- spec/spec_helper.rb
|
250
|
-
- spec/units/classes/actor_spec.rb
|
251
|
-
- spec/units/classes/banner_spec.rb
|
252
|
-
- spec/units/classes/base_spec.rb
|
253
|
-
- spec/units/classes/client_spec.rb
|
254
|
-
- spec/units/classes/episode_spec.rb
|
255
|
-
- spec/units/classes/response/actors_spec.rb
|
256
|
-
- spec/units/classes/response/banners_spec.rb
|
257
|
-
- spec/units/classes/response/collection_spec.rb
|
258
|
-
- spec/units/classes/response/episode_spec.rb
|
259
|
-
- spec/units/classes/response/full_series_spec.rb
|
260
|
-
- spec/units/classes/response/search_multiple_episode_spec.rb
|
261
|
-
- spec/units/classes/response/search_multiple_series_spec.rb
|
262
|
-
- spec/units/classes/response/search_series_spec.rb
|
263
|
-
- spec/units/classes/response/series_spec.rb
|
264
|
-
- spec/units/classes/response/update_spec.rb
|
265
|
-
- spec/units/classes/response_spec.rb
|
266
|
-
- spec/units/classes/search_spec.rb
|
267
|
-
- spec/units/classes/series_spec.rb
|
268
|
-
- spec/units/classes/update_spec.rb
|
269
|
-
- spec/units/unit_spec_helper.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module ThetvdbApi
|
2
|
-
module Generators
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../../templates', __FILE__)
|
5
|
-
|
6
|
-
desc 'Creates a ThetvdbApi::Configuration initializer and copy locale files to your application.'
|
7
|
-
def copy_initializer
|
8
|
-
template 'thetvdb_api.rb', 'config/initializers/thetvdb_api.rb'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class ThetvdbApi::Response::FullSeries < ThetvdbApi::Response
|
2
|
-
def parse
|
3
|
-
unless @parse
|
4
|
-
@parse = xml_parse
|
5
|
-
episode_normalize
|
6
|
-
end
|
7
|
-
@parse
|
8
|
-
end
|
9
|
-
|
10
|
-
def xml_parse
|
11
|
-
multi_xml_parse.fetch('Data', {})
|
12
|
-
end
|
13
|
-
|
14
|
-
def episode_normalize
|
15
|
-
normalize('Episode')
|
16
|
-
end
|
17
|
-
|
18
|
-
def normalize(key)
|
19
|
-
@parse[key] = [@parse[key]] if @parse[key].is_a?(Hash)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class ThetvdbApi::Response::Update < ThetvdbApi::Response
|
2
|
-
def parse
|
3
|
-
unless @parse
|
4
|
-
@parse = xml_parse
|
5
|
-
series_normalize
|
6
|
-
episode_normalize
|
7
|
-
banner_normalize
|
8
|
-
end
|
9
|
-
@parse
|
10
|
-
end
|
11
|
-
|
12
|
-
def xml_parse
|
13
|
-
multi_xml_parse.fetch('Data', {})
|
14
|
-
end
|
15
|
-
|
16
|
-
def series_normalize
|
17
|
-
normalize('Series')
|
18
|
-
end
|
19
|
-
|
20
|
-
def episode_normalize
|
21
|
-
normalize('Episode')
|
22
|
-
end
|
23
|
-
|
24
|
-
def banner_normalize
|
25
|
-
normalize('Banner')
|
26
|
-
end
|
27
|
-
|
28
|
-
def normalize(key)
|
29
|
-
@parse[key] = [@parse[key]] if @parse[key].is_a?(Hash)
|
30
|
-
end
|
31
|
-
end
|
data/lib/thetvdb_api/response.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'multi_xml'
|
2
|
-
|
3
|
-
class ThetvdbApi::Response
|
4
|
-
def initialize(faraday_response, mapping = false)
|
5
|
-
@faraday_response = faraday_response
|
6
|
-
@mapping = mapping
|
7
|
-
end
|
8
|
-
|
9
|
-
def env
|
10
|
-
@faraday_response.env
|
11
|
-
end
|
12
|
-
|
13
|
-
def status
|
14
|
-
@faraday_response.status
|
15
|
-
end
|
16
|
-
|
17
|
-
def headers
|
18
|
-
@faraday_response.headers
|
19
|
-
end
|
20
|
-
|
21
|
-
def body
|
22
|
-
@body ||= @mapping ? parse : @faraday_response.body
|
23
|
-
end
|
24
|
-
|
25
|
-
def inspect
|
26
|
-
body.inspect
|
27
|
-
end
|
28
|
-
|
29
|
-
def [](key)
|
30
|
-
parse[key]
|
31
|
-
end
|
32
|
-
|
33
|
-
def []=(key, value)
|
34
|
-
parse[key] = value
|
35
|
-
end
|
36
|
-
|
37
|
-
def each(&block)
|
38
|
-
parse.each(&block)
|
39
|
-
end
|
40
|
-
|
41
|
-
def multi_xml_parse
|
42
|
-
MultiXml.parse(@faraday_response.body)
|
43
|
-
end
|
44
|
-
|
45
|
-
def xml_parse
|
46
|
-
multi_xml_parse
|
47
|
-
end
|
48
|
-
|
49
|
-
def parse
|
50
|
-
@parse ||= xml_parse
|
51
|
-
end
|
52
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'functionals/functional_spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbApi::Actor do
|
4
|
-
include StubFaraday
|
5
|
-
|
6
|
-
let(:model) { ThetvdbApi::Actor.new(ThetvdbApi::Client.new) }
|
7
|
-
|
8
|
-
let(:faraday_stubs) do
|
9
|
-
Faraday::Adapter::Test::Stubs.new do |stub|
|
10
|
-
stub.get('/api/123456789/series/1234/actors.xml') { [200, {}, File.read('spec/fixtures/actors.xml')] }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def actor_keys
|
15
|
-
['id', 'Image', 'Name', 'Role', 'SortOrder'].sort
|
16
|
-
end
|
17
|
-
|
18
|
-
before do
|
19
|
-
stub_request(model, faraday_stubs)
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '.find' do
|
23
|
-
it 'should return string without mapping' do
|
24
|
-
model.find(1234).body.class.should == String
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'with mapping' do
|
28
|
-
it 'should return Array' do
|
29
|
-
model.find(1234, mapping: true).body.class.should == Array
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should return not empty Array' do
|
33
|
-
model.find(1234, mapping: true).body.should_not be_empty
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should return specific keys for first element' do
|
37
|
-
model.find(1234, mapping: true).body.first.keys.sort.should == actor_keys
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'functionals/functional_spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbApi::Banner do
|
4
|
-
include StubFaraday
|
5
|
-
|
6
|
-
let(:model) { ThetvdbApi::Banner.new(ThetvdbApi::Client.new) }
|
7
|
-
|
8
|
-
let(:faraday_stubs) do
|
9
|
-
Faraday::Adapter::Test::Stubs.new do |stub|
|
10
|
-
stub.get('/api/123456789/series/1234/banners.xml') { [200, {}, File.read('spec/fixtures/banners.xml')] }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def banner_keys
|
15
|
-
['id', 'BannerPath', 'BannerType', 'BannerType2', 'Colors', 'Language', 'Rating', 'RatingCount', 'SeriesName',
|
16
|
-
'ThumbnailPath', 'VignettePath'].sort
|
17
|
-
end
|
18
|
-
|
19
|
-
before do
|
20
|
-
stub_request(model, faraday_stubs)
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '.find' do
|
24
|
-
it 'should return string without mapping' do
|
25
|
-
model.find(1234).body.class.should == String
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'with mapping' do
|
29
|
-
it 'should return Array' do
|
30
|
-
model.find(1234, mapping: true).body.class.should == Array
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should return not empty Array' do
|
34
|
-
model.find(1234, mapping: true).body.should_not be_empty
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should return specific keys for first element' do
|
38
|
-
model.find(1234, mapping: true).body.first.keys.sort.should == banner_keys
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'functionals/functional_spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbApi::Episode do
|
4
|
-
include StubFaraday
|
5
|
-
|
6
|
-
let(:model) { ThetvdbApi::Episode.new(ThetvdbApi::Client.new) }
|
7
|
-
|
8
|
-
let(:episode_data) { File.read('spec/fixtures/episode.xml') }
|
9
|
-
|
10
|
-
let(:faraday_stubs) do
|
11
|
-
Faraday::Adapter::Test::Stubs.new do |stub|
|
12
|
-
stub.get('/api/123456789/series/1234/default/1/1/en.xml') { [200, {}, episode_data] }
|
13
|
-
stub.get('/api/123456789/series/1234/dvd/1/1/en.xml') { [200, {}, episode_data] }
|
14
|
-
stub.get('/api/123456789/series/1234/absolute/1/en.xml') { [200, {}, episode_data] }
|
15
|
-
stub.get('/api/123456789/episodes/1234/en.xml') { [200, {}, episode_data] }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def episode_keys
|
20
|
-
['id', 'seasonid', 'EpisodeNumber', 'EpisodeName', 'FirstAired', 'GuestStars', 'Director', 'Writer', 'Overview',
|
21
|
-
'ProductionCode', 'lastupdated', 'flagged', 'DVD_discid', 'DVD_season', 'DVD_episodenumber', 'DVD_chapter',
|
22
|
-
'absolute_number', 'filename', 'seriesid', 'thumb_added', 'thumb_width', 'thumb_height', 'tms_export',
|
23
|
-
'mirrorupdate', 'IMDB_ID', 'EpImgFlag', 'Rating', 'SeasonNumber', 'Language'].sort
|
24
|
-
end
|
25
|
-
|
26
|
-
before do
|
27
|
-
stub_request(model, faraday_stubs)
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '.find_by_default_order' do
|
31
|
-
it 'should return string without mapping' do
|
32
|
-
model.find_by_default_order(1234, 1, 1).body.class.should == String
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'with mapping' do
|
36
|
-
it 'should return Hash' do
|
37
|
-
model.find_by_default_order(1234, 1, 1, mapping: true).body.class.should == Hash
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should return specific keys' do
|
41
|
-
model.find_by_default_order(1234, 1, 1, mapping: true).body.keys.sort.should == episode_keys
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '.find_by_dvd_order' do
|
47
|
-
it 'should return string without mapping' do
|
48
|
-
model.find_by_dvd_order(1234, 1, 1).body.class.should == String
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'with mapping' do
|
52
|
-
it 'should return Hash' do
|
53
|
-
model.find_by_dvd_order(1234, 1, 1, mapping: true).body.class.should == Hash
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should return specific keys' do
|
57
|
-
model.find_by_dvd_order(1234, 1, 1, mapping: true).body.keys.sort.should == episode_keys
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '.find_by_absolute_order' do
|
63
|
-
it 'should return string without mapping' do
|
64
|
-
model.find_by_absolute_order(1234, 1).body.class.should == String
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'with mapping' do
|
68
|
-
it 'should return Hash' do
|
69
|
-
model.find_by_absolute_order(1234, 1, mapping: true).body.class.should == Hash
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should return specific keys' do
|
73
|
-
model.find_by_absolute_order(1234, 1, mapping: true).body.keys.sort.should == episode_keys
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '.find' do
|
79
|
-
it 'should return string without mapping' do
|
80
|
-
model.find(1234).body.class.should == String
|
81
|
-
end
|
82
|
-
|
83
|
-
describe 'with mapping' do
|
84
|
-
it 'should return Hash' do
|
85
|
-
model.find(1234, mapping: true).body.class.should == Hash
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'should return specific keys' do
|
89
|
-
model.find(1234, mapping: true).body.keys.sort.should == episode_keys
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|