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
data/lib/thetvdb_api.rb
CHANGED
@@ -3,18 +3,6 @@ module ThetvdbApi
|
|
3
3
|
end
|
4
4
|
|
5
5
|
require 'thetvdb_api/version'
|
6
|
-
require 'thetvdb_api/configuration'
|
7
|
-
require 'thetvdb_api/response'
|
8
|
-
require 'thetvdb_api/response/collection'
|
9
|
-
require 'thetvdb_api/response/search_multiple_episode'
|
10
|
-
require 'thetvdb_api/response/search_multiple_series'
|
11
|
-
require 'thetvdb_api/response/search_series'
|
12
|
-
require 'thetvdb_api/response/update'
|
13
|
-
require 'thetvdb_api/response/actors'
|
14
|
-
require 'thetvdb_api/response/banners'
|
15
|
-
require 'thetvdb_api/response/episode'
|
16
|
-
require 'thetvdb_api/response/series'
|
17
|
-
require 'thetvdb_api/response/full_series'
|
18
6
|
require 'thetvdb_api/client'
|
19
7
|
require 'thetvdb_api/base'
|
20
8
|
require 'thetvdb_api/search'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<Data>
|
3
|
+
<Episode>
|
4
|
+
<id>332179</id>
|
5
|
+
<Combined_episodenumber>1</Combined_episodenumber>
|
6
|
+
<Combined_season>1</Combined_season>
|
7
|
+
<DVD_chapter />
|
8
|
+
<DVD_discid />
|
9
|
+
<DVD_episodenumber />
|
10
|
+
<DVD_Season />
|
11
|
+
<Director>McG</Director>
|
12
|
+
<EpImgFlag />
|
13
|
+
<EpisodeName>Pilot</EpisodeName>
|
14
|
+
<EpisodeNumber>1</EpisodeNumber>
|
15
|
+
<FirstAired>2007-09-24</FirstAired>
|
16
|
+
<GuestStars>Mieko Hillman|Kristine Blackport|Jim Pirri|Diana Gitelman|Mel Fair|Lynn A. Henderson|Odessa Rae|Jordan Potter|Tasha Campbell|Dale Dye|Matthew Bomer|Bruno Amato|Nicolas Pajon|Wendy Makkena</GuestStars>
|
17
|
+
<IMDB_ID />
|
18
|
+
<language>en</language>
|
19
|
+
<Overview>Chuck Bartowski is an average computer geek until files upon files of government secrets are downloaded into his brain. He is soon scouted by the CIA and NSA to act in place of their computer.</Overview>
|
20
|
+
<ProductionCode />
|
21
|
+
<Rating />
|
22
|
+
<SeasonNumber>1</SeasonNumber>
|
23
|
+
<Writer>Josh Schwartz|Chris Fedak</Writer>
|
24
|
+
<absolute_number />
|
25
|
+
<filename>episodes/80348-332179.jpg</filename>
|
26
|
+
<lastupdated>1209586232</lastupdated>
|
27
|
+
<seasonid>27985</seasonid>
|
28
|
+
<seriesid>80348</seriesid>
|
29
|
+
</Episode>
|
30
|
+
</Data>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<Data>
|
3
|
+
<Series>
|
4
|
+
<seriesid>78901</seriesid>
|
5
|
+
<language>en</language>
|
6
|
+
<SeriesName>Supernatural</SeriesName>
|
7
|
+
<banner>graphical/78901-g4.jpg</banner>
|
8
|
+
<Overview>Dean and Sam Winchester are two brothers with a special talent. Well-versed...</Overview>
|
9
|
+
<FirstAired>2005-09-13</FirstAired>
|
10
|
+
<IMDB_ID>tt0460681</IMDB_ID>
|
11
|
+
<zap2it_id>EP00754231</zap2it_id>
|
12
|
+
<id>78901</id>
|
13
|
+
</Series>
|
14
|
+
<Series>
|
15
|
+
<seriesid>79426</seriesid>
|
16
|
+
<language>en</language>
|
17
|
+
<SeriesName>Supernatural Science</SeriesName>
|
18
|
+
<banner>graphical/z79426-g.jpg</banner>
|
19
|
+
<Overview>Even hardheaded skeptics have to concede that there’s something inherently...</Overview>
|
20
|
+
<FirstAired>2006-11-09</FirstAired>
|
21
|
+
<zap2it_id>EP00359360</zap2it_id>
|
22
|
+
<id>79426</id>
|
23
|
+
</Series>
|
24
|
+
</Data>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<Data>
|
3
|
+
<Series>
|
4
|
+
<seriesid>78901</seriesid>
|
5
|
+
<language>en</language>
|
6
|
+
<SeriesName>Supernatural</SeriesName>
|
7
|
+
<banner>graphical/78901-g4.jpg</banner>
|
8
|
+
<Overview>Dean and Sam Winchester are two brothers with a special talent. Well-versed...</Overview>
|
9
|
+
<FirstAired>2005-09-13</FirstAired>
|
10
|
+
<IMDB_ID>tt0460681</IMDB_ID>
|
11
|
+
<zap2it_id>EP00754231</zap2it_id>
|
12
|
+
<id>78901</id>
|
13
|
+
</Series>
|
14
|
+
</Data>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<Data time="1203923101">
|
3
|
+
<Series>
|
4
|
+
<id>71969</id>
|
5
|
+
<time>1203848965</time>
|
6
|
+
</Series>
|
7
|
+
<Series>
|
8
|
+
<id>73141</id>
|
9
|
+
<time>1203882947</time>
|
10
|
+
</Series>
|
11
|
+
<Episode>
|
12
|
+
<id>326268</id>
|
13
|
+
<time>1203848662</time>
|
14
|
+
</Episode>
|
15
|
+
<Episode>
|
16
|
+
<id>326267</id>
|
17
|
+
<time>1203848597</time>
|
18
|
+
</Episode>
|
19
|
+
<Banner>
|
20
|
+
<SeasonNum>1</SeasonNum>
|
21
|
+
<Series>81325</Series>
|
22
|
+
<format>graphical</format>
|
23
|
+
<language>en</language>
|
24
|
+
<path>graphical/81325-g3.jpg</path>
|
25
|
+
<type>series</type>
|
26
|
+
</Banner>
|
27
|
+
<Banner>
|
28
|
+
<SeasonNum>1</SeasonNum>
|
29
|
+
<Series>79302</Series>
|
30
|
+
<format>standard</format>
|
31
|
+
<language>en</language>
|
32
|
+
<path>seasons/79302-1.jpg</path>
|
33
|
+
<type>season</type>
|
34
|
+
</Banner>
|
35
|
+
</Data>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Actor do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.actor }
|
6
|
+
|
7
|
+
let(:faraday_stubs) do
|
8
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
9
|
+
stub.get('/api/123456789/series/1234/actors.xml') do
|
10
|
+
[200, { content_type: 'xml' }, File.read('spec/fixtures/actors.xml')]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.find' do
|
16
|
+
it 'should return Faraday::Response class' do
|
17
|
+
model.find(series_id: 1234).class.should == Faraday::Response
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return Hash class for body reponse' do
|
21
|
+
model.find(series_id: 1234).body == Hash
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.find_url' do
|
26
|
+
it 'should return correct url' do
|
27
|
+
model.find_url(series_id: 1234).should == 'http://thetvdb.com/api/123456789/series/1234/actors.xml'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Banner do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.banner }
|
6
|
+
|
7
|
+
let(:faraday_stubs) do
|
8
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
9
|
+
stub.get('/api/123456789/series/1234/banners.xml') do
|
10
|
+
[200, { content_type: 'xml' }, File.read('spec/fixtures/banners.xml')]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.find' do
|
16
|
+
it 'should return Faraday::Response class' do
|
17
|
+
model.find(series_id: 1234).class.should == Faraday::Response
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return Hash class for body reponse' do
|
21
|
+
model.find(series_id: 1234).body == Hash
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.find_url' do
|
26
|
+
it 'should return correct url' do
|
27
|
+
model.find_url(series_id: 1234).should == 'http://thetvdb.com/api/123456789/series/1234/banners.xml'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Episode do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.episode }
|
6
|
+
|
7
|
+
let(:episode_data) { File.read('spec/fixtures/episode.xml') }
|
8
|
+
|
9
|
+
let(:faraday_stubs) do
|
10
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
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/dvd/1/1/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
13
|
+
stub.get('/api/123456789/series/1234/absolute/1/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
14
|
+
stub.get('/api/123456789/episodes/1234/en.xml') { [200, { content_type: 'xml' }, episode_data] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.find_by_default_order' do
|
19
|
+
it 'should return Faraday::Response class' do
|
20
|
+
model.find_by_default_order(series_id: 1234, season: 1, episode: 1).class.should == Faraday::Response
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return Hash class for body reponse' do
|
24
|
+
model.find_by_default_order(series_id: 1234, season: 1, episode: 1).body == Hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.find_by_default_order_url' do
|
29
|
+
it 'should return correct url' do
|
30
|
+
model.find_by_default_order_url(series_id: 1234, season: 1, episode: 1).
|
31
|
+
should == 'http://thetvdb.com/api/123456789/series/1234/default/1/1/en.xml'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.find_by_dvd_order' do
|
36
|
+
it 'should return Faraday::Response class' do
|
37
|
+
model.find_by_dvd_order(series_id: 1234, season: 1, episode: 1).class.should == Faraday::Response
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return Hash class for body reponse' do
|
41
|
+
model.find_by_dvd_order(series_id: 1234, season: 1, episode: 1).body == Hash
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '.find_by_dvd_order_url' do
|
46
|
+
it 'should return correct url' do
|
47
|
+
model.find_by_dvd_order_url(series_id: 1234, season: 1, episode: 1).
|
48
|
+
should == 'http://thetvdb.com/api/123456789/series/1234/dvd/1/1/en.xml'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '.find_by_absolute_order' do
|
53
|
+
it 'should return Faraday::Response class' do
|
54
|
+
model.find_by_absolute_order(series_id: 1234, absolute: 1).class.should == Faraday::Response
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should return Hash class for body reponse' do
|
58
|
+
model.find_by_absolute_order(series_id: 1234, absolute: 1).body == Hash
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '.find_by_absolute_order_url' do
|
63
|
+
it 'should return correct url' do
|
64
|
+
model.find_by_absolute_order_url(series_id: 1234, absolute: 1).
|
65
|
+
should == 'http://thetvdb.com/api/123456789/series/1234/absolute/1/en.xml'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '.find' do
|
70
|
+
it 'should return Faraday::Response class' do
|
71
|
+
model.find(episode_id: 1234).class.should == Faraday::Response
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should return Hash class for body reponse' do
|
75
|
+
model.find(episode_id: 1234).body == Hash
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '.find_url' do
|
80
|
+
it 'should return correct url' do
|
81
|
+
model.find_url(episode_id: 1234).
|
82
|
+
should == 'http://thetvdb.com/api/123456789/episodes/1234/en.xml'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Search do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.search }
|
6
|
+
|
7
|
+
let(:get_series_data) { File.read('spec/fixtures/get_series.xml') }
|
8
|
+
let(:get_series_by_remote_data) { File.read('spec/fixtures/get_series_by_remote.xml') }
|
9
|
+
let(:get_episode_data) { File.read('spec/fixtures/get_episode.xml') }
|
10
|
+
|
11
|
+
let(:faraday_stubs) do
|
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]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '.get_series' do
|
22
|
+
it 'should return Faraday::Response class' do
|
23
|
+
model.get_series(seriesname: 'Supernatural').class.should == Faraday::Response
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should return Hash class for body reponse' do
|
27
|
+
model.get_series(seriesname: 'Supernatural').body == Hash
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
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'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
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
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should return Hash class for body reponse' do
|
44
|
+
model.get_series_by_remote_id(imdbid: 'tt0290978').body == Hash
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
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'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
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
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should return Hash class for body reponse' do
|
61
|
+
model.get_episode(seriesid: 80348, airdate: '2007-09-24').body == Hash
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
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'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Series do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.series }
|
6
|
+
|
7
|
+
let(:series_data) { File.read('spec/fixtures/series.xml') }
|
8
|
+
let(:full_series_data) { File.read('spec/fixtures/full_series.xml') }
|
9
|
+
|
10
|
+
let(:faraday_stubs) do
|
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] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.find' do
|
18
|
+
it 'should return Faraday::Response class' do
|
19
|
+
model.find(series_id: 1234).class.should == Faraday::Response
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return Hash class for body reponse' do
|
23
|
+
model.find(series_id: 1234).body == Hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
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'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.find_full' do
|
34
|
+
it 'should return Faraday::Response class' do
|
35
|
+
model.find_full(series_id: 1234).class.should == Faraday::Response
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return Hash class for body reponse' do
|
39
|
+
model.find_full(series_id: 1234).body == Hash
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
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'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThetvdbApi::Update do
|
4
|
+
let(:client) { ThetvdbApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.update }
|
6
|
+
|
7
|
+
let(:updates_data) { File.read('spec/fixtures/series.xml') }
|
8
|
+
|
9
|
+
let(:faraday_stubs) do
|
10
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
|
+
stub.get('/api/123456789/updates/updates_day.xml') { [200, { content_type: 'xml' }, updates_data] }
|
12
|
+
stub.get('/api/123456789/updates/updates_week.xml') { [200, { content_type: 'xml' }, updates_data] }
|
13
|
+
stub.get('/api/123456789/updates/updates_month.xml') { [200, { content_type: 'xml' }, updates_data] }
|
14
|
+
stub.get('/api/123456789/updates/updates_all.xml') { [200, { content_type: 'xml' }, updates_data] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.day' do
|
19
|
+
it 'should return Faraday::Response class' do
|
20
|
+
model.day.class.should == Faraday::Response
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return Hash class for body reponse' do
|
24
|
+
model.day.body == Hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.day_url' do
|
29
|
+
it 'should return correct url' do
|
30
|
+
model.day_url.should == 'http://thetvdb.com/api/123456789/updates/updates_day.xml'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.week' do
|
35
|
+
it 'should return Faraday::Response class' do
|
36
|
+
model.week.class.should == Faraday::Response
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return Hash class for body reponse' do
|
40
|
+
model.week.body == Hash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '.week_url' do
|
45
|
+
it 'should return correct url' do
|
46
|
+
model.week_url.should == 'http://thetvdb.com/api/123456789/updates/updates_week.xml'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '.month' do
|
51
|
+
it 'should return Faraday::Response class' do
|
52
|
+
model.month.class.should == Faraday::Response
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should return Hash class for body reponse' do
|
56
|
+
model.month.body == Hash
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.month_url' do
|
61
|
+
it 'should return correct url' do
|
62
|
+
model.month_url.should == 'http://thetvdb.com/api/123456789/updates/updates_month.xml'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '.all' do
|
67
|
+
it 'should return Faraday::Response class' do
|
68
|
+
model.all.class.should == Faraday::Response
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should return Hash class for body reponse' do
|
72
|
+
model.all.body == Hash
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '.all_url' do
|
77
|
+
it 'should return correct url' do
|
78
|
+
model.all_url.should == 'http://thetvdb.com/api/123456789/updates/updates_all.xml'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/thetvdb_api.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'confiture', '~> 0.1.4'
|
22
21
|
spec.add_runtime_dependency 'faraday', '~> 0.9.0'
|
23
|
-
spec.add_runtime_dependency 'uri_template', '~> 0.
|
22
|
+
spec.add_runtime_dependency 'uri_template', '~> 0.7.0'
|
24
23
|
spec.add_runtime_dependency 'multi_xml', '~> 0.5.5'
|
24
|
+
spec.add_runtime_dependency 'service_api', '~> 0.0.4'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
27
27
|
spec.add_development_dependency 'rake'
|