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.
@@ -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
- it 'should return Faraday::Response class' do
17
- expect(model.last).to be_a(Faraday::Response)
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
- it 'should return Hash class for body reponse' do
21
- expect(model.last.body).to be_a(Hash)
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
- it 'should return correct url' do
27
- expect(model.last_url).to eq('http://services.tvrage.com/feeds/last_updates.php')
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').class.should == Faraday::Response
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.class.should == Faraday::Response
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(show: 5410).class.should == Faraday::Response
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.class.should == Faraday::Response
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.class.should == Faraday::Response
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').class.should == Faraday::Response
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(show: 'buffy').class.should == Faraday::Response
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(show: 'buffy').class.should == Faraday::Response
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(sid: '2930').class.should == Faraday::Response
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(sid: '2930').class.should == Faraday::Response
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(sid: '2930').class.should == Faraday::Response
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(sid: '2930', ep: '2x04').class.should == Faraday::Response
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.class.should == Faraday::Response
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 '.all' do
8
+ describe '.last' do
9
9
  it 'should return response class' do
10
- model.last.class.should == Faraday::Response
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
@@ -3,7 +3,5 @@ require 'bundler/setup'
3
3
  require 'coveralls'
4
4
  Coveralls.wear!
5
5
 
6
+ require 'awesome_print'
6
7
  require 'tvrage_api'
7
-
8
- RSpec.configure do |config|
9
- end
@@ -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.5'
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.0.0'
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.2.1
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: 2014-08-31 00:00:00.000000000 Z
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.5
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.5
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.0.0
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.0.0
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.0.3
202
+ rubygems_version: 2.4.5
155
203
  signing_key:
156
204
  specification_version: 4
157
205
  summary: Ruby client for tvrage.com API