tvrage_api 0.2.1 → 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/.rspec +2 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +32 -0
- data/README.md +66 -82
- data/lib/tvrage_api.rb +11 -1
- data/lib/tvrage_api/attributes_mapping/recap/show.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/search/by_name.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/show/episode.rb +6 -0
- data/lib/tvrage_api/attributes_mapping/show/find.rb +5 -0
- data/lib/tvrage_api/info.rb +50 -10
- data/lib/tvrage_api/recap.rb +59 -13
- data/lib/tvrage_api/schedule.rb +74 -14
- data/lib/tvrage_api/search.rb +60 -14
- data/lib/tvrage_api/show.rb +116 -31
- data/lib/tvrage_api/update.rb +36 -10
- data/lib/tvrage_api/version.rb +1 -1
- data/spec/functionals/info_spec.rb +26 -6
- data/spec/functionals/recap_spec.rb +55 -15
- data/spec/functionals/schedule_spec.rb +53 -12
- data/spec/functionals/search_spec.rb +52 -12
- data/spec/functionals/show_spec.rb +104 -24
- data/spec/functionals/update_spec.rb +27 -6
- data/spec/integrations/info_spec.rb +6 -1
- data/spec/integrations/recap_spec.rb +18 -3
- data/spec/integrations/schedule_spec.rb +12 -2
- data/spec/integrations/search_spec.rb +12 -2
- data/spec/integrations/show_spec.rb +30 -5
- data/spec/integrations/update_spec.rb +7 -2
- data/spec/spec_helper.rb +1 -3
- data/tvrage_api.gemspec +5 -2
- metadata +55 -7
@@ -9,22 +9,43 @@ describe TvrageApi::Update do
|
|
9
9
|
let(:faraday_stubs) do
|
10
10
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
11
|
stub.get('/feeds/last_updates.php') { [200, { content_type: 'xml' }, last_data] }
|
12
|
+
stub.get('/feeds/last_updates.php?hours=48&sort=episodes&since=1418056721') { [200, { content_type: 'xml' }, last_data] }
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
describe '.last' do
|
16
|
-
|
17
|
-
|
17
|
+
context 'hash attributes' do
|
18
|
+
it 'should return Faraday::Response class' do
|
19
|
+
expect(model.last(hours: 48, sort: 'episodes', since: 1418056721)).to be_a(Faraday::Response)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return Hash class for body reponse' do
|
23
|
+
expect(model.last(hours: 48, sort: 'episodes', since: 1418056721).body).to be_a(Hash)
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
|
-
|
21
|
-
|
27
|
+
context 'normal attributes' do
|
28
|
+
it 'should return Faraday::Response class' do
|
29
|
+
expect(model.last).to be_a(Faraday::Response)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should return Hash class for body reponse' do
|
33
|
+
expect(model.last.body).to be_a(Hash)
|
34
|
+
end
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
25
38
|
describe '.last_url' do
|
26
|
-
|
27
|
-
|
39
|
+
context 'hash attributes' do
|
40
|
+
it 'should return correct url' do
|
41
|
+
expect(model.last_url(hours: 48, sort: 'episodes', since: 1418056721)).to eq('http://services.tvrage.com/feeds/last_updates.php?hours=48&sort=episodes&since=1418056721')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'normal attributes' do
|
46
|
+
it 'should return correct url' do
|
47
|
+
expect(model.last_url).to eq('http://services.tvrage.com/feeds/last_updates.php')
|
48
|
+
end
|
28
49
|
end
|
29
50
|
end
|
30
51
|
end
|
@@ -7,7 +7,12 @@ describe TvrageApi::Info do
|
|
7
7
|
describe 'real request' do
|
8
8
|
describe '.find' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.find(show: 'buffy')
|
10
|
+
response = model.find(show: 'buffy')
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(String)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
@@ -7,19 +7,34 @@ describe TvrageApi::Recap do
|
|
7
7
|
describe 'real request' do
|
8
8
|
describe '.all' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.all
|
10
|
+
response = model.all
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(Hash)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
describe '.show' do
|
15
20
|
it 'should return response class' do
|
16
|
-
model.show(
|
21
|
+
response = model.show(id: 5410)
|
22
|
+
ap response.body
|
23
|
+
|
24
|
+
expect(response).to be_a(Faraday::Response)
|
25
|
+
expect(response.status).to eq(200)
|
26
|
+
expect(response.body).to be_a(Hash)
|
17
27
|
end
|
18
28
|
end
|
19
29
|
|
20
30
|
describe '.last' do
|
21
31
|
it 'should return response class' do
|
22
|
-
model.last
|
32
|
+
response = model.last(30)
|
33
|
+
ap response.body
|
34
|
+
|
35
|
+
expect(response).to be_a(Faraday::Response)
|
36
|
+
expect(response.status).to eq(200)
|
37
|
+
expect(response.body).to be_a(Hash)
|
23
38
|
end
|
24
39
|
end
|
25
40
|
end
|
@@ -7,13 +7,23 @@ describe TvrageApi::Schedule do
|
|
7
7
|
describe 'real request' do
|
8
8
|
describe '.quick' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.quick
|
10
|
+
response = model.quick(country: 'US')
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(String)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
describe '.full' do
|
15
20
|
it 'should return response class' do
|
16
|
-
model.full(country: 'US')
|
21
|
+
response = model.full(country: 'US')
|
22
|
+
ap response.body
|
23
|
+
|
24
|
+
expect(response).to be_a(Faraday::Response)
|
25
|
+
expect(response.status).to eq(200)
|
26
|
+
expect(response.body).to be_a(Hash)
|
17
27
|
end
|
18
28
|
end
|
19
29
|
end
|
@@ -7,13 +7,23 @@ describe TvrageApi::Search do
|
|
7
7
|
describe 'real request' do
|
8
8
|
describe '.by_name' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.by_name(
|
10
|
+
response = model.by_name(name: 'buffy')
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(Hash)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
describe '.full_by_name' do
|
15
20
|
it 'should return response class' do
|
16
|
-
model.full_by_name(
|
21
|
+
response = model.full_by_name(name: 'buffy')
|
22
|
+
ap response.body
|
23
|
+
|
24
|
+
expect(response).to be_a(Faraday::Response)
|
25
|
+
expect(response.status).to eq(200)
|
26
|
+
expect(response.body).to be_a(Hash)
|
17
27
|
end
|
18
28
|
end
|
19
29
|
end
|
@@ -7,31 +7,56 @@ describe TvrageApi::Show do
|
|
7
7
|
describe 'real request' do
|
8
8
|
describe '.find' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.find(
|
10
|
+
response = model.find(id: '2930')
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(Hash)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
describe '.find_full' do
|
15
20
|
it 'should return response class' do
|
16
|
-
model.find_full(
|
21
|
+
response = model.find_full(id: '2930')
|
22
|
+
ap response.body
|
23
|
+
|
24
|
+
expect(response).to be_a(Faraday::Response)
|
25
|
+
expect(response.status).to eq(200)
|
26
|
+
expect(response.body).to be_a(Hash)
|
17
27
|
end
|
18
28
|
end
|
19
29
|
|
20
30
|
describe '.episodes' do
|
21
31
|
it 'should return response class' do
|
22
|
-
model.episodes(
|
32
|
+
response = model.episodes(id: '2930')
|
33
|
+
ap response.body
|
34
|
+
|
35
|
+
expect(response).to be_a(Faraday::Response)
|
36
|
+
expect(response.status).to eq(200)
|
37
|
+
expect(response.body).to be_a(Hash)
|
23
38
|
end
|
24
39
|
end
|
25
40
|
|
26
41
|
describe '.episode' do
|
27
42
|
it 'should return response class' do
|
28
|
-
model.episode(
|
43
|
+
response = model.episode(show_id: '2930', episode: '2x04')
|
44
|
+
ap response.body
|
45
|
+
|
46
|
+
expect(response).to be_a(Faraday::Response)
|
47
|
+
expect(response.status).to eq(200)
|
48
|
+
expect(response.body).to be_a(Hash)
|
29
49
|
end
|
30
50
|
end
|
31
51
|
|
32
52
|
describe '.all' do
|
33
53
|
it 'should return response class' do
|
34
|
-
model.all
|
54
|
+
response = model.all
|
55
|
+
ap response.body
|
56
|
+
|
57
|
+
expect(response).to be_a(Faraday::Response)
|
58
|
+
expect(response.status).to eq(200)
|
59
|
+
expect(response.body).to be_a(Hash)
|
35
60
|
end
|
36
61
|
end
|
37
62
|
end
|
@@ -5,9 +5,14 @@ describe TvrageApi::Update do
|
|
5
5
|
let(:model) { client.update }
|
6
6
|
|
7
7
|
describe 'real request' do
|
8
|
-
describe '.
|
8
|
+
describe '.last' do
|
9
9
|
it 'should return response class' do
|
10
|
-
model.last
|
10
|
+
response = model.last(hours: 48, sort: 'episodes', since: 1418056721)
|
11
|
+
ap response.body
|
12
|
+
|
13
|
+
expect(response).to be_a(Faraday::Response)
|
14
|
+
expect(response.status).to eq(200)
|
15
|
+
expect(response.body).to be_a(Hash)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
data/spec/spec_helper.rb
CHANGED
data/tvrage_api.gemspec
CHANGED
@@ -18,10 +18,13 @@ 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 'service_api', '~> 0.0
|
21
|
+
spec.add_runtime_dependency 'service_api', '~> 0.1.0'
|
22
|
+
spec.add_runtime_dependency 'ov', '~> 0.1.0'
|
23
|
+
spec.add_runtime_dependency 'hashie', '>= 1.1.0'
|
22
24
|
|
23
25
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
26
|
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
26
28
|
spec.add_development_dependency 'coveralls', '>= 0.7'
|
29
|
+
spec.add_development_dependency 'awesome_print', '~> 1.6.1'
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tvrage_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wawer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: service_api
|
@@ -16,14 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0
|
19
|
+
version: 0.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0
|
26
|
+
version: 0.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.1.0
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: bundler
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +86,14 @@ dependencies:
|
|
58
86
|
requirements:
|
59
87
|
- - ~>
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
89
|
+
version: 3.1.0
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - ~>
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
96
|
+
version: 3.1.0
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: coveralls
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +108,20 @@ dependencies:
|
|
80
108
|
- - '>='
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: awesome_print
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.6.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.6.1
|
83
125
|
description: Ruby client for accessing TV shows information from the tvrage.com API
|
84
126
|
email:
|
85
127
|
- krzysztof.wawer@gmail.com
|
@@ -88,12 +130,18 @@ extensions: []
|
|
88
130
|
extra_rdoc_files: []
|
89
131
|
files:
|
90
132
|
- .gitignore
|
133
|
+
- .rspec
|
91
134
|
- .travis.yml
|
135
|
+
- CHANGELOG.md
|
92
136
|
- Gemfile
|
93
137
|
- LICENSE.txt
|
94
138
|
- README.md
|
95
139
|
- Rakefile
|
96
140
|
- lib/tvrage_api.rb
|
141
|
+
- lib/tvrage_api/attributes_mapping/recap/show.rb
|
142
|
+
- lib/tvrage_api/attributes_mapping/search/by_name.rb
|
143
|
+
- lib/tvrage_api/attributes_mapping/show/episode.rb
|
144
|
+
- lib/tvrage_api/attributes_mapping/show/find.rb
|
97
145
|
- lib/tvrage_api/base.rb
|
98
146
|
- lib/tvrage_api/client.rb
|
99
147
|
- lib/tvrage_api/info.rb
|
@@ -151,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
199
|
version: '0'
|
152
200
|
requirements: []
|
153
201
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.4.5
|
155
203
|
signing_key:
|
156
204
|
specification_version: 4
|
157
205
|
summary: Ruby client for tvrage.com API
|