thetvdb_api 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -15
- data/CHANGELOG.md +53 -0
- data/README.md +80 -103
- data/lib/thetvdb_api/actor.rb +18 -11
- data/lib/thetvdb_api/banner.rb +18 -11
- data/lib/thetvdb_api/base.rb +24 -0
- data/lib/thetvdb_api/episode.rb +68 -48
- data/lib/thetvdb_api/search.rb +85 -28
- data/lib/thetvdb_api/series.rb +36 -22
- data/lib/thetvdb_api/update.rb +8 -4
- data/lib/thetvdb_api/version.rb +1 -1
- data/spec/functionals/actor_spec.rb +26 -6
- data/spec/functionals/banner_spec.rb +26 -6
- data/spec/functionals/base_spec.rb +79 -0
- data/spec/functionals/episode_spec.rb +120 -28
- data/spec/functionals/search_spec.rb +143 -25
- data/spec/functionals/series_spec.rb +54 -14
- data/spec/functionals/update_spec.rb +12 -12
- data/spec/integrations/actor_spec.rb +14 -0
- data/spec/integrations/banner_spec.rb +14 -0
- data/spec/integrations/client_spec.rb +150 -0
- data/spec/integrations/episode_spec.rb +43 -0
- data/spec/integrations/search_spec.rb +41 -0
- data/spec/integrations/series_spec.rb +23 -0
- data/spec/integrations/update_spec.rb +32 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/support/.keep +0 -0
- data/spec/support/api_key.rb.example +1 -0
- data/thetvdb_api.gemspec +2 -2
- metadata +29 -24
- data/spec/integrations/classes/actor_spec.rb +0 -13
- data/spec/integrations/classes/banner_spec.rb +0 -13
- data/spec/integrations/classes/client_spec.rb +0 -109
- data/spec/integrations/classes/episode_spec.rb +0 -31
- data/spec/integrations/classes/search_spec.rb +0 -31
- data/spec/integrations/classes/series_spec.rb +0 -19
- data/spec/integrations/classes/update_spec.rb +0 -31
- data/spec/integrations/integration_spec_helper.rb +0 -2
data/lib/thetvdb_api/search.rb
CHANGED
@@ -2,21 +2,28 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
2
2
|
# Find the series data based on its name.
|
3
3
|
#
|
4
4
|
# access: FREE
|
5
|
-
# param
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
|
5
|
+
# param (flat params):
|
6
|
+
# get_series(series name)
|
7
|
+
# get_series('Buffy')
|
8
|
+
# param (hash params):
|
9
|
+
# get_series(name: 'Buffy')
|
10
|
+
# output: Faraday::Response instance with parsed XML string
|
11
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeries
|
12
|
+
def get_series(*options)
|
13
|
+
get_series_path_with_params(*options).get
|
10
14
|
end
|
11
15
|
|
12
16
|
# Find the series data based on its name - return only url.
|
13
17
|
#
|
14
18
|
# access: FREE
|
15
|
-
# param
|
16
|
-
#
|
19
|
+
# param (flat params):
|
20
|
+
# get_series_url(series name)
|
21
|
+
# get_series_url('Buffy')
|
22
|
+
# param (hash params):
|
23
|
+
# get_series_url(name: 'Buffy')
|
17
24
|
# output: url string
|
18
|
-
def get_series_url(options
|
19
|
-
get_series_path_with_params(options).url
|
25
|
+
def get_series_url(*options)
|
26
|
+
get_series_path_with_params(*options).url
|
20
27
|
end
|
21
28
|
|
22
29
|
# Find the series data by unique ID's used on other sites.
|
@@ -25,7 +32,8 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
25
32
|
# param: options hash
|
26
33
|
# imdbid: IMDb ID (don't use with zap2itid)
|
27
34
|
# zap2itid: Zap2it ID (don't use with imdbid)
|
28
|
-
# output: XML string
|
35
|
+
# output: Faraday::Response instance with parsed XML string
|
36
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
29
37
|
def get_series_by_remote_id(options = {})
|
30
38
|
get_series_by_remote_id_path_with_params(options).get
|
31
39
|
end
|
@@ -34,43 +42,92 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
34
42
|
#
|
35
43
|
# access: FREE
|
36
44
|
# param: options hash
|
37
|
-
#
|
45
|
+
# imdbid: IMDb ID (don't use with zap2itid)
|
38
46
|
# zap2itid: Zap2it ID (don't use with imdbid)
|
39
47
|
# output: url string
|
40
48
|
def get_series_by_remote_id_url(options = {})
|
41
49
|
get_series_by_remote_id_path_with_params(options).url
|
42
50
|
end
|
43
51
|
|
52
|
+
# Find the series data by unique IMDB ID
|
53
|
+
#
|
54
|
+
# access: FREE
|
55
|
+
# param (flat params):
|
56
|
+
# get_series_by_imdb_id(imdb_id)
|
57
|
+
# get_series_by_imdb_id('tt01234')
|
58
|
+
# output: Faraday::Response instance with parsed XML string
|
59
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
60
|
+
def get_series_by_imdb_id(imdb_id)
|
61
|
+
get_series_by_remote_id_path_with_params({ imdbid: imdb_id }).get
|
62
|
+
end
|
63
|
+
|
64
|
+
# Find the series data by unique IMDB ID - return only url.
|
65
|
+
#
|
66
|
+
# access: FREE
|
67
|
+
# param (flat params):
|
68
|
+
# get_series_by_imdb_id_url(imdb_id)
|
69
|
+
# get_series_by_imdb_id_url('tt01234')
|
70
|
+
# output: url string
|
71
|
+
def get_series_by_imdb_id_url(imdb_id)
|
72
|
+
get_series_by_remote_id_path_with_params({ imdbid: imdb_id }).url
|
73
|
+
end
|
44
74
|
|
45
|
-
# Find the
|
75
|
+
# Find the series data by unique zap2it ID
|
76
|
+
#
|
77
|
+
# access: FREE
|
78
|
+
# param (flat params):
|
79
|
+
# get_series_by_zap2it_id(zap2it_id)
|
80
|
+
# get_series_by_zap2it_id('SH01234')
|
81
|
+
# output: Faraday::Response instance with parsed XML string
|
82
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID
|
83
|
+
def get_series_by_zap2it_id(zap2it_id)
|
84
|
+
get_series_by_remote_id_path_with_params({ zap2itid: zap2it_id }).get
|
85
|
+
end
|
86
|
+
|
87
|
+
# Find the series data by unique zap2it ID - return only url.
|
46
88
|
#
|
47
89
|
# access: FREE
|
48
90
|
# param: options hash
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
|
91
|
+
# get_series_by_zap2it_id_url(zap2it_id)
|
92
|
+
# get_series_by_zap2it_id_url('SH01234')
|
93
|
+
# output: url string
|
94
|
+
def get_series_by_zap2it_id_url(zap2it_id)
|
95
|
+
get_series_by_remote_id_path_with_params({ zap2itid: zap2it_id }).url
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
# Find the episode data by episode air date.
|
100
|
+
#
|
101
|
+
# access: FREE
|
102
|
+
# param (flat params):
|
103
|
+
# get_episode(series_id, air date)
|
104
|
+
# get_episode(1234, '2000-01-01')
|
105
|
+
# param (hash params):
|
106
|
+
# get_episode(series_id: 1234, air_date: '2000-01-01')
|
107
|
+
# output: Faraday::Response instance with parsed XML string
|
108
|
+
# example: http://thetvdb.com/wiki/index.php/API:GetEpisodeByAirDate
|
109
|
+
def get_episode(*options)
|
110
|
+
get_episode_path_with_params(*options).get
|
55
111
|
end
|
56
112
|
|
57
113
|
|
58
114
|
# Find the episode data by episode air date - return only url.
|
59
115
|
#
|
60
116
|
# access: FREE
|
61
|
-
# param
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
117
|
+
# param (flat params):
|
118
|
+
# get_episode_url(series_id, air date)
|
119
|
+
# get_episode_url(1234, '2000-01-01')
|
120
|
+
# param (hash params):
|
121
|
+
# get_episode_url(series_id: 1234, air_date: '2000-01-01')
|
65
122
|
# output: url string
|
66
|
-
def get_episode_url(options
|
67
|
-
get_episode_path_with_params(options).url
|
123
|
+
def get_episode_url(*options)
|
124
|
+
get_episode_path_with_params(*options).url
|
68
125
|
end
|
69
126
|
|
70
127
|
private
|
71
128
|
|
72
|
-
def get_series_path_with_params(options)
|
73
|
-
path(get_series_path).params(language_options.merge(options))
|
129
|
+
def get_series_path_with_params(*options)
|
130
|
+
path(get_series_path).params(language_options.merge(normalize_series_name_options(*options)))
|
74
131
|
end
|
75
132
|
|
76
133
|
def get_series_path
|
@@ -85,8 +142,8 @@ class ThetvdbApi::Search < ThetvdbApi::Base
|
|
85
142
|
'GetSeriesByRemoteID.php'
|
86
143
|
end
|
87
144
|
|
88
|
-
def get_episode_path_with_params(options)
|
89
|
-
path(get_episode_path).params(api_key_with_language_options.merge(options))
|
145
|
+
def get_episode_path_with_params(*options)
|
146
|
+
path(get_episode_path).params(api_key_with_language_options.merge(normalize_series_id_air_date_options(*options)))
|
90
147
|
end
|
91
148
|
|
92
149
|
def get_episode_path
|
data/lib/thetvdb_api/series.rb
CHANGED
@@ -2,55 +2,69 @@ class ThetvdbApi::Series < ThetvdbApi::Base
|
|
2
2
|
# Find the series data by series id.
|
3
3
|
#
|
4
4
|
# access: FREE
|
5
|
-
# param
|
6
|
-
# series_id
|
7
|
-
#
|
8
|
-
|
9
|
-
|
5
|
+
# param (flat params):
|
6
|
+
# find(series_id)
|
7
|
+
# find(1234)
|
8
|
+
# param (hash params):
|
9
|
+
# find(series_id: 1234)
|
10
|
+
# output: Faraday::Response instance with parsed XML string
|
11
|
+
# example: http://thetvdb.com/wiki/index.php/API:Base_Series_Record
|
12
|
+
def find(*options)
|
13
|
+
find_path_with_params(*options).get
|
10
14
|
end
|
11
15
|
|
12
16
|
# Find the series data by series id - return only url.
|
13
17
|
#
|
14
18
|
# access: FREE
|
15
|
-
# param
|
16
|
-
# series_id
|
19
|
+
# param (flat params):
|
20
|
+
# find_url(series_id)
|
21
|
+
# find_url(1234)
|
22
|
+
# param (hash params):
|
23
|
+
# find_url(series_id: 1234)
|
17
24
|
# output: url string
|
18
|
-
def find_url(options
|
19
|
-
find_path_with_params(options).url
|
25
|
+
def find_url(*options)
|
26
|
+
find_path_with_params(*options).url
|
20
27
|
end
|
21
28
|
|
22
29
|
# Find the full series data by series id.
|
23
30
|
#
|
24
31
|
# access: FREE
|
25
|
-
# param
|
26
|
-
# series_id
|
27
|
-
#
|
28
|
-
|
29
|
-
|
32
|
+
# param (flat params):
|
33
|
+
# find_full(series_id)
|
34
|
+
# find_full(1234)
|
35
|
+
# param (hash params):
|
36
|
+
# find_full(series_id: 1234)
|
37
|
+
# output: Faraday::Response instance with parsed XML string
|
38
|
+
# example: http://thetvdb.com/wiki/index.php/API:Full_Series_Record
|
39
|
+
def find_full(*options)
|
40
|
+
find_full_path_with_params(*options).get
|
30
41
|
end
|
31
42
|
|
32
43
|
# Find the full series data by series id - return only url.
|
33
44
|
#
|
34
45
|
# access: FREE
|
35
|
-
# param
|
36
|
-
# series_id
|
46
|
+
# param (flat params):
|
47
|
+
# find_full_url(series_id)
|
48
|
+
# find_full_url(1234)
|
49
|
+
# param (hash params):
|
50
|
+
# find_full_url(series_id: 1234)
|
37
51
|
# output: url string
|
38
|
-
def find_full_url(options
|
39
|
-
find_full_path_with_params(options).url
|
52
|
+
def find_full_url(*options)
|
53
|
+
find_full_path_with_params(*options).url
|
40
54
|
end
|
41
55
|
|
42
56
|
private
|
43
57
|
|
44
|
-
def find_path_with_params(options)
|
45
|
-
path(find_path).params(api_key_with_language_options.merge(options))
|
58
|
+
def find_path_with_params(*options)
|
59
|
+
path(find_path).params(api_key_with_language_options.merge(normalize_series_id_options(*options)))
|
46
60
|
end
|
47
61
|
|
48
62
|
def find_path
|
49
63
|
':apikey/series/:series_id/:language.xml'
|
50
64
|
end
|
51
65
|
|
52
|
-
def find_full_path_with_params(options)
|
53
|
-
path(find_full_path).params(api_key_with_language_options.merge(options))
|
66
|
+
def find_full_path_with_params(*options)
|
67
|
+
path(find_full_path).params(api_key_with_language_options.merge(normalize_series_id_options(*options)))
|
54
68
|
end
|
55
69
|
|
56
70
|
def find_full_path
|
data/lib/thetvdb_api/update.rb
CHANGED
@@ -2,7 +2,8 @@ class ThetvdbApi::Update < ThetvdbApi::Base
|
|
2
2
|
# Find update data.
|
3
3
|
#
|
4
4
|
# access: FREE
|
5
|
-
# output: XML string
|
5
|
+
# output: Faraday::Response instance with parsed XML string
|
6
|
+
# example: http://thetvdb.com/wiki/index.php/API:Update_Records
|
6
7
|
def day
|
7
8
|
day_path_with_params.get
|
8
9
|
end
|
@@ -18,7 +19,8 @@ class ThetvdbApi::Update < ThetvdbApi::Base
|
|
18
19
|
# Find update data.
|
19
20
|
#
|
20
21
|
# access: FREE
|
21
|
-
# output: XML string
|
22
|
+
# output: Faraday::Response instance with parsed XML string
|
23
|
+
# example: http://thetvdb.com/wiki/index.php/API:Update_Records
|
22
24
|
def week
|
23
25
|
week_path_with_params.get
|
24
26
|
end
|
@@ -34,7 +36,8 @@ class ThetvdbApi::Update < ThetvdbApi::Base
|
|
34
36
|
# Find update data.
|
35
37
|
#
|
36
38
|
# access: FREE
|
37
|
-
# output: XML string
|
39
|
+
# output: Faraday::Response instance with parsed XML string
|
40
|
+
# example: http://thetvdb.com/wiki/index.php/API:Update_Records
|
38
41
|
def month
|
39
42
|
month_path_with_params.get
|
40
43
|
end
|
@@ -50,7 +53,8 @@ class ThetvdbApi::Update < ThetvdbApi::Base
|
|
50
53
|
# Find update data.
|
51
54
|
#
|
52
55
|
# access: FREE
|
53
|
-
# output: XML string
|
56
|
+
# output: Faraday::Response instance with parsed XML string
|
57
|
+
# example: http://thetvdb.com/wiki/index.php/API:Update_Records
|
54
58
|
def all
|
55
59
|
all_path_with_params.get
|
56
60
|
end
|
data/lib/thetvdb_api/version.rb
CHANGED
@@ -13,18 +13,38 @@ describe ThetvdbApi::Actor do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '.find' do
|
16
|
-
|
17
|
-
|
16
|
+
context 'hash attributes' do
|
17
|
+
it 'should return Faraday::Response class' do
|
18
|
+
expect(model.find(series_id: 1234)).to be_a(Faraday::Response)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should return Hash class for body reponse' do
|
22
|
+
expect(model.find(series_id: 1234).body).to be_a(Hash)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
|
-
|
21
|
-
|
26
|
+
context 'normal attributes' do
|
27
|
+
it 'should return Faraday::Response class' do
|
28
|
+
expect(model.find(1234)).to be_a(Faraday::Response)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should return Hash class for body reponse' do
|
32
|
+
expect(model.find(1234).body).to be_a(Hash)
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
25
37
|
describe '.find_url' do
|
26
|
-
|
27
|
-
|
38
|
+
context 'hash attributes' do
|
39
|
+
it 'should return correct url' do
|
40
|
+
expect(model.find_url(series_id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/actors.xml')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'normal attributes' do
|
45
|
+
it 'should return correct url' do
|
46
|
+
expect(model.find_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/actors.xml')
|
47
|
+
end
|
28
48
|
end
|
29
49
|
end
|
30
50
|
end
|
@@ -13,18 +13,38 @@ describe ThetvdbApi::Banner do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '.find' do
|
16
|
-
|
17
|
-
|
16
|
+
context 'hash attributes' do
|
17
|
+
it 'should return Faraday::Response class' do
|
18
|
+
expect(model.find(series_id: 1234)).to be_a(Faraday::Response)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should return Hash class for body reponse' do
|
22
|
+
expect(model.find(series_id: 1234).body).to be_a(Hash)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
|
-
|
21
|
-
|
26
|
+
context 'normal attributes' do
|
27
|
+
it 'should return Faraday::Response class' do
|
28
|
+
expect(model.find(1234)).to be_a(Faraday::Response)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should return Hash class for body reponse' do
|
32
|
+
expect(model.find(1234).body).to be_a(Hash)
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
25
37
|
describe '.find_url' do
|
26
|
-
|
27
|
-
|
38
|
+
context 'hash attributes' do
|
39
|
+
it 'should return correct url' do
|
40
|
+
expect(model.find_url(series_id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/banners.xml')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'normal attributes' do
|
45
|
+
it 'should return correct url' do
|
46
|
+
expect(model.find_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/banners.xml')
|
47
|
+
end
|
28
48
|
end
|
29
49
|
end
|
30
50
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class SampleClass < ThetvdbApi::Base; end
|
4
|
+
|
5
|
+
describe ThetvdbApi::Base do
|
6
|
+
let(:model) { SampleClass.new({}) }
|
7
|
+
|
8
|
+
describe '.normalize_series_id_options' do
|
9
|
+
it 'return correct hash with normal attributes' do
|
10
|
+
expect(model.normalize_series_id_options(1234)).
|
11
|
+
to eq({ series_id: 1234 })
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'return correct hash with hash attributes' do
|
15
|
+
expect(model.normalize_series_id_options(series_id: 1234)).
|
16
|
+
to eq({ series_id: 1234 })
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.normalize_series_id_absolute_options' do
|
21
|
+
it 'return correct hash with normal attributes' do
|
22
|
+
expect(model.normalize_series_id_absolute_options(1234, 1)).
|
23
|
+
to eq({ series_id: 1234, absolute: 1 })
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'return correct hash with hash attributes' do
|
27
|
+
expect(model.normalize_series_id_absolute_options(series_id: 1234, absolute: 1)).
|
28
|
+
to eq({ series_id: 1234, absolute: 1 })
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '.normalize_series_id_episode_options' do
|
33
|
+
it 'normalize_series_id_episode_options' do
|
34
|
+
expect(model.normalize_series_id_episode_options(1234, 1, 2)).
|
35
|
+
to eq({ series_id: 1234, season: 1, episode: 2 })
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'return correct hash with hash attributes' do
|
39
|
+
expect(model.normalize_series_id_episode_options(series_id: 1234, season: 1, episode: 2)).
|
40
|
+
to eq({ series_id: 1234, season: 1, episode: 2 })
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '.normalize_episode_id_options' do
|
45
|
+
it 'return correct hash with normal attributes' do
|
46
|
+
expect(model.normalize_episode_id_options(1234)).
|
47
|
+
to eq({ episode_id: 1234 })
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'return correct hash with hash attributes' do
|
51
|
+
expect(model.normalize_episode_id_options(episode_id: 1234)).
|
52
|
+
to eq({ episode_id: 1234 })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '.normalize_series_name_options' do
|
57
|
+
it 'return correct hash with normal attributes' do
|
58
|
+
expect(model.normalize_series_name_options('Buffy')).
|
59
|
+
to eq({ seriesname: 'Buffy' })
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'return correct hash with hash attributes' do
|
63
|
+
expect(model.normalize_series_name_options(name: 'Buffy')).
|
64
|
+
to eq({ seriesname: 'Buffy' })
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '.normalize_series_id_air_date_options' do
|
69
|
+
it 'return correct hash with normal attributes' do
|
70
|
+
expect(model.normalize_series_id_air_date_options('1234', '2000-01-01')).
|
71
|
+
to eq({ seriesid: '1234', airdate: '2000-01-01' })
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'return correct hash with hash attributes' do
|
75
|
+
expect(model.normalize_series_id_air_date_options(series_id: '1234', air_date: '2000-01-01')).
|
76
|
+
to eq({ seriesid: '1234', airdate: '2000-01-01' })
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -16,70 +16,162 @@ describe ThetvdbApi::Episode do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '.find_by_default_order' do
|
19
|
-
|
20
|
-
|
19
|
+
context 'hash attributes' do
|
20
|
+
it 'should return Faraday::Response class' do
|
21
|
+
expect(model.find_by_default_order(series_id: 1234, season: 1, episode: 1)).to be_a(Faraday::Response)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return Hash class for body reponse' do
|
25
|
+
expect(model.find_by_default_order(series_id: 1234, season: 1, episode: 1).body).to be_a(Hash)
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
|
-
|
24
|
-
|
29
|
+
context 'normal attributes' do
|
30
|
+
it 'should return Faraday::Response class' do
|
31
|
+
expect(model.find_by_default_order(1234, 1, 1)).to be_a(Faraday::Response)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should return Hash class for body reponse' do
|
35
|
+
expect(model.find_by_default_order(1234, 1, 1).body).to be_a(Hash)
|
36
|
+
end
|
25
37
|
end
|
26
38
|
end
|
27
39
|
|
28
40
|
describe '.find_by_default_order_url' do
|
29
|
-
|
30
|
-
|
31
|
-
|
41
|
+
context 'hash attributes' do
|
42
|
+
it 'should return correct url' do
|
43
|
+
expect(
|
44
|
+
model.find_by_default_order_url(series_id: 1234, season: 1, episode: 1)
|
45
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/default/1/1/en.xml')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'normal attributes' do
|
50
|
+
it 'should return correct url' do
|
51
|
+
expect(
|
52
|
+
model.find_by_default_order_url(1234, 1, 1)
|
53
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/default/1/1/en.xml')
|
54
|
+
end
|
32
55
|
end
|
33
56
|
end
|
34
57
|
|
35
58
|
describe '.find_by_dvd_order' do
|
36
|
-
|
37
|
-
|
59
|
+
context 'hash attributes' do
|
60
|
+
it 'should return Faraday::Response class' do
|
61
|
+
expect(model.find_by_dvd_order(series_id: 1234, season: 1, episode: 1)).to be_a(Faraday::Response)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should return Hash class for body reponse' do
|
65
|
+
expect(model.find_by_dvd_order(series_id: 1234, season: 1, episode: 1).body).to be_a(Hash)
|
66
|
+
end
|
38
67
|
end
|
39
68
|
|
40
|
-
|
41
|
-
|
69
|
+
context 'normal attributes' do
|
70
|
+
it 'should return Faraday::Response class' do
|
71
|
+
expect(model.find_by_dvd_order(1234, 1, 1)).to be_a(Faraday::Response)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should return Hash class for body reponse' do
|
75
|
+
expect(model.find_by_dvd_order(1234, 1, 1).body).to be_a(Hash)
|
76
|
+
end
|
42
77
|
end
|
43
78
|
end
|
44
79
|
|
45
80
|
describe '.find_by_dvd_order_url' do
|
46
|
-
|
47
|
-
|
48
|
-
|
81
|
+
context 'hash attributes' do
|
82
|
+
it 'should return correct url' do
|
83
|
+
expect(
|
84
|
+
model.find_by_dvd_order_url(series_id: 1234, season: 1, episode: 1)
|
85
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/dvd/1/1/en.xml')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'normal attributes' do
|
90
|
+
it 'should return correct url' do
|
91
|
+
expect(
|
92
|
+
model.find_by_dvd_order_url(1234, 1, 1)
|
93
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/dvd/1/1/en.xml')
|
94
|
+
end
|
49
95
|
end
|
50
96
|
end
|
51
97
|
|
52
98
|
describe '.find_by_absolute_order' do
|
53
|
-
|
54
|
-
|
99
|
+
context 'hash attributes' do
|
100
|
+
it 'should return Faraday::Response class' do
|
101
|
+
expect(model.find_by_absolute_order(series_id: 1234, absolute: 1)).to be_a(Faraday::Response)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should return Hash class for body reponse' do
|
105
|
+
expect(model.find_by_absolute_order(series_id: 1234, absolute: 1).body).to be_a(Hash)
|
106
|
+
end
|
55
107
|
end
|
56
108
|
|
57
|
-
|
58
|
-
|
109
|
+
context 'normal attributes' do
|
110
|
+
it 'should return Faraday::Response class' do
|
111
|
+
expect(model.find_by_absolute_order(1234, 1)).to be_a(Faraday::Response)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should return Hash class for body reponse' do
|
115
|
+
expect(model.find_by_absolute_order(1234, 1).body).to be_a(Hash)
|
116
|
+
end
|
59
117
|
end
|
60
118
|
end
|
61
119
|
|
62
120
|
describe '.find_by_absolute_order_url' do
|
63
|
-
|
64
|
-
|
65
|
-
|
121
|
+
context 'hash attributes' do
|
122
|
+
it 'should return correct url' do
|
123
|
+
expect(
|
124
|
+
model.find_by_absolute_order_url(series_id: 1234, absolute: 1)
|
125
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/absolute/1/en.xml')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'normal attributes' do
|
130
|
+
it 'should return correct url' do
|
131
|
+
expect(
|
132
|
+
model.find_by_absolute_order_url(1234, 1)
|
133
|
+
).to eq('http://thetvdb.com/api/123456789/series/1234/absolute/1/en.xml')
|
134
|
+
end
|
66
135
|
end
|
67
136
|
end
|
68
137
|
|
69
138
|
describe '.find' do
|
70
|
-
|
71
|
-
|
139
|
+
context 'hash attributes' do
|
140
|
+
it 'should return Faraday::Response class' do
|
141
|
+
expect(model.find(episode_id: 1234)).to be_a(Faraday::Response)
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should return Hash class for body reponse' do
|
145
|
+
expect(model.find(episode_id: 1234).body).to be_a(Hash)
|
146
|
+
end
|
72
147
|
end
|
73
148
|
|
74
|
-
|
75
|
-
|
149
|
+
context 'normal attributes' do
|
150
|
+
it 'should return Faraday::Response class' do
|
151
|
+
expect(model.find(1234)).to be_a(Faraday::Response)
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should return Hash class for body reponse' do
|
155
|
+
expect(model.find(1234).body).to be_a(Hash)
|
156
|
+
end
|
76
157
|
end
|
77
158
|
end
|
78
159
|
|
79
160
|
describe '.find_url' do
|
80
|
-
|
81
|
-
|
82
|
-
|
161
|
+
context 'hash attributes' do
|
162
|
+
it 'should return correct url' do
|
163
|
+
expect(
|
164
|
+
model.find_url(episode_id: 1234)
|
165
|
+
).to eq('http://thetvdb.com/api/123456789/episodes/1234/en.xml')
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'normal attributes' do
|
170
|
+
it 'should return correct url' do
|
171
|
+
expect(
|
172
|
+
model.find_url(1234)
|
173
|
+
).to eq('http://thetvdb.com/api/123456789/episodes/1234/en.xml')
|
174
|
+
end
|
83
175
|
end
|
84
176
|
end
|
85
177
|
end
|