fizzy-api 0.0.4 → 0.0.5
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/Gemfile.lock +13 -13
- data/lib/fizzy/api/render_overview.rb +26 -0
- data/lib/fizzy/api/version.rb +1 -1
- data/lib/fizzy/api.rb +1 -0
- data/spec/fizzy/api/render_overview_spec.rb +38 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d765a41a54c71deaa913d8c82240d5dfaea5bec9
|
4
|
+
data.tar.gz: 1629bc82237c2ee23495a8a6f1f39b2e1dca742c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af5c89cbb76c641e49a0bc5543b3f58555e9b4946fdcb7230842d91acec8fbd69a59cbbf9d9b5027e2a04c66c237e6a700c98ec095c4167c4c2078f55b29117
|
7
|
+
data.tar.gz: b0ed37127e42328832831d7758cdae12aaa02af6b26d3dd6171c14ec169325333d5f4c93cab2e56b4109b3d35615648862eaa8ecb83ecacfd099a449fe3554f5
|
data/Gemfile.lock
CHANGED
@@ -9,25 +9,25 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionpack (4.2.
|
13
|
-
actionview (= 4.2.
|
14
|
-
activesupport (= 4.2.
|
12
|
+
actionpack (4.2.6)
|
13
|
+
actionview (= 4.2.6)
|
14
|
+
activesupport (= 4.2.6)
|
15
15
|
rack (~> 1.6)
|
16
16
|
rack-test (~> 0.6.2)
|
17
17
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
18
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
-
actionview (4.2.
|
20
|
-
activesupport (= 4.2.
|
19
|
+
actionview (4.2.6)
|
20
|
+
activesupport (= 4.2.6)
|
21
21
|
builder (~> 3.1)
|
22
22
|
erubis (~> 2.7.0)
|
23
23
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
24
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
-
active_interaction (2.0
|
25
|
+
active_interaction (2.2.0)
|
26
26
|
activemodel (>= 3.2, < 5)
|
27
|
-
activemodel (4.2.
|
28
|
-
activesupport (= 4.2.
|
27
|
+
activemodel (4.2.6)
|
28
|
+
activesupport (= 4.2.6)
|
29
29
|
builder (~> 3.1)
|
30
|
-
activesupport (4.2.
|
30
|
+
activesupport (4.2.6)
|
31
31
|
i18n (~> 0.7)
|
32
32
|
json (~> 1.7, >= 1.7.7)
|
33
33
|
minitest (~> 5.1)
|
@@ -51,7 +51,7 @@ GEM
|
|
51
51
|
factory_girl_rails (4.6.0)
|
52
52
|
factory_girl (~> 4.5.0)
|
53
53
|
railties (>= 3.0.0)
|
54
|
-
httparty (0.
|
54
|
+
httparty (0.13.7)
|
55
55
|
json (~> 1.8)
|
56
56
|
multi_xml (>= 0.5.2)
|
57
57
|
i18n (0.7.0)
|
@@ -78,9 +78,9 @@ GEM
|
|
78
78
|
rails-deprecated_sanitizer (>= 1.0.1)
|
79
79
|
rails-html-sanitizer (1.0.3)
|
80
80
|
loofah (~> 2.0)
|
81
|
-
railties (4.2.
|
82
|
-
actionpack (= 4.2.
|
83
|
-
activesupport (= 4.2.
|
81
|
+
railties (4.2.6)
|
82
|
+
actionpack (= 4.2.6)
|
83
|
+
activesupport (= 4.2.6)
|
84
84
|
rake (>= 0.8.7)
|
85
85
|
thor (>= 0.18.1, < 2.0)
|
86
86
|
rainbow (2.1.0)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fizzy
|
2
|
+
module Api
|
3
|
+
class RenderOverview < ActiveInteraction::Base
|
4
|
+
string :dossier_id
|
5
|
+
string :protocol_subscription_id
|
6
|
+
|
7
|
+
def execute
|
8
|
+
response = Api.basic_auth_session.get("/dossier/#{dossier_id}"\
|
9
|
+
"/protocol_subscriptions/#{protocol_subscription_id}" \
|
10
|
+
'/render.json')
|
11
|
+
process_response(response)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def process_response(response)
|
17
|
+
case response.code
|
18
|
+
when 200
|
19
|
+
response
|
20
|
+
else
|
21
|
+
raise Errors::UnexpectedStatusError, "Status code #{response.code} not expected."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/fizzy/api/version.rb
CHANGED
data/lib/fizzy/api.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Fizzy
|
3
|
+
module Api
|
4
|
+
describe RenderOverview do
|
5
|
+
let(:dossier_id) { '123' }
|
6
|
+
let(:protocol_subscription_id) { 'abc' }
|
7
|
+
let(:response) { httparty_response('{}') }
|
8
|
+
let(:session) { FactoryGirl.build :basic_auth_session }
|
9
|
+
|
10
|
+
before do
|
11
|
+
allow(Sessions::BasicAuthSession).to receive(:new).and_return session
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should call the correct url' do
|
15
|
+
expect(session).to receive(:get)
|
16
|
+
.with("/dossier/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}/render.json")
|
17
|
+
.and_return(response)
|
18
|
+
outcome = described_class.run! dossier_id: dossier_id,
|
19
|
+
protocol_subscription_id: protocol_subscription_id
|
20
|
+
expect(outcome).to eq '{}'
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'error handling' do
|
24
|
+
it 'should fail a 500 with an UnexpectedStatusError' do
|
25
|
+
allow(response).to receive(:code).and_return 500
|
26
|
+
expect(session).to receive(:get)
|
27
|
+
.with("/dossier/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}/render.json")
|
28
|
+
.and_return(response)
|
29
|
+
outcome = lambda do
|
30
|
+
described_class.run! dossier_id: dossier_id,
|
31
|
+
protocol_subscription_id: protocol_subscription_id
|
32
|
+
end
|
33
|
+
expect { outcome.call }.to raise_error(Errors::UnexpectedStatusError)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fizzy-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Blaauw
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/fizzy/api/errors/unexpected_status_error.rb
|
136
136
|
- lib/fizzy/api/models.rb
|
137
137
|
- lib/fizzy/api/render_graph.rb
|
138
|
+
- lib/fizzy/api/render_overview.rb
|
138
139
|
- lib/fizzy/api/sessions.rb
|
139
140
|
- lib/fizzy/api/sessions/basic_auth_session.rb
|
140
141
|
- lib/fizzy/api/version.rb
|
@@ -142,6 +143,7 @@ files:
|
|
142
143
|
- spec/factories/basic_auth_session.rb
|
143
144
|
- spec/fizzy/api/calculate_outcome_spec.rb
|
144
145
|
- spec/fizzy/api/render_graph_spec.rb
|
146
|
+
- spec/fizzy/api/render_overview_spec.rb
|
145
147
|
- spec/fizzy/api/sessions/basic_auth_session_spec.rb
|
146
148
|
- spec/fizzy/api/sessions_spec.rb
|
147
149
|
- spec/spec_helper.rb
|
@@ -166,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
168
|
version: '0'
|
167
169
|
requirements: []
|
168
170
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.6.2
|
170
172
|
signing_key:
|
171
173
|
specification_version: 4
|
172
174
|
summary: API wrapper gem around Fizzy's Graph API
|
@@ -174,6 +176,7 @@ test_files:
|
|
174
176
|
- spec/factories/basic_auth_session.rb
|
175
177
|
- spec/fizzy/api/calculate_outcome_spec.rb
|
176
178
|
- spec/fizzy/api/render_graph_spec.rb
|
179
|
+
- spec/fizzy/api/render_overview_spec.rb
|
177
180
|
- spec/fizzy/api/sessions/basic_auth_session_spec.rb
|
178
181
|
- spec/fizzy/api/sessions_spec.rb
|
179
182
|
- spec/spec_helper.rb
|