roqua-healthy 1.4.2 → 1.4.3
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/.gitignore +1 -0
- data/.rubocop_todo.yml +4 -0
- data/Appraisals +11 -0
- data/circle.yml +9 -0
- data/gemfiles/rails41.gemfile +8 -0
- data/gemfiles/rails42.gemfile +8 -0
- data/gemfiles/rails50.gemfile +8 -0
- data/lib/roqua/healthy/a19/response_parser.rb +2 -1
- data/lib/roqua/healthy/a19/response_validator.rb +20 -5
- data/lib/roqua/healthy/version.rb +1 -1
- data/roqua-healthy.gemspec +3 -3
- data/spec/unit/a19/response_validator_spec.rb +51 -0
- metadata +27 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9671caf50e1efc23c7bf188c74fc55d5898c1a16
|
|
4
|
+
data.tar.gz: ad836d232fc0c15c81b866b3953eefd42f92e13d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb328e0dc13e579ec37a399aee4811d251703830693048d135eb6557313eb9847c16167a8289d0f4df51df951d7a91a02569f5aec6c7044c26efbd93137cb861
|
|
7
|
+
data.tar.gz: 920ee8298069a93fe883f13d882f9ed07ba4f2a3010bfc3e61c45eaaf99fa43b5adf0b61bcad8cfa268e68812e470c0b3bd9fc8f865330d5eefe2795340ecc1a
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
data/Appraisals
ADDED
data/circle.yml
CHANGED
|
@@ -3,7 +3,16 @@ machine:
|
|
|
3
3
|
Europe/Amsterdam
|
|
4
4
|
ruby:
|
|
5
5
|
version: 2.3.1
|
|
6
|
+
dependencies:
|
|
7
|
+
override:
|
|
8
|
+
- bundle install
|
|
9
|
+
- gem install appraisal
|
|
10
|
+
- appraisal
|
|
6
11
|
test:
|
|
12
|
+
override:
|
|
13
|
+
- appraisal rails41 bundle exec rspec
|
|
14
|
+
- appraisal rails42 bundle exec rspec
|
|
15
|
+
- appraisal rails50 bundle exec rspec
|
|
7
16
|
post:
|
|
8
17
|
- bundle exec rubocop
|
|
9
18
|
- bundle exec codeclimate-test-reporter
|
|
@@ -18,7 +18,8 @@ module Roqua
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
20
|
def parsed_body
|
|
21
|
-
|
|
21
|
+
# from_xml will throw 'IOError: not modifiable string' without using dup in ActiveSupport 4.*
|
|
22
|
+
@parsed_body ||= Hash.from_xml(response.body.dup)
|
|
22
23
|
rescue REXML::ParseException => e
|
|
23
24
|
raise IllegalMirthResponse, e.message
|
|
24
25
|
end
|
|
@@ -5,10 +5,27 @@ module Roqua
|
|
|
5
5
|
module Healthy
|
|
6
6
|
module A19
|
|
7
7
|
class ResponseValidator
|
|
8
|
+
require 'roqua/healthy/errors'
|
|
9
|
+
|
|
8
10
|
attr_reader :response_code
|
|
9
11
|
attr_reader :parser
|
|
10
12
|
attr_reader :patient_id
|
|
11
13
|
|
|
14
|
+
ERRORS = {
|
|
15
|
+
'Timeout waiting for ACK' =>
|
|
16
|
+
::Roqua::Healthy::Timeout,
|
|
17
|
+
"Unable to connect to destination\tSocketTimeoutException\tconnect timed out" =>
|
|
18
|
+
::Roqua::Healthy::Timeout,
|
|
19
|
+
'ERROR: Timeout waiting for response' =>
|
|
20
|
+
::Roqua::Healthy::Timeout,
|
|
21
|
+
'ERROR: SocketTimeoutException: connect timed out' =>
|
|
22
|
+
::Roqua::Healthy::Timeout,
|
|
23
|
+
"Unable to connect to destination\tConnectException\tConnection refused" =>
|
|
24
|
+
::Roqua::Healthy::ConnectionRefused,
|
|
25
|
+
'ERROR: ConnectException: Connection refused' =>
|
|
26
|
+
::Roqua::Healthy::ConnectionRefused
|
|
27
|
+
}.freeze
|
|
28
|
+
|
|
12
29
|
def initialize(response_code, parser, patient_id)
|
|
13
30
|
@response_code = response_code
|
|
14
31
|
@parser = parser
|
|
@@ -46,11 +63,9 @@ module Roqua
|
|
|
46
63
|
end
|
|
47
64
|
|
|
48
65
|
def validate_500
|
|
49
|
-
|
|
50
|
-
raise
|
|
51
|
-
raise ::Roqua::Healthy::
|
|
52
|
-
raise ::Roqua::Healthy::ConnectionRefused, failure["error"] if failure["error"] == "Unable to connect to destination\tConnectException\tConnection refused" || failure["error"] == 'ERROR: ConnectException: Connection refused'
|
|
53
|
-
raise ::Roqua::Healthy::UnknownFailure, failure["error"]
|
|
66
|
+
error = parser.fetch('failure')['error']
|
|
67
|
+
raise ERRORS[error], error if ERRORS[error]
|
|
68
|
+
raise ::Roqua::Healthy::UnknownFailure, error
|
|
54
69
|
end
|
|
55
70
|
|
|
56
71
|
private
|
data/roqua-healthy.gemspec
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
require File.expand_path('../lib/roqua/healthy/version', __FILE__)
|
|
5
5
|
|
|
6
|
-
# rubocop:disable Metrics/BlockLength
|
|
7
6
|
Gem::Specification.new do |gem|
|
|
8
7
|
gem.name = "roqua-healthy"
|
|
9
8
|
gem.version = Roqua::Healthy::VERSION
|
|
@@ -21,14 +20,15 @@ Gem::Specification.new do |gem|
|
|
|
21
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
22
21
|
gem.require_paths = ['lib']
|
|
23
22
|
|
|
24
|
-
gem.add_dependency 'activesupport', '>= 3.2', '<
|
|
23
|
+
gem.add_dependency 'activesupport', '>= 3.2', '< 6'
|
|
25
24
|
gem.add_dependency 'addressable', '~> 2.3'
|
|
26
|
-
gem.add_dependency 'roqua-support', '~> 0.1.
|
|
25
|
+
gem.add_dependency 'roqua-support', '~> 0.1.22'
|
|
27
26
|
|
|
28
27
|
gem.add_development_dependency 'bundler', '~> 1.0'
|
|
29
28
|
gem.add_development_dependency 'rake', '~> 10.0'
|
|
30
29
|
gem.add_development_dependency 'rspec', '~> 3.3.0'
|
|
31
30
|
gem.add_development_dependency 'yard', '~> 0.8'
|
|
31
|
+
gem.add_development_dependency 'appraisal'
|
|
32
32
|
|
|
33
33
|
# Required for the tests
|
|
34
34
|
gem.add_development_dependency 'webmock', '~> 1.13'
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe Roqua::Healthy::A19::ResponseValidator do
|
|
5
|
+
describe '#validate' do
|
|
6
|
+
subject { Roqua::Healthy::A19::ResponseValidator.new('500', double(fetch: {'error' => error}), 123) }
|
|
7
|
+
let(:error) { self.class.description }
|
|
8
|
+
|
|
9
|
+
context "Timeout waiting for ACK" do
|
|
10
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
11
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::Timeout)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context 'ERROR: Timeout waiting for response' do
|
|
16
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
17
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::Timeout)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context "Unable to connect to destination\tSocketTimeoutException\tconnect timed out" do
|
|
22
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
23
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::Timeout)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'ERROR: SocketTimeoutException: connect timed out' do
|
|
28
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
29
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::Timeout)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "Unable to connect to destination\tConnectException\tConnection refused" do
|
|
34
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
35
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::ConnectionRefused)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context 'ERROR: ConnectException: Connection refused' do
|
|
40
|
+
it 'raises ::Roqua::Healthy::Timeout' do
|
|
41
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::ConnectionRefused)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context 'Unknown error' do
|
|
46
|
+
it 'raises ::Roqua::Healthy::UnknownFailure' do
|
|
47
|
+
expect { subject.validate }.to raise_error(::Roqua::Healthy::UnknownFailure)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roqua-healthy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marten Veldthuis
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: activesupport
|
|
@@ -22,7 +22,7 @@ dependencies:
|
|
|
22
22
|
version: '3.2'
|
|
23
23
|
- - "<"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '6'
|
|
26
26
|
type: :runtime
|
|
27
27
|
prerelease: false
|
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '3.2'
|
|
33
33
|
- - "<"
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '
|
|
35
|
+
version: '6'
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: addressable
|
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,14 +53,14 @@ dependencies:
|
|
|
53
53
|
requirements:
|
|
54
54
|
- - "~>"
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: 0.1.
|
|
56
|
+
version: 0.1.22
|
|
57
57
|
type: :runtime
|
|
58
58
|
prerelease: false
|
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
|
61
61
|
- - "~>"
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 0.1.
|
|
63
|
+
version: 0.1.22
|
|
64
64
|
- !ruby/object:Gem::Dependency
|
|
65
65
|
name: bundler
|
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,6 +117,20 @@ dependencies:
|
|
|
117
117
|
- - "~>"
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
119
|
version: '0.8'
|
|
120
|
+
- !ruby/object:Gem::Dependency
|
|
121
|
+
name: appraisal
|
|
122
|
+
requirement: !ruby/object:Gem::Requirement
|
|
123
|
+
requirements:
|
|
124
|
+
- - ">="
|
|
125
|
+
- !ruby/object:Gem::Version
|
|
126
|
+
version: '0'
|
|
127
|
+
type: :development
|
|
128
|
+
prerelease: false
|
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
120
134
|
- !ruby/object:Gem::Dependency
|
|
121
135
|
name: webmock
|
|
122
136
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -256,6 +270,7 @@ files:
|
|
|
256
270
|
- ".rubocop.yml"
|
|
257
271
|
- ".rubocop_todo.yml"
|
|
258
272
|
- ".yardopts"
|
|
273
|
+
- Appraisals
|
|
259
274
|
- ChangeLog.md
|
|
260
275
|
- Gemfile
|
|
261
276
|
- Guardfile
|
|
@@ -267,6 +282,9 @@ files:
|
|
|
267
282
|
- bin/get_xml_for_patient
|
|
268
283
|
- bin/parse_local_xml
|
|
269
284
|
- circle.yml
|
|
285
|
+
- gemfiles/rails41.gemfile
|
|
286
|
+
- gemfiles/rails42.gemfile
|
|
287
|
+
- gemfiles/rails50.gemfile
|
|
270
288
|
- lib/roqua/healthy.rb
|
|
271
289
|
- lib/roqua/healthy/a19.rb
|
|
272
290
|
- lib/roqua/healthy/a19/address_parser.rb
|
|
@@ -328,6 +346,7 @@ files:
|
|
|
328
346
|
- spec/unit/a19/address_parser_spec.rb
|
|
329
347
|
- spec/unit/a19/correct_patient_check_spec.rb
|
|
330
348
|
- spec/unit/a19/fetcher_spec.rb
|
|
349
|
+
- spec/unit/a19/response_validator_spec.rb
|
|
331
350
|
- spec/unit/a19_spec.rb
|
|
332
351
|
- spec/unit/client_spec.rb
|
|
333
352
|
- spec/unit/message_cleaner_spec.rb
|
|
@@ -351,7 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
351
370
|
version: '0'
|
|
352
371
|
requirements: []
|
|
353
372
|
rubyforge_project:
|
|
354
|
-
rubygems_version: 2.5.
|
|
373
|
+
rubygems_version: 2.5.2
|
|
355
374
|
signing_key:
|
|
356
375
|
specification_version: 4
|
|
357
376
|
summary: Arranges communication between Mirth and RoQua
|
|
@@ -400,6 +419,7 @@ test_files:
|
|
|
400
419
|
- spec/unit/a19/address_parser_spec.rb
|
|
401
420
|
- spec/unit/a19/correct_patient_check_spec.rb
|
|
402
421
|
- spec/unit/a19/fetcher_spec.rb
|
|
422
|
+
- spec/unit/a19/response_validator_spec.rb
|
|
403
423
|
- spec/unit/a19_spec.rb
|
|
404
424
|
- spec/unit/client_spec.rb
|
|
405
425
|
- spec/unit/message_cleaner_spec.rb
|