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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d75d7dffd7bc8759f6a7c7ebabee2bc4f07f627
4
- data.tar.gz: 12624baae475ee3781ddbdb5a09a045da8a3a9cf
3
+ metadata.gz: d765a41a54c71deaa913d8c82240d5dfaea5bec9
4
+ data.tar.gz: 1629bc82237c2ee23495a8a6f1f39b2e1dca742c
5
5
  SHA512:
6
- metadata.gz: 32a0c55af9c9c4ed088bc13c0ef69c90651a9157ed5b25d0219e9fd3ead1a2b00cc19d10ea17204a534f03409ccd76b08fc03df7afaae4a94b3ebf9ecf17b9e6
7
- data.tar.gz: e5903a48129d43bc72344a5551ff22fd6676c1d13e7a19591251a98997742f842ccfa0c3a9d95eac9649910f74f71b07b3a2d0399696b3603fd02d6450e709d5
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.5.1)
13
- actionview (= 4.2.5.1)
14
- activesupport (= 4.2.5.1)
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.5.1)
20
- activesupport (= 4.2.5.1)
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.1)
25
+ active_interaction (2.2.0)
26
26
  activemodel (>= 3.2, < 5)
27
- activemodel (4.2.5.1)
28
- activesupport (= 4.2.5.1)
27
+ activemodel (4.2.6)
28
+ activesupport (= 4.2.6)
29
29
  builder (~> 3.1)
30
- activesupport (4.2.5.1)
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.12.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.5.1)
82
- actionpack (= 4.2.5.1)
83
- activesupport (= 4.2.5.1)
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
@@ -1,5 +1,5 @@
1
1
  module Fizzy
2
2
  module Api
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '0.0.5'.freeze
4
4
  end
5
5
  end
data/lib/fizzy/api.rb CHANGED
@@ -6,6 +6,7 @@ require 'fizzy/api/errors'
6
6
 
7
7
  require 'fizzy/api/calculate_outcome'
8
8
  require 'fizzy/api/render_graph'
9
+ require 'fizzy/api/render_overview'
9
10
 
10
11
  module Fizzy
11
12
  module Api
@@ -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
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-02-22 00:00:00.000000000 Z
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.4.5.1
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