thetvdb_api 0.0.1 → 0.1.0
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/README.md +61 -22
- data/lib/thetvdb_api/actor.rb +3 -2
- data/lib/thetvdb_api/banner.rb +3 -9
- data/lib/thetvdb_api/base.rb +44 -5
- data/lib/thetvdb_api/client.rb +34 -0
- data/lib/thetvdb_api/episode.rb +14 -31
- data/lib/thetvdb_api/search.rb +18 -0
- data/lib/thetvdb_api/series.rb +6 -17
- data/lib/thetvdb_api/update.rb +17 -0
- data/lib/thetvdb_api/version.rb +1 -1
- data/lib/thetvdb_api.rb +6 -17
- data/spec/integrations/actor_spec.rb +5 -5
- data/spec/integrations/banner_spec.rb +5 -5
- data/spec/integrations/client_spec.rb +109 -0
- data/spec/integrations/episode_spec.rb +14 -14
- data/spec/integrations/search_spec.rb +14 -14
- data/spec/integrations/series_spec.rb +8 -8
- data/spec/integrations/update_spec.rb +11 -11
- data/spec/thetvdb_api/actor_spec.rb +5 -12
- data/spec/thetvdb_api/banner_spec.rb +5 -57
- data/spec/thetvdb_api/base_spec.rb +92 -0
- data/spec/thetvdb_api/client_spec.rb +35 -0
- data/spec/thetvdb_api/episode_spec.rb +17 -149
- data/spec/thetvdb_api/search_spec.rb +42 -0
- data/spec/thetvdb_api/series_spec.rb +9 -97
- data/spec/thetvdb_api/update_spec.rb +38 -0
- data/thetvdb_api.gemspec +0 -1
- metadata +15 -61
- data/lib/thetvdb_api/request/actor.rb +0 -18
- data/lib/thetvdb_api/request/banner.rb +0 -18
- data/lib/thetvdb_api/request/base.rb +0 -74
- data/lib/thetvdb_api/request/episode.rb +0 -39
- data/lib/thetvdb_api/request/module/find.rb +0 -17
- data/lib/thetvdb_api/request/module/series_uri.rb +0 -17
- data/lib/thetvdb_api/request/search.rb +0 -37
- data/lib/thetvdb_api/request/series.rb +0 -48
- data/lib/thetvdb_api/request/update.rb +0 -45
- data/lib/thetvdb_api/utility/array.rb +0 -5
- data/lib/thetvdb_api/utility/date.rb +0 -9
- data/lib/thetvdb_api/utility/float.rb +0 -5
- data/lib/thetvdb_api/utility/hashie/extensions/key_replace.rb +0 -42
- data/lib/thetvdb_api/utility/integer.rb +0 -5
- data/lib/thetvdb_api/utility/string.rb +0 -11
- data/lib/thetvdb_api/utility/time.rb +0 -9
- data/lib/thetvdb_api/utility.rb +0 -7
- data/spec/thetvdb_api/request/actor_spec.rb +0 -31
- data/spec/thetvdb_api/request/banner_spec.rb +0 -31
- data/spec/thetvdb_api/request/base_spec.rb +0 -121
- data/spec/thetvdb_api/request/episode_spec.rb +0 -82
- data/spec/thetvdb_api/request/module/series_uri_spec.rb +0 -17
- data/spec/thetvdb_api/request/search_spec.rb +0 -63
- data/spec/thetvdb_api/request/series_spec.rb +0 -86
- data/spec/thetvdb_api/request/update_spec.rb +0 -76
- data/spec/thetvdb_api/utility/array_spec.rb +0 -9
- data/spec/thetvdb_api/utility/date_spec.rb +0 -13
- data/spec/thetvdb_api/utility/float_spec.rb +0 -9
- data/spec/thetvdb_api/utility/integer_spec.rb +0 -9
- data/spec/thetvdb_api/utility/string_spec.rb +0 -9
- data/spec/thetvdb_api/utility/time_spec.rb +0 -13
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ThetvdbApi::Request::Episode do
|
|
4
|
-
let(:klass) { ThetvdbApi::Request::Episode }
|
|
5
|
-
let(:model) { klass.new('http://example.com') }
|
|
6
|
-
|
|
7
|
-
describe '#find_by_default_order' do
|
|
8
|
-
it 'should call new with specific params' do
|
|
9
|
-
klass.stub(:find_by_default_order_path).and_return('PATH')
|
|
10
|
-
klass.should_receive(:new).with('PATH')
|
|
11
|
-
|
|
12
|
-
klass.find_by_default_order('1234', '1', '1')
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#find_by_dvd_order' do
|
|
17
|
-
it 'should call new with specific params' do
|
|
18
|
-
klass.stub(:find_by_dvd_order_path).and_return('PATH')
|
|
19
|
-
klass.should_receive(:new).with('PATH')
|
|
20
|
-
|
|
21
|
-
klass.find_by_dvd_order('1234', '1', '1')
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe '#find_by_absolute_order' do
|
|
26
|
-
it 'should call new with specific params' do
|
|
27
|
-
klass.stub(:find_by_absolute_order_path).and_return('PATH')
|
|
28
|
-
klass.should_receive(:new).with('PATH')
|
|
29
|
-
|
|
30
|
-
klass.find_by_absolute_order('1234', '1')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe '#find' do
|
|
35
|
-
it 'should call new with specific params' do
|
|
36
|
-
klass.stub(:find_path).and_return('PATH')
|
|
37
|
-
klass.should_receive(:new).with('PATH')
|
|
38
|
-
|
|
39
|
-
klass.find('1234')
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe '#find_by_default_order_path' do
|
|
44
|
-
it 'should return correct uri' do
|
|
45
|
-
klass.stub(:series_uri).and_return('PATH/')
|
|
46
|
-
|
|
47
|
-
klass.find_by_default_order_path('1234', '1', '1', 'en').should == 'PATH/default/1/1/en.xml'
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe '#find_by_dvd_order_path' do
|
|
52
|
-
it 'should return correct uri' do
|
|
53
|
-
klass.stub(:series_uri).and_return('PATH/')
|
|
54
|
-
|
|
55
|
-
klass.find_by_dvd_order_path('1234', '1', '1', 'en').should == 'PATH/dvd/1/1/en.xml'
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe '#find_by_absolute_order_path' do
|
|
60
|
-
it 'should return correct uri' do
|
|
61
|
-
klass.stub(:series_uri).and_return('PATH/')
|
|
62
|
-
|
|
63
|
-
klass.find_by_absolute_order_path('1234', '1', 'en').should == 'PATH/absolute/1/en.xml'
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe '#find_path' do
|
|
68
|
-
it 'should return correct uri' do
|
|
69
|
-
ThetvdbApi::Configuration.stub(:api_key).and_return('API_KEY')
|
|
70
|
-
|
|
71
|
-
klass.find_path('1234', 'en').should == 'API_KEY/episodes/1234/en.xml'
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe '#result' do
|
|
76
|
-
it 'should call object_response method' do
|
|
77
|
-
model.should_receive(:object_response).with('Episode', ThetvdbApi::Episode)
|
|
78
|
-
|
|
79
|
-
model.result
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
class ExampleModel
|
|
4
|
-
include ThetvdbApi::Request::Module::SeriesUri
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
describe ThetvdbApi::Request::Module::SeriesUri do
|
|
8
|
-
let(:klass) { ExampleModel }
|
|
9
|
-
|
|
10
|
-
describe '#series_uri' do
|
|
11
|
-
it 'should return correct uri' do
|
|
12
|
-
ThetvdbApi::Configuration.stub(:api_key).and_return('API_KEY')
|
|
13
|
-
|
|
14
|
-
klass.series_uri('1234').should == 'API_KEY/series/1234/'
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ThetvdbApi::Request::Search do
|
|
4
|
-
let(:klass) { ThetvdbApi::Request::Search }
|
|
5
|
-
let(:result_kind) { :object }
|
|
6
|
-
let(:model) { klass.new('http://example.com', :series, result_kind) }
|
|
7
|
-
|
|
8
|
-
describe '#get_series' do
|
|
9
|
-
it 'should call new with specific params' do
|
|
10
|
-
klass.should_receive(:new).with('GetSeries.php', :series, :collection, seriesname: 'buffy', language: 'en')
|
|
11
|
-
|
|
12
|
-
klass.get_series('buffy', 'en')
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#get_series_by_imdb_id' do
|
|
17
|
-
it 'should call new with specific params' do
|
|
18
|
-
klass.should_receive(:new).with('GetSeriesByRemoteID.php', :series, :object, imdbid: '1234', language: 'en')
|
|
19
|
-
|
|
20
|
-
klass.get_series_by_imdb_id('1234', 'en')
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe '#get_series_by_zap2it_id' do
|
|
25
|
-
it 'should call new with specific params' do
|
|
26
|
-
klass.should_receive(:new).with('GetSeriesByRemoteID.php', :series, :object, zap2it: '1234', language: 'en')
|
|
27
|
-
|
|
28
|
-
klass.get_series_by_zap2it_id('1234', 'en')
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe '#get_episode_by_air_date' do
|
|
33
|
-
it 'should call new with specific params' do
|
|
34
|
-
ThetvdbApi::Configuration.stub(:api_key).and_return('API_KEY')
|
|
35
|
-
klass.should_receive(:new).with('GetEpisodeByAirDate.php', :episode, :object, apikey: 'API_KEY', seriesid: '1234',
|
|
36
|
-
airdate: '2000-01-01', language: 'en')
|
|
37
|
-
|
|
38
|
-
klass.get_episode_by_air_date('1234', '2000-01-01', 'en')
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe '#result' do
|
|
43
|
-
describe 'for collection result' do
|
|
44
|
-
let(:result_kind) { :collection }
|
|
45
|
-
|
|
46
|
-
it 'should call collection_response method' do
|
|
47
|
-
model.should_receive(:collection_response)
|
|
48
|
-
|
|
49
|
-
model.result
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 'for object result' do
|
|
54
|
-
let(:result_kind) { :object }
|
|
55
|
-
|
|
56
|
-
it 'should call collection_response method' do
|
|
57
|
-
model.should_receive(:object_response)
|
|
58
|
-
|
|
59
|
-
model.result
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ThetvdbApi::Request::Series do
|
|
4
|
-
let(:klass) { ThetvdbApi::Request::Series }
|
|
5
|
-
let(:result_kind) { :base }
|
|
6
|
-
let(:model) { klass.new('http://example.com', result_kind) }
|
|
7
|
-
|
|
8
|
-
describe '#find' do
|
|
9
|
-
it 'should call new with specific params' do
|
|
10
|
-
klass.stub(:find_path).and_return('PATH')
|
|
11
|
-
klass.should_receive(:new).with('PATH', :base)
|
|
12
|
-
|
|
13
|
-
klass.find('1234', 'en')
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe '#find_full' do
|
|
18
|
-
it 'should call new with specific params' do
|
|
19
|
-
klass.stub(:find_full_path).and_return('PATH')
|
|
20
|
-
klass.should_receive(:new).with('PATH', :full)
|
|
21
|
-
|
|
22
|
-
klass.find_full('1234', 'en')
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe '#find_path' do
|
|
27
|
-
it 'should return correct uri' do
|
|
28
|
-
klass.stub(:series_uri).and_return('PATH/')
|
|
29
|
-
|
|
30
|
-
klass.find_path('1234', 'en').should == 'PATH/en.xml'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe '#find_full_path' do
|
|
35
|
-
it 'should return correct uri' do
|
|
36
|
-
klass.stub(:series_uri).and_return('PATH/')
|
|
37
|
-
|
|
38
|
-
klass.find_full_path('1234', 'en').should == 'PATH/all/en.xml'
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe '#result' do
|
|
43
|
-
describe 'for base result' do
|
|
44
|
-
let(:result_kind) { :base }
|
|
45
|
-
|
|
46
|
-
it 'should call series_response method' do
|
|
47
|
-
model.should_receive(:series_response)
|
|
48
|
-
|
|
49
|
-
model.result
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 'for full result' do
|
|
54
|
-
let(:result_kind) { :full }
|
|
55
|
-
|
|
56
|
-
it 'should call full_response method' do
|
|
57
|
-
model.should_receive(:full_response)
|
|
58
|
-
|
|
59
|
-
model.result
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
describe '#series_response' do
|
|
65
|
-
it 'should call object_response method with specific parameters' do
|
|
66
|
-
model.should_receive(:object_response).with('Series', ThetvdbApi::Series)
|
|
67
|
-
model.series_response
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe '#episodes_response' do
|
|
72
|
-
it 'should call collection_response method with specific parameters' do
|
|
73
|
-
model.should_receive(:collection_response).with('Episode', ThetvdbApi::Episode)
|
|
74
|
-
model.episodes_response
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
describe '#full_response' do
|
|
79
|
-
it 'should return series and episodes keys' do
|
|
80
|
-
model.stub(:series_response)
|
|
81
|
-
model.stub(:episodes_response)
|
|
82
|
-
|
|
83
|
-
model.full_response.keys.sort.should == [:series, :episodes].sort
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ThetvdbApi::Request::Update do
|
|
4
|
-
let(:klass) { ThetvdbApi::Request::Update }
|
|
5
|
-
let(:model) { klass.new('period') }
|
|
6
|
-
|
|
7
|
-
describe '#day' do
|
|
8
|
-
it 'should call new with specific params' do
|
|
9
|
-
klass.should_receive(:new).with(:day)
|
|
10
|
-
|
|
11
|
-
klass.day
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe '#week' do
|
|
16
|
-
it 'should call new with specific params' do
|
|
17
|
-
klass.should_receive(:new).with(:week)
|
|
18
|
-
|
|
19
|
-
klass.week
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#month' do
|
|
24
|
-
it 'should call new with specific params' do
|
|
25
|
-
klass.should_receive(:new).with(:month)
|
|
26
|
-
|
|
27
|
-
klass.month
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe '#all' do
|
|
32
|
-
it 'should call new with specific params' do
|
|
33
|
-
klass.should_receive(:new).with(:all)
|
|
34
|
-
|
|
35
|
-
klass.all
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe '#uri' do
|
|
40
|
-
it 'should return correct path' do
|
|
41
|
-
ThetvdbApi::Configuration.stub(:api_key).and_return('API_KEY')
|
|
42
|
-
|
|
43
|
-
model.uri.should == 'API_KEY/updates/updates_period.xml'
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe '#series_response' do
|
|
48
|
-
it 'should call collection_response method' do
|
|
49
|
-
model.should_receive(:collection_response).with('Series', ThetvdbApi::Series)
|
|
50
|
-
|
|
51
|
-
model.series_response
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe '#episodes_response' do
|
|
56
|
-
it 'should call collection_response method' do
|
|
57
|
-
model.should_receive(:collection_response).with('Episode', ThetvdbApi::Episode)
|
|
58
|
-
|
|
59
|
-
model.episodes_response
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
describe '#banners_response' do
|
|
64
|
-
it 'should call collection_response method' do
|
|
65
|
-
model.should_receive(:collection_response).with('Banner', ThetvdbApi::Banner)
|
|
66
|
-
|
|
67
|
-
model.banners_response
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe '#result' do
|
|
72
|
-
it 'should return correct keys' do
|
|
73
|
-
model.result.keys.sort.should == [:series, :episodes, :banners].sort
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Date do
|
|
4
|
-
describe '#coerce' do
|
|
5
|
-
it 'should convert string to date' do
|
|
6
|
-
Date.coerce('2001-02-03').should == Date.new(2001, 2, 3)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'should return nil for no date string' do
|
|
10
|
-
Date.coerce('test').should == nil
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Time do
|
|
4
|
-
describe '#coerce' do
|
|
5
|
-
it 'should convert timestampe to Time' do
|
|
6
|
-
Time.coerce('1201292806').should == Time.at(1201292806)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'should convert string datetime to Time' do
|
|
10
|
-
Time.coerce('2000-01-01 11:11:11').should == Time.parse('2000-01-01 11:11:11')
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|