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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -15
  3. data/CHANGELOG.md +53 -0
  4. data/README.md +80 -103
  5. data/lib/thetvdb_api/actor.rb +18 -11
  6. data/lib/thetvdb_api/banner.rb +18 -11
  7. data/lib/thetvdb_api/base.rb +24 -0
  8. data/lib/thetvdb_api/episode.rb +68 -48
  9. data/lib/thetvdb_api/search.rb +85 -28
  10. data/lib/thetvdb_api/series.rb +36 -22
  11. data/lib/thetvdb_api/update.rb +8 -4
  12. data/lib/thetvdb_api/version.rb +1 -1
  13. data/spec/functionals/actor_spec.rb +26 -6
  14. data/spec/functionals/banner_spec.rb +26 -6
  15. data/spec/functionals/base_spec.rb +79 -0
  16. data/spec/functionals/episode_spec.rb +120 -28
  17. data/spec/functionals/search_spec.rb +143 -25
  18. data/spec/functionals/series_spec.rb +54 -14
  19. data/spec/functionals/update_spec.rb +12 -12
  20. data/spec/integrations/actor_spec.rb +14 -0
  21. data/spec/integrations/banner_spec.rb +14 -0
  22. data/spec/integrations/client_spec.rb +150 -0
  23. data/spec/integrations/episode_spec.rb +43 -0
  24. data/spec/integrations/search_spec.rb +41 -0
  25. data/spec/integrations/series_spec.rb +23 -0
  26. data/spec/integrations/update_spec.rb +32 -0
  27. data/spec/spec_helper.rb +1 -4
  28. data/spec/support/.keep +0 -0
  29. data/spec/support/api_key.rb.example +1 -0
  30. data/thetvdb_api.gemspec +2 -2
  31. metadata +29 -24
  32. data/spec/integrations/classes/actor_spec.rb +0 -13
  33. data/spec/integrations/classes/banner_spec.rb +0 -13
  34. data/spec/integrations/classes/client_spec.rb +0 -109
  35. data/spec/integrations/classes/episode_spec.rb +0 -31
  36. data/spec/integrations/classes/search_spec.rb +0 -31
  37. data/spec/integrations/classes/series_spec.rb +0 -19
  38. data/spec/integrations/classes/update_spec.rb +0 -31
  39. data/spec/integrations/integration_spec_helper.rb +0 -2
@@ -10,62 +10,180 @@ describe ThetvdbApi::Search do
10
10
 
11
11
  let(:faraday_stubs) do
12
12
  Faraday::Adapter::Test::Stubs.new do |stub|
13
- stub.get('/api/GetSeries.php?seriesname=Supernatural') { [200, {}, get_series_data] }
14
- stub.get('/api/GetSeriesByRemoteID.php?imdbid=tt0290978') { [200, {}, get_series_by_remote_data] }
15
- stub.get('/api/GetEpisodeByAirDate.php?airdate=2007-09-24&apikey=123456789&language=en&seriesid=80348') do
16
- [200, {}, get_episode_data]
13
+ stub.get('/api/GetSeries.php?language=en&seriesname=Supernatural') { [200, { content_type: 'xml' }, get_series_data] }
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&zap2itid=SH01234') { [200, { content_type: 'xml' }, get_series_by_remote_data] }
16
+ stub.get('/api/GetEpisodeByAirDate.php?language=en&airdate=2007-09-24&apikey=123456789&language=en&seriesid=80348') do
17
+ [200, { content_type: 'xml' }, get_episode_data]
17
18
  end
18
19
  end
19
20
  end
20
21
 
21
22
  describe '.get_series' do
22
- it 'should return Faraday::Response class' do
23
- model.get_series(seriesname: 'Supernatural').class.should == Faraday::Response
23
+ context 'hash attributes' do
24
+ it 'should return Faraday::Response class' do
25
+ expect(model.get_series(name: 'Supernatural')).to be_a(Faraday::Response)
26
+ end
27
+
28
+ it 'should return Hash class for body reponse' do
29
+ expect(model.get_series(name: 'Supernatural').body).to be_a(Hash)
30
+ end
24
31
  end
25
32
 
26
- it 'should return Hash class for body reponse' do
27
- model.get_series(seriesname: 'Supernatural').body == Hash
33
+ context 'normal attributes' do
34
+ it 'should return Faraday::Response class' do
35
+ expect(model.get_series('Supernatural')).to be_a(Faraday::Response)
36
+ end
37
+
38
+ it 'should return Hash class for body reponse' do
39
+ expect(model.get_series('Supernatural').body).to be_a(Hash)
40
+ end
28
41
  end
29
42
  end
30
43
 
31
44
  describe '.get_series_url' do
32
- it 'should return correct url' do
33
- model.get_series_url(seriesname: 'Supernatural').
34
- should == 'http://thetvdb.com/api/GetSeries.php?language=en&seriesname=Supernatural'
45
+ context 'hash attributes' do
46
+ it 'should return correct url' do
47
+ expect(
48
+ model.get_series_url(name: 'Supernatural')
49
+ ).to eq('http://thetvdb.com/api/GetSeries.php?language=en&seriesname=Supernatural')
50
+ end
51
+ end
52
+
53
+ context 'normal attributes' do
54
+ it 'should return correct url' do
55
+ expect(
56
+ model.get_series_url('Supernatural')
57
+ ).to eq('http://thetvdb.com/api/GetSeries.php?language=en&seriesname=Supernatural')
58
+ end
35
59
  end
36
60
  end
37
61
 
38
62
  describe '.get_series_by_remote_id' do
39
- it 'should return Faraday::Response class' do
40
- model.get_series_by_remote_id(imdbid: 'tt0290978').class.should == Faraday::Response
63
+ context 'hash attributes' do
64
+ it 'should return Faraday::Response class' do
65
+ expect(model.get_series_by_remote_id(imdbid: 'tt0290978')).to be_a(Faraday::Response)
66
+ end
67
+
68
+ it 'should return Hash class for body reponse' do
69
+ expect(model.get_series_by_remote_id(imdbid: 'tt0290978').body).to be_a(Hash)
70
+ end
41
71
  end
72
+ end
42
73
 
43
- it 'should return Hash class for body reponse' do
44
- model.get_series_by_remote_id(imdbid: 'tt0290978').body == Hash
74
+ describe '.get_series_by_remote_id_url' do
75
+ context 'hash attributes' do
76
+ it 'should return correct url' do
77
+ expect(
78
+ model.get_series_by_remote_id_url(imdbid: 'tt0290978')
79
+ ).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978')
80
+ end
81
+ end
82
+ end
83
+
84
+ describe '.get_series_by_remote_id' do
85
+ context 'hash attributes' do
86
+ it 'should return Faraday::Response class' do
87
+ expect(model.get_series_by_remote_id(zap2itid: 'SH01234')).to be_a(Faraday::Response)
88
+ end
89
+
90
+ it 'should return Hash class for body reponse' do
91
+ expect(model.get_series_by_remote_id(zap2itid: 'SH01234').body).to be_a(Hash)
92
+ end
45
93
  end
46
94
  end
47
95
 
48
96
  describe '.get_series_by_remote_id_url' do
49
- it 'should return correct url' do
50
- model.get_series_by_remote_id_url(imdbid: 'tt0290978').
51
- should == 'http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978'
97
+ context 'hash attributes' do
98
+ it 'should return correct url' do
99
+ expect(
100
+ model.get_series_by_remote_id_url(zap2itid: 'SH01234')
101
+ ).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&zap2itid=SH01234')
102
+ end
103
+ end
104
+ end
105
+
106
+ describe '.get_series_by_imdb_id' do
107
+ context 'normal attributes' do
108
+ it 'should return Faraday::Response class' do
109
+ expect(model.get_series_by_imdb_id('tt0290978')).to be_a(Faraday::Response)
110
+ end
111
+
112
+ it 'should return Hash class for body reponse' do
113
+ expect(model.get_series_by_imdb_id('tt0290978').body).to be_a(Hash)
114
+ end
115
+ end
116
+ end
117
+
118
+ describe '.get_series_by_imdb_id_url' do
119
+ context 'normal attributes' do
120
+ it 'should return correct url' do
121
+ expect(
122
+ model.get_series_by_imdb_id_url('tt0290978')
123
+ ).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&imdbid=tt0290978')
124
+ end
125
+ end
126
+ end
127
+
128
+ describe '.get_series_by_zap2it_id' do
129
+ context 'normal attributes' do
130
+ it 'should return Faraday::Response class' do
131
+ expect(model.get_series_by_zap2it_id('SH01234')).to be_a(Faraday::Response)
132
+ end
133
+
134
+ it 'should return Hash class for body reponse' do
135
+ expect(model.get_series_by_zap2it_id('SH01234').body).to be_a(Hash)
136
+ end
137
+ end
138
+ end
139
+
140
+ describe '.get_series_by_zap2it_id_url' do
141
+ context 'normal attributes' do
142
+ it 'should return correct url' do
143
+ expect(
144
+ model.get_series_by_zap2it_id_url('SH01234')
145
+ ).to eq('http://thetvdb.com/api/GetSeriesByRemoteID.php?language=en&zap2itid=SH01234')
146
+ end
52
147
  end
53
148
  end
54
149
 
55
150
  describe '.get_episode' do
56
- it 'should return Faraday::Response class' do
57
- model.get_episode(seriesid: 80348, airdate: '2007-09-24').class.should == Faraday::Response
151
+ context 'hash attributes' do
152
+ it 'should return Faraday::Response class' do
153
+ expect(model.get_episode(series_id: 80348, air_date: '2007-09-24')).to be_a(Faraday::Response)
154
+ end
155
+
156
+ it 'should return Hash class for body reponse' do
157
+ expect(model.get_episode(series_id: 80348, air_date: '2007-09-24').body).to be_a(Hash)
158
+ end
58
159
  end
59
160
 
60
- it 'should return Hash class for body reponse' do
61
- model.get_episode(seriesid: 80348, airdate: '2007-09-24').body == Hash
161
+ context 'normal attributes' do
162
+ it 'should return Faraday::Response class' do
163
+ expect(model.get_episode(80348, '2007-09-24')).to be_a(Faraday::Response)
164
+ end
165
+
166
+ it 'should return Hash class for body reponse' do
167
+ expect(model.get_episode(80348, '2007-09-24').body).to be_a(Hash)
168
+ end
62
169
  end
63
170
  end
64
171
 
65
172
  describe '.get_episode_url' do
66
- it 'should return correct url' do
67
- model.get_episode_url(seriesid: 80348, airdate: '2007-09-24').
68
- should == 'http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=123456789&language=en&seriesid=80348&airdate=2007-09-24'
173
+ context 'hash attributes' do
174
+ it 'should return correct url' do
175
+ expect(
176
+ model.get_episode_url(series_id: 80348, air_date: '2007-09-24')
177
+ ).to eq('http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=123456789&language=en&seriesid=80348&airdate=2007-09-24')
178
+ end
179
+ end
180
+
181
+ context 'normal attributes' do
182
+ it 'should return correct url' do
183
+ expect(
184
+ model.get_episode_url(80348, '2007-09-24')
185
+ ).to eq('http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=123456789&language=en&seriesid=80348&airdate=2007-09-24')
186
+ end
69
187
  end
70
188
  end
71
189
  end
@@ -9,40 +9,80 @@ describe ThetvdbApi::Series do
9
9
 
10
10
  let(:faraday_stubs) do
11
11
  Faraday::Adapter::Test::Stubs.new do |stub|
12
- stub.get('/api/123456789/series/1234/en.xml') { [200, {}, series_data] }
13
- stub.get('/api/123456789/series/1234/all/en.xml') { [200, {}, full_series_data] }
12
+ stub.get('/api/123456789/series/1234/en.xml') { [200, { content_type: 'xml' }, series_data] }
13
+ stub.get('/api/123456789/series/1234/all/en.xml') { [200, { content_type: 'xml' }, full_series_data] }
14
14
  end
15
15
  end
16
16
 
17
17
  describe '.find' do
18
- it 'should return Faraday::Response class' do
19
- model.find(series_id: 1234).class.should == Faraday::Response
18
+ context 'hash attributes' do
19
+ it 'should return Faraday::Response class' do
20
+ expect(model.find(series_id: 1234)).to be_a(Faraday::Response)
21
+ end
22
+
23
+ it 'should return Hash class for body reponse' do
24
+ expect(model.find(series_id: 1234).body).to be_a(Hash)
25
+ end
20
26
  end
21
27
 
22
- it 'should return Hash class for body reponse' do
23
- model.find(series_id: 1234).body == Hash
28
+ context 'normal attributes' do
29
+ it 'should return Faraday::Response class' do
30
+ expect(model.find(1234)).to be_a(Faraday::Response)
31
+ end
32
+
33
+ it 'should return Hash class for body reponse' do
34
+ expect(model.find(1234).body).to be_a(Hash)
35
+ end
24
36
  end
25
37
  end
26
38
 
27
39
  describe '.find_url' do
28
- it 'should return correct url' do
29
- model.find_url(series_id: 1234).should == 'http://thetvdb.com/api/123456789/series/1234/en.xml'
40
+ context 'hash attributes' do
41
+ it 'should return correct url' do
42
+ expect(model.find_url(series_id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/en.xml')
43
+ end
44
+ end
45
+
46
+ context 'normal attributes' do
47
+ it 'should return correct url' do
48
+ expect(model.find_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/en.xml')
49
+ end
30
50
  end
31
51
  end
32
52
 
33
53
  describe '.find_full' do
34
- it 'should return Faraday::Response class' do
35
- model.find_full(series_id: 1234).class.should == Faraday::Response
54
+ context 'hash attributes' do
55
+ it 'should return Faraday::Response class' do
56
+ expect(model.find_full(series_id: 1234)).to be_a(Faraday::Response)
57
+ end
58
+
59
+ it 'should return Hash class for body reponse' do
60
+ expect(model.find_full(series_id: 1234).body).to be_a(Hash)
61
+ end
36
62
  end
37
63
 
38
- it 'should return Hash class for body reponse' do
39
- model.find_full(series_id: 1234).body == Hash
64
+ context 'normal attributes' do
65
+ it 'should return Faraday::Response class' do
66
+ expect(model.find_full(1234)).to be_a(Faraday::Response)
67
+ end
68
+
69
+ it 'should return Hash class for body reponse' do
70
+ expect(model.find_full(1234).body).to be_a(Hash)
71
+ end
40
72
  end
41
73
  end
42
74
 
43
75
  describe '.find_full_url' do
44
- it 'should return correct url' do
45
- model.find_full_url(series_id: 1234).should == 'http://thetvdb.com/api/123456789/series/1234/all/en.xml'
76
+ context 'hash attributes' do
77
+ it 'should return correct url' do
78
+ expect(model.find_full_url(series_id: 1234)).to eq('http://thetvdb.com/api/123456789/series/1234/all/en.xml')
79
+ end
80
+ end
81
+
82
+ context 'normal attributes' do
83
+ it 'should return correct url' do
84
+ expect(model.find_full_url(1234)).to eq('http://thetvdb.com/api/123456789/series/1234/all/en.xml')
85
+ end
46
86
  end
47
87
  end
48
88
  end
@@ -17,65 +17,65 @@ describe ThetvdbApi::Update do
17
17
 
18
18
  describe '.day' do
19
19
  it 'should return Faraday::Response class' do
20
- model.day.class.should == Faraday::Response
20
+ expect(model.day).to be_a(Faraday::Response)
21
21
  end
22
22
 
23
23
  it 'should return Hash class for body reponse' do
24
- model.day.body == Hash
24
+ expect(model.day.body).to be_a(Hash)
25
25
  end
26
26
  end
27
27
 
28
28
  describe '.day_url' do
29
29
  it 'should return correct url' do
30
- model.day_url.should == 'http://thetvdb.com/api/123456789/updates/updates_day.xml'
30
+ expect(model.day_url).to eq('http://thetvdb.com/api/123456789/updates/updates_day.xml')
31
31
  end
32
32
  end
33
33
 
34
34
  describe '.week' do
35
35
  it 'should return Faraday::Response class' do
36
- model.week.class.should == Faraday::Response
36
+ expect(model.week).to be_a(Faraday::Response)
37
37
  end
38
38
 
39
39
  it 'should return Hash class for body reponse' do
40
- model.week.body == Hash
40
+ expect(model.week.body).to be_a(Hash)
41
41
  end
42
42
  end
43
43
 
44
44
  describe '.week_url' do
45
45
  it 'should return correct url' do
46
- model.week_url.should == 'http://thetvdb.com/api/123456789/updates/updates_week.xml'
46
+ expect(model.week_url).to eq('http://thetvdb.com/api/123456789/updates/updates_week.xml')
47
47
  end
48
48
  end
49
49
 
50
50
  describe '.month' do
51
51
  it 'should return Faraday::Response class' do
52
- model.month.class.should == Faraday::Response
52
+ expect(model.month).to be_a(Faraday::Response)
53
53
  end
54
54
 
55
55
  it 'should return Hash class for body reponse' do
56
- model.month.body == Hash
56
+ expect(model.month.body).to be_a(Hash)
57
57
  end
58
58
  end
59
59
 
60
60
  describe '.month_url' do
61
61
  it 'should return correct url' do
62
- model.month_url.should == 'http://thetvdb.com/api/123456789/updates/updates_month.xml'
62
+ expect(model.month_url).to eq('http://thetvdb.com/api/123456789/updates/updates_month.xml')
63
63
  end
64
64
  end
65
65
 
66
66
  describe '.all' do
67
67
  it 'should return Faraday::Response class' do
68
- model.all.class.should == Faraday::Response
68
+ expect(model.all).to be_a(Faraday::Response)
69
69
  end
70
70
 
71
71
  it 'should return Hash class for body reponse' do
72
- model.all.body == Hash
72
+ expect(model.all.body).to be_a(Hash)
73
73
  end
74
74
  end
75
75
 
76
76
  describe '.all_url' do
77
77
  it 'should return correct url' do
78
- model.all_url.should == 'http://thetvdb.com/api/123456789/updates/updates_all.xml'
78
+ expect(model.all_url).to eq('http://thetvdb.com/api/123456789/updates/updates_all.xml')
79
79
  end
80
80
  end
81
81
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Actor do
4
+ let(:model) { ThetvdbApi::Actor.new(api_key: API_KEY) }
5
+
6
+ describe '.find' do
7
+ it 'should return response class' do
8
+ response = model.find(series_id: '70327')
9
+ expect(response).to be_a(Faraday::Response)
10
+ expect(response.status).to eq(200)
11
+ expect(response.body).to be_a(Hash)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Banner do
4
+ let(:model) { ThetvdbApi::Banner.new(api_key: API_KEY) }
5
+
6
+ describe '.find' do
7
+ it 'should return response class' do
8
+ response = model.find(series_id: '70327')
9
+ expect(response).to be_a(Faraday::Response)
10
+ expect(response.status).to eq(200)
11
+ expect(response.body).to be_a(Hash)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,150 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Client do
4
+ let(:client) { ThetvdbApi::Client.new(api_key: API_KEY) }
5
+
6
+ describe '.search' do
7
+ describe '.get_series' do
8
+ it 'should return response class' do
9
+ response = client.search.get_series(seriesname: 'buffy')
10
+ expect(response).to be_a(Faraday::Response)
11
+ expect(response.status).to eq(200)
12
+ expect(response.body).to be_a(Hash)
13
+ end
14
+ end
15
+
16
+ describe '.get_series_by_remote_id' do
17
+ it 'should return response class with imdbid' do
18
+ response = client.search.get_series_by_remote_id(imdbid: 'tt0118276')
19
+ expect(response).to be_a(Faraday::Response)
20
+ expect(response.status).to eq(200)
21
+ expect(response.body).to be_a(Hash)
22
+ end
23
+
24
+ it 'should return response class with zap2itid' do
25
+ response = client.search.get_series_by_remote_id(zap2itid: 'EP00213110')
26
+ expect(response).to be_a(Faraday::Response)
27
+ expect(response.status).to eq(200)
28
+ expect(response.body).to be_a(Hash)
29
+ end
30
+ end
31
+
32
+ describe '.get_episode' do
33
+ it 'should return response class' do
34
+ response = client.search.get_episode(seriesid: '70327', airdate: '1997-03-10')
35
+ expect(response).to be_a(Faraday::Response)
36
+ expect(response.status).to eq(200)
37
+ expect(response.body).to be_a(Hash)
38
+ end
39
+ end
40
+ end
41
+
42
+ describe '.series' do
43
+ describe '.find' do
44
+ it 'should return response class' do
45
+ response = client.series.find(series_id: '70327')
46
+ expect(response).to be_a(Faraday::Response)
47
+ expect(response.status).to eq(200)
48
+ expect(response.body).to be_a(Hash)
49
+ end
50
+ end
51
+
52
+ describe '.find_full' do
53
+ it 'should return response class' do
54
+ response = client.series.find_full(series_id: '70327')
55
+ expect(response).to be_a(Faraday::Response)
56
+ expect(response.status).to eq(200)
57
+ expect(response.body).to be_a(Hash)
58
+ end
59
+ end
60
+ end
61
+
62
+ describe '.actor' do
63
+ describe '.find' do
64
+ it 'should return response class' do
65
+ response = client.actor.find(series_id: '70327')
66
+ expect(response).to be_a(Faraday::Response)
67
+ expect(response.status).to eq(200)
68
+ expect(response.body).to be_a(Hash)
69
+ end
70
+ end
71
+ end
72
+
73
+ describe '.banner' do
74
+ describe '.find' do
75
+ it 'should return response class' do
76
+ response = client.banner.find(series_id: '70327')
77
+ expect(response).to be_a(Faraday::Response)
78
+ expect(response.status).to eq(200)
79
+ expect(response.body).to be_a(Hash)
80
+ end
81
+ end
82
+ end
83
+
84
+ describe '.episode' do
85
+ describe '.find_by_default_order' do
86
+ it 'should return response class' do
87
+ response = client.episode.find_by_default_order(series_id: '70327', season: '1', episode: '1')
88
+ expect(response).to be_a(Faraday::Response)
89
+ expect(response.status).to eq(200)
90
+ expect(response.body).to be_a(Hash)
91
+ end
92
+ end
93
+
94
+ describe '.find_by_dvd_order' do
95
+ it 'should return response class' do
96
+ response = client.episode.find_by_dvd_order(series_id: '70327', season: '1', episode: '1')
97
+ expect(response).to be_a(Faraday::Response)
98
+ expect(response.status).to eq(200)
99
+ expect(response.body).to be_a(Hash)
100
+ end
101
+ end
102
+
103
+ describe '.find_by_absolute_order' do
104
+ it 'should return response class' do
105
+ response = client.episode.find_by_absolute_order(series_id: '70327', absolute: '1')
106
+ expect(response).to be_a(Faraday::Response)
107
+ expect(response.status).to eq(200)
108
+ expect(response.body).to be_a(Hash)
109
+ end
110
+ end
111
+
112
+ describe '.find' do
113
+ it 'should return response class' do
114
+ response = client.episode.find(episode_id: '533011')
115
+ expect(response).to be_a(Faraday::Response)
116
+ expect(response.status).to eq(200)
117
+ expect(response.body).to be_a(Hash)
118
+ end
119
+ end
120
+ end
121
+
122
+ describe '.update' do
123
+ describe '.day' do
124
+ it 'should return response class' do
125
+ response = client.update.day
126
+ expect(response).to be_a(Faraday::Response)
127
+ expect(response.status).to eq(200)
128
+ expect(response.body).to be_a(Hash)
129
+ end
130
+ end
131
+
132
+ describe '.week' do
133
+ it 'should return response class' do
134
+ response = client.update.week
135
+ expect(response).to be_a(Faraday::Response)
136
+ expect(response.status).to eq(200)
137
+ expect(response.body).to be_a(Hash)
138
+ end
139
+ end
140
+
141
+ describe '.month' do
142
+ it 'should return response class' do
143
+ response = client.update.month
144
+ expect(response).to be_a(Faraday::Response)
145
+ expect(response.status).to eq(200)
146
+ expect(response.body).to be_a(Hash)
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Episode do
4
+ let(:model) { ThetvdbApi::Episode.new(api_key: API_KEY, language: 'en') }
5
+
6
+ describe 'real request' do
7
+ describe '.find_by_default_order' do
8
+ it 'should return response class' do
9
+ response = model.find_by_default_order(series_id: '70327', season: '1', episode: '1')
10
+ expect(response).to be_a(Faraday::Response)
11
+ expect(response.status).to eq(200)
12
+ expect(response.body).to be_a(Hash)
13
+ end
14
+ end
15
+
16
+ describe '.find_by_dvd_order' do
17
+ it 'should return response class' do
18
+ response = model.find_by_dvd_order(series_id: '70327', season: '1', episode: '1')
19
+ expect(response).to be_a(Faraday::Response)
20
+ expect(response.status).to eq(200)
21
+ expect(response.body).to be_a(Hash)
22
+ end
23
+ end
24
+
25
+ describe '.find_by_absolute_order' do
26
+ it 'should return response class' do
27
+ response = model.find_by_absolute_order(series_id: '70327', absolute: '1')
28
+ expect(response).to be_a(Faraday::Response)
29
+ expect(response.status).to eq(200)
30
+ expect(response.body).to be_a(Hash)
31
+ end
32
+ end
33
+
34
+ describe '.find' do
35
+ it 'should return response class' do
36
+ response = model.find(episode_id: '533011')
37
+ expect(response).to be_a(Faraday::Response)
38
+ expect(response.status).to eq(200)
39
+ expect(response.body).to be_a(Hash)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Search do
4
+ let(:model) { ThetvdbApi::Search.new(api_key: API_KEY) }
5
+
6
+ describe 'real request' do
7
+ describe '.get_series' do
8
+ it 'should return response class' do
9
+ response = model.get_series(seriesname: 'buffy')
10
+ expect(response).to be_a(Faraday::Response)
11
+ expect(response.status).to eq(200)
12
+ expect(response.body).to be_a(Hash)
13
+ end
14
+ end
15
+
16
+ describe '.get_series_by_remote_id' do
17
+ it 'should return response class with imdbid' do
18
+ response = model.get_series_by_remote_id(imdbid: 'tt0118276')
19
+ expect(response).to be_a(Faraday::Response)
20
+ expect(response.status).to eq(200)
21
+ expect(response.body).to be_a(Hash)
22
+ end
23
+
24
+ it 'should return response class with zap2itid' do
25
+ response = model.get_series_by_remote_id(zap2itid: 'EP00213110')
26
+ expect(response).to be_a(Faraday::Response)
27
+ expect(response.status).to eq(200)
28
+ expect(response.body).to be_a(Hash)
29
+ end
30
+ end
31
+
32
+ describe '.get_episode' do
33
+ it 'should return response class' do
34
+ response = model.get_episode(seriesid: '70327', airdate: '1997-03-10')
35
+ expect(response).to be_a(Faraday::Response)
36
+ expect(response.status).to eq(200)
37
+ expect(response.body).to be_a(Hash)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbApi::Series do
4
+ let(:model) { ThetvdbApi::Series.new(api_key: API_KEY, language: 'en') }
5
+
6
+ describe '.find' do
7
+ it 'should return response class' do
8
+ response = model.find(series_id: '70327')
9
+ expect(response).to be_a(Faraday::Response)
10
+ expect(response.status).to eq(200)
11
+ expect(response.body).to be_a(Hash)
12
+ end
13
+ end
14
+
15
+ describe '.find_full' do
16
+ it 'should return response class' do
17
+ response = model.find_full(series_id: '70327')
18
+ expect(response).to be_a(Faraday::Response)
19
+ expect(response.status).to eq(200)
20
+ expect(response.body).to be_a(Hash)
21
+ end
22
+ end
23
+ end