tvrage_api 0.1.1 → 0.2.0
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 +38 -8
- data/lib/tvrage_api/base.rb +8 -3
- data/lib/tvrage_api/client.rb +23 -3
- data/lib/tvrage_api/info.rb +19 -0
- data/lib/tvrage_api/recap.rb +47 -0
- data/lib/tvrage_api/schedule.rb +35 -0
- data/lib/tvrage_api/search.rb +30 -4
- data/lib/tvrage_api/show.rb +70 -8
- data/lib/tvrage_api/update.rb +16 -2
- data/lib/tvrage_api/version.rb +1 -1
- data/lib/tvrage_api.rb +3 -0
- data/spec/fixtures/all_recaps.xml +8 -0
- data/spec/fixtures/episode_info.xml +1 -0
- data/spec/fixtures/episode_list.xml +21 -0
- data/spec/fixtures/full_schedule.xml +60 -0
- data/spec/fixtures/full_search.xml +53 -0
- data/spec/fixtures/full_show_info.xml +36 -0
- data/spec/fixtures/last_recaps.xml +18 -0
- data/spec/fixtures/last_updates.xml +6 -0
- data/spec/fixtures/quick_info.txt +13 -0
- data/spec/fixtures/quick_schedule.txt +1 -0
- data/spec/fixtures/search.xml +39 -0
- data/spec/fixtures/show_info.xml +21 -0
- data/spec/fixtures/show_list.xml +5 -0
- data/spec/fixtures/show_recaps.xml +47 -0
- data/spec/functionals/info_spec.rb +30 -0
- data/spec/functionals/recap_spec.rb +66 -0
- data/spec/functionals/schedule_spec.rb +48 -0
- data/spec/functionals/search_spec.rb +48 -0
- data/spec/functionals/show_spec.rb +102 -0
- data/spec/functionals/update_spec.rb +30 -0
- data/spec/integrations/info_spec.rb +14 -0
- data/spec/integrations/recap_spec.rb +26 -0
- data/spec/integrations/schedule_spec.rb +20 -0
- data/spec/integrations/search_spec.rb +4 -3
- data/spec/integrations/show_spec.rb +12 -5
- data/spec/integrations/update_spec.rb +3 -2
- data/tvrage_api.gemspec +1 -1
- metadata +57 -18
- data/spec/integrations/client_spec.rb +0 -55
- data/spec/tvrage_api/client_spec.rb +0 -23
- data/spec/tvrage_api/search_spec.rb +0 -22
- data/spec/tvrage_api/show_spec.rb +0 -38
- data/spec/tvrage_api/update_spec.rb +0 -14
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<Results>
|
3
|
+
<show>
|
4
|
+
<showid>2930</showid>
|
5
|
+
<name>Buffy the Vampire Slayer</name>
|
6
|
+
<link>http://www.tvrage.com/Buffy_The_Vampire_Slayer</link>
|
7
|
+
<country>US</country>
|
8
|
+
<started>1997</started>
|
9
|
+
<ended>2003</ended>
|
10
|
+
<seasons>7</seasons>
|
11
|
+
<status>Ended</status>
|
12
|
+
<classification>Scripted</classification>
|
13
|
+
<genres><genre>Action</genre><genre>Adventure</genre><genre>Comedy</genre><genre>Drama</genre><genre>Horror/Supernatural</genre><genre>Mystery</genre><genre>Sci-Fi</genre></genres>
|
14
|
+
</show>
|
15
|
+
<show>
|
16
|
+
<showid>31192</showid>
|
17
|
+
<name>Buffy the Vampire Slayer - Season Eight: Motion comics</name>
|
18
|
+
<link>http://www.tvrage.com/shows/id-31192</link>
|
19
|
+
<country>US</country>
|
20
|
+
<started>2010</started>
|
21
|
+
<ended>2010</ended>
|
22
|
+
<seasons>1</seasons>
|
23
|
+
<status>Canceled/Ended</status>
|
24
|
+
<classification>Animation</classification>
|
25
|
+
<genres><genre>Animation General</genre><genre>Action</genre><genre>Adventure</genre><genre>Comedy</genre><genre>Drama</genre><genre>Horror/Supernatural</genre><genre>Sci-Fi</genre></genres>
|
26
|
+
</show>
|
27
|
+
<show>
|
28
|
+
<showid>2931</showid>
|
29
|
+
<name>Buffy the Animated Series</name>
|
30
|
+
<link>http://www.tvrage.com/Buffy_the_Animated_Series</link>
|
31
|
+
<country>US</country>
|
32
|
+
<started>2002</started>
|
33
|
+
<ended>0</ended>
|
34
|
+
<seasons>1</seasons>
|
35
|
+
<status>Pilot Rejected</status>
|
36
|
+
<classification>Animation</classification>
|
37
|
+
<genres><genre>Animation General</genre><genre>Action</genre><genre>Adventure</genre><genre>Horror/Supernatural</genre></genres>
|
38
|
+
</show>
|
39
|
+
</Results>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
|
3
|
+
<Showinfo>
|
4
|
+
<showid>2930</showid>
|
5
|
+
<showname>Buffy the Vampire Slayer</showname>
|
6
|
+
<showlink>http://tvrage.com/Buffy_The_Vampire_Slayer</showlink>
|
7
|
+
<seasons>7</seasons>
|
8
|
+
<started>1997</started>
|
9
|
+
<startdate>Mar/10/1997</startdate>
|
10
|
+
<ended>May/20/2003</ended>
|
11
|
+
<origin_country>US</origin_country>
|
12
|
+
<status>Ended</status>
|
13
|
+
<classification>Scripted</classification>
|
14
|
+
<genres><genre>Action</genre><genre>Adventure</genre><genre>Comedy</genre><genre>Drama</genre><genre>Horror/Supernatural</genre><genre>Mystery</genre><genre>Sci-Fi</genre></genres>
|
15
|
+
<runtime>60</runtime>
|
16
|
+
<network country="US">UPN</network>
|
17
|
+
<airtime>20:00</airtime>
|
18
|
+
<airday>Tuesday</airday>
|
19
|
+
<timezone>GMT-5 +DST</timezone>
|
20
|
+
<akas><aka country="SE">Buffy & vampyrerna</aka><aka country="DE">Buffy - Im Bann der Dämonen</aka><aka country="NO">Buffy - Vampyrenes skrekk</aka><aka country="HU">Buffy a vámpírok réme</aka><aka country="FR">Buffy Contre les Vampires</aka><aka country="IT">Buffy l'Ammazza Vampiri</aka><aka country="PL">Buffy postrach wampirów</aka><aka country="BR">Buffy, a Caça-Vampiros</aka><aka country="PT">Buffy, a Caçadora de Vampiros</aka><aka country="ES">Buffy, Cazavampiros</aka><aka country="HR">Buffy, ubojica vampira</aka><aka country="FI">Buffy, vampyyrintappaja</aka><aka country="EE">Vampiiritapja Buffy</aka><aka country="IS">Vampírubaninn Buffy</aka><aka country="RU">Баффи – истребительница вампиров</aka></akas>
|
21
|
+
</Showinfo>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
|
3
|
+
<recaps found='195' >
|
4
|
+
|
5
|
+
<showinfo>
|
6
|
+
<showid>5410</showid>
|
7
|
+
<seasons>10</seasons>
|
8
|
+
<showlink>http://tvrage.com/Supernatural</showlink>
|
9
|
+
</showinfo>
|
10
|
+
<eplist>
|
11
|
+
<Season no="1">
|
12
|
+
<episode>
|
13
|
+
<episode_id>166205</episode_id>
|
14
|
+
<season>1</season>
|
15
|
+
<epnum>1</epnum>
|
16
|
+
<episode_url></episode_url>
|
17
|
+
<recap_url>http://www.tvrage.com/Supernatural/episodes/166205</recap_url>
|
18
|
+
<recap></recap>
|
19
|
+
</episode>
|
20
|
+
<episode>
|
21
|
+
<episode_id>166206</episode_id>
|
22
|
+
<season>1</season>
|
23
|
+
<epnum>2</epnum>
|
24
|
+
<episode_url></episode_url>
|
25
|
+
<recap_url>http://www.tvrage.com/Supernatural/episodes/166206</recap_url>
|
26
|
+
<recap></recap>
|
27
|
+
</episode>
|
28
|
+
</Season>
|
29
|
+
|
30
|
+
<Season no="2">
|
31
|
+
<episode>
|
32
|
+
<episode_id>386441</episode_id>
|
33
|
+
<season>2</season>
|
34
|
+
<epnum>1</epnum>
|
35
|
+
<episode_url></episode_url>
|
36
|
+
<recap_url>http://www.tvrage.com/Supernatural/episodes/386441</recap_url>
|
37
|
+
<recap></recap>
|
38
|
+
</episode>
|
39
|
+
<episode>
|
40
|
+
<episode_id>412873</episode_id>
|
41
|
+
<season>2</season>
|
42
|
+
<epnum>2</epnum>
|
43
|
+
<episode_url></episode_url>
|
44
|
+
<recap_url>http://www.tvrage.com/Supernatural/episodes/412873</recap_url>
|
45
|
+
<recap></recap>
|
46
|
+
</episode>
|
47
|
+
</Season></eplist></recaps>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Info do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.info }
|
6
|
+
|
7
|
+
let(:data) { File.read('spec/fixtures/quick_info.txt') }
|
8
|
+
|
9
|
+
let(:faraday_stubs) do
|
10
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
|
+
stub.get('/tools/quickinfo.php?show=Alias') { [200, { content_type: 'text' }, data] }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.find' do
|
16
|
+
it 'should return Faraday::Response class' do
|
17
|
+
model.find(show: 'Alias').class.should == Faraday::Response
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return String class for body reponse' do
|
21
|
+
model.find(show: 'Alias').body == String
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.find_url' do
|
26
|
+
it 'should return correct url' do
|
27
|
+
model.find_url(show: 'Alias').should == 'http://services.tvrage.com/tools/quickinfo.php?show=Alias'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Recap do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.recap }
|
6
|
+
|
7
|
+
let(:all_data) { File.read('spec/fixtures/all_recaps.xml') }
|
8
|
+
let(:show_data) { File.read('spec/fixtures/show_recaps.xml') }
|
9
|
+
let(:last_data) { File.read('spec/fixtures/last_recaps.xml') }
|
10
|
+
|
11
|
+
let(:faraday_stubs) do
|
12
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
13
|
+
stub.get('/recaps/all_recaps.php') { [200, { content_type: 'xml' }, all_data] }
|
14
|
+
stub.get('/recaps/show_recaps.php?show=5410') { [200, { content_type: 'xml' }, show_data] }
|
15
|
+
stub.get('/recaps/last_recaps.php') { [200, { content_type: 'xml' }, last_data] }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '.all' do
|
20
|
+
it 'should return Faraday::Response class' do
|
21
|
+
model.all.class.should == Faraday::Response
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return Hash class for body reponse' do
|
25
|
+
model.all.body == Hash
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.all_url' do
|
30
|
+
it 'should return correct url' do
|
31
|
+
model.all_url.should == 'http://services.tvrage.com/recaps/all_recaps.php'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.show' do
|
36
|
+
it 'should return Faraday::Response class' do
|
37
|
+
model.show(show: 5410).class.should == Faraday::Response
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return Hash class for body reponse' do
|
41
|
+
model.show(show: 5410).body == Hash
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '.all_url' do
|
46
|
+
it 'should return correct url' do
|
47
|
+
model.show_url(show: 5410).should == 'http://services.tvrage.com/recaps/show_recaps.php?show=5410'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '.last' do
|
52
|
+
it 'should return Faraday::Response class' do
|
53
|
+
model.last.class.should == Faraday::Response
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should return Hash class for body reponse' do
|
57
|
+
model.last.body == Hash
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '.all_url' do
|
62
|
+
it 'should return correct url' do
|
63
|
+
model.last_url.should == 'http://services.tvrage.com/recaps/last_recaps.php'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Schedule do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.schedule }
|
6
|
+
|
7
|
+
let(:quick_data) { File.read('spec/fixtures/quick_schedule.txt') }
|
8
|
+
let(:full_data) { File.read('spec/fixtures/full_schedule.xml') }
|
9
|
+
|
10
|
+
let(:faraday_stubs) do
|
11
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
12
|
+
stub.get('/tools/quickschedule.php') { [200, { content_type: 'text' }, quick_data] }
|
13
|
+
stub.get('/feeds/fullschedule.php?country=US') { [200, { content_type: 'xml' }, full_data] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.quick' do
|
18
|
+
it 'should return Faraday::Response class' do
|
19
|
+
model.quick.class.should == Faraday::Response
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return String class for body reponse' do
|
23
|
+
model.quick.body == String
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.quick_url' do
|
28
|
+
it 'should return correct url' do
|
29
|
+
model.quick_url.should == 'http://services.tvrage.com/tools/quickschedule.php'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.full' do
|
34
|
+
it 'should return Faraday::Response class' do
|
35
|
+
model.full(country: 'US').class.should == Faraday::Response
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return Hash class for body reponse' do
|
39
|
+
model.full(country: 'US').body == Hash
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '.quick_url' do
|
44
|
+
it 'should return correct url' do
|
45
|
+
model.full_url(country: 'US').should == 'http://services.tvrage.com/feeds/fullschedule.php?country=US'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Search do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.search }
|
6
|
+
|
7
|
+
let(:search_data) { File.read('spec/fixtures/search.xml') }
|
8
|
+
let(:full_search_data) { File.read('spec/fixtures/full_search.xml') }
|
9
|
+
|
10
|
+
let(:faraday_stubs) do
|
11
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
12
|
+
stub.get('/feeds/search.php?show=buffy') { [200, { content_type: 'xml' }, search_data] }
|
13
|
+
stub.get('/feeds/full_search.php?show=buffy') { [200, { content_type: 'xml' }, full_search_data] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.by_name' do
|
18
|
+
it 'should return Faraday::Response class' do
|
19
|
+
model.by_name(show: 'buffy').class.should == Faraday::Response
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return Hash class for body reponse' do
|
23
|
+
model.by_name(show: 'buffy').body == Hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.by_name_url' do
|
28
|
+
it 'should return correct url' do
|
29
|
+
model.by_name_url(show: 'buffy').should == 'http://services.tvrage.com/feeds/search.php?show=buffy'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.full_by_name' do
|
34
|
+
it 'should return Faraday::Response class' do
|
35
|
+
model.full_by_name(show: 'buffy').class.should == Faraday::Response
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return Hash class for body reponse' do
|
39
|
+
model.full_by_name(show: 'buffy').body == Hash
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '.full_by_name_url' do
|
44
|
+
it 'should return correct url' do
|
45
|
+
model.full_by_name_url(show: 'buffy').should == 'http://services.tvrage.com/feeds/full_search.php?show=buffy'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Show do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.show }
|
6
|
+
|
7
|
+
let(:find_data) { File.read('spec/fixtures/show_info.xml') }
|
8
|
+
let(:find_full_data) { File.read('spec/fixtures/full_show_info.xml') }
|
9
|
+
let(:episodes_data) { File.read('spec/fixtures/episode_list.xml') }
|
10
|
+
let(:episode_data) { File.read('spec/fixtures/episode_info.xml') }
|
11
|
+
let(:all_data) { File.read('spec/fixtures/show_list.xml') }
|
12
|
+
|
13
|
+
let(:faraday_stubs) do
|
14
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
15
|
+
stub.get('/feeds/showinfo.php?sid=2930') { [200, { content_type: 'xml' }, find_data] }
|
16
|
+
stub.get('/feeds/full_show_info.php?sid=2930') { [200, { content_type: 'xml' }, find_full_data] }
|
17
|
+
stub.get('/feeds/episode_list.php?sid=2930') { [200, { content_type: 'xml' }, episodes_data] }
|
18
|
+
stub.get('/feeds/episodeinfo.php?sid=2930&ep=2x04') { [200, { content_type: 'xml' }, episode_data] }
|
19
|
+
stub.get('/feeds/show_list.php') { [200, { content_type: 'xml' }, all_data] }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.find' do
|
24
|
+
it 'should return Faraday::Response class' do
|
25
|
+
model.find(sid: 2930).class.should == Faraday::Response
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should return Hash class for body reponse' do
|
29
|
+
model.find(sid: 2930).body == Hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.find_url' do
|
34
|
+
it 'should return correct url' do
|
35
|
+
model.find_url(sid: 2930).should == 'http://services.tvrage.com/feeds/showinfo.php?sid=2930'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '.find_full' do
|
40
|
+
it 'should return Faraday::Response class' do
|
41
|
+
model.find_full(sid: 2930).class.should == Faraday::Response
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should return Hash class for body reponse' do
|
45
|
+
model.find_full(sid: 2930).body == Hash
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '.find_full_url' do
|
50
|
+
it 'should return correct url' do
|
51
|
+
model.find_full_url(sid: 2930).should == 'http://services.tvrage.com/feeds/full_show_info.php?sid=2930'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.episodes' do
|
56
|
+
it 'should return Faraday::Response class' do
|
57
|
+
model.episodes(sid: 2930).class.should == Faraday::Response
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should return Hash class for body reponse' do
|
61
|
+
model.episodes(sid: 2930).body == Hash
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '.episodes_url' do
|
66
|
+
it 'should return correct url' do
|
67
|
+
model.episodes_url(sid: 2930).should == 'http://services.tvrage.com/feeds/episode_list.php?sid=2930'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '.episode' do
|
72
|
+
it 'should return Faraday::Response class' do
|
73
|
+
model.episode(sid: 2930, ep: '2x04').class.should == Faraday::Response
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return Hash class for body reponse' do
|
77
|
+
model.episode(sid: 2930, ep: '2x04').body == Hash
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '.episode_url' do
|
82
|
+
it 'should return correct url' do
|
83
|
+
model.episode_url(sid: 2930, ep: '2x04').should == 'http://services.tvrage.com/feeds/episodeinfo.php?sid=2930&ep=2x04'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '.all' do
|
88
|
+
it 'should return Faraday::Response class' do
|
89
|
+
model.all.class.should == Faraday::Response
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should return Hash class for body reponse' do
|
93
|
+
model.all.body == Hash
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '.find_url' do
|
98
|
+
it 'should return correct url' do
|
99
|
+
model.all_url.should == 'http://services.tvrage.com/feeds/show_list.php'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Update do
|
4
|
+
let(:client) { TvrageApi::Client.new(adapter: :test, adapter_options: faraday_stubs) }
|
5
|
+
let(:model) { client.update }
|
6
|
+
|
7
|
+
let(:last_data) { File.read('spec/fixtures/last_updates.xml') }
|
8
|
+
|
9
|
+
let(:faraday_stubs) do
|
10
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
|
+
stub.get('/feeds/last_updates.php') { [200, { content_type: 'xml' }, last_data] }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.last' do
|
16
|
+
it 'should return Faraday::Response class' do
|
17
|
+
model.last.class.should == Faraday::Response
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return Hash class for body reponse' do
|
21
|
+
model.last.body == Hash
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.last_url' do
|
26
|
+
it 'should return correct url' do
|
27
|
+
model.last_url.should == 'http://services.tvrage.com/feeds/last_updates.php'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Info do
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.info }
|
6
|
+
|
7
|
+
describe 'real request' do
|
8
|
+
describe '.find' do
|
9
|
+
it 'should return response class' do
|
10
|
+
model.find(show: 'buffy').class.should == Faraday::Response
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Recap do
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.recap }
|
6
|
+
|
7
|
+
describe 'real request' do
|
8
|
+
describe '.all' do
|
9
|
+
it 'should return response class' do
|
10
|
+
model.all.class.should == Faraday::Response
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.show' do
|
15
|
+
it 'should return response class' do
|
16
|
+
model.show(show: 5410).class.should == Faraday::Response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.last' do
|
21
|
+
it 'should return response class' do
|
22
|
+
model.last.class.should == Faraday::Response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TvrageApi::Schedule do
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.schedule }
|
6
|
+
|
7
|
+
describe 'real request' do
|
8
|
+
describe '.quick' do
|
9
|
+
it 'should return response class' do
|
10
|
+
model.quick.class.should == Faraday::Response
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.full' do
|
15
|
+
it 'should return response class' do
|
16
|
+
model.full(country: 'US').class.should == Faraday::Response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,18 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe TvrageApi::Search do
|
4
|
-
let(:
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.search }
|
5
6
|
|
6
7
|
describe 'real request' do
|
7
8
|
describe '.by_name' do
|
8
9
|
it 'should return response class' do
|
9
|
-
model.by_name('buffy').class.should ==
|
10
|
+
model.by_name(show: 'buffy').class.should == Faraday::Response
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
describe '.full_by_name' do
|
14
15
|
it 'should return response class' do
|
15
|
-
model.full_by_name('buffy').class.should ==
|
16
|
+
model.full_by_name(show: 'buffy').class.should == Faraday::Response
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -1,30 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe TvrageApi::Show do
|
4
|
-
let(:
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.show }
|
5
6
|
|
6
7
|
describe 'real request' do
|
7
8
|
describe '.find' do
|
8
9
|
it 'should return response class' do
|
9
|
-
model.find('2930').class.should ==
|
10
|
+
model.find(sid: '2930').class.should == Faraday::Response
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
describe '.find_full' do
|
14
15
|
it 'should return response class' do
|
15
|
-
model.find_full('2930').class.should ==
|
16
|
+
model.find_full(sid: '2930').class.should == Faraday::Response
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
20
|
describe '.episodes' do
|
20
21
|
it 'should return response class' do
|
21
|
-
model.episodes('2930').class.should ==
|
22
|
+
model.episodes(sid: '2930').class.should == Faraday::Response
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
describe '.episode' do
|
26
27
|
it 'should return response class' do
|
27
|
-
model.episode('2930', '
|
28
|
+
model.episode(sid: '2930', ep: '2x04').class.should == Faraday::Response
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '.all' do
|
33
|
+
it 'should return response class' do
|
34
|
+
model.all.class.should == Faraday::Response
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe TvrageApi::Update do
|
4
|
-
let(:
|
4
|
+
let(:client) { TvrageApi::Client.new }
|
5
|
+
let(:model) { client.update }
|
5
6
|
|
6
7
|
describe 'real request' do
|
7
8
|
describe '.all' do
|
8
9
|
it 'should return response class' do
|
9
|
-
model.
|
10
|
+
model.last.class.should == Faraday::Response
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/tvrage_api.gemspec
CHANGED
@@ -18,7 +18,7 @@ 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 '
|
21
|
+
spec.add_runtime_dependency 'service_api', '~> 0.0.4'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'rake'
|