roqua-healthy 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e65abd168ac44778d8529b3fdf30028f5f508507
4
- data.tar.gz: bb8b7cb307d96912b1b1b459fa65bfe7029dbea9
3
+ metadata.gz: 9671caf50e1efc23c7bf188c74fc55d5898c1a16
4
+ data.tar.gz: ad836d232fc0c15c81b866b3953eefd42f92e13d
5
5
  SHA512:
6
- metadata.gz: 0727c1968cb9f8373a823fbdb82f3d8d0f85e41524b72d63aed0c7c04fd0a3abe1e6284a4979a6fd0700abe1a1651bbc26ccdb39ebcee3812304238874d29805
7
- data.tar.gz: e3d1b61925ab1b0825605aa72e11e74147b9b3bc877f05a327324c4151e37042e08f27998b381b5555f1f8cf5bbe4d8bda6cbfea083fb3b4b7738ae423be8bdf
6
+ metadata.gz: cb328e0dc13e579ec37a399aee4811d251703830693048d135eb6557313eb9847c16167a8289d0f4df51df951d7a91a02569f5aec6c7044c26efbd93137cb861
7
+ data.tar.gz: 920ee8298069a93fe883f13d882f9ed07ba4f2a3010bfc3e61c45eaaf99fa43b5adf0b61bcad8cfa268e68812e470c0b3bd9fc8f865330d5eefe2795340ecc1a
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  .idea
3
3
  .yardoc
4
4
  Gemfile.lock
5
+ gemfiles/*.lock
5
6
  doc/
6
7
  pkg/
7
8
  tmp/
data/.rubocop_todo.yml CHANGED
@@ -15,6 +15,10 @@ Metrics/AbcSize:
15
15
  Metrics/ClassLength:
16
16
  Max: 104
17
17
 
18
+ # Offense count: 9
19
+ Metrics/BlockLength:
20
+ Max: 184
21
+
18
22
  # Offense count: 80
19
23
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
20
24
  # URISchemes: http, https
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "rails41" do
2
+ gem "activesupport", "4.1"
3
+ end
4
+
5
+ appraise "rails42" do
6
+ gem "activesupport", "4.2"
7
+ end
8
+
9
+ appraise "rails50" do
10
+ gem "activesupport", "5.0"
11
+ end
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
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
6
+ gem "activesupport", "4.1"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
6
+ gem "activesupport", "4.2"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
6
+ gem "activesupport", "5.0"
7
+
8
+ gemspec :path => "../"
@@ -18,7 +18,8 @@ module Roqua
18
18
  private
19
19
 
20
20
  def parsed_body
21
- @parsed_body ||= Hash.from_xml(response.body)
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
- failure = parser.fetch("failure")
50
- raise ::Roqua::Healthy::Timeout, failure["error"] if failure["error"] == "Timeout waiting for ACK" || failure["error"] == 'ERROR: Timeout waiting for response'
51
- raise ::Roqua::Healthy::Timeout, failure["error"] if failure["error"] == "Unable to connect to destination\tSocketTimeoutException\tconnect timed out"
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
@@ -2,6 +2,6 @@
2
2
  module Roqua
3
3
  module Healthy
4
4
  # healthy version
5
- VERSION = "1.4.2"
5
+ VERSION = "1.4.3"
6
6
  end
7
7
  end
@@ -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', '< 5.0'
23
+ gem.add_dependency 'activesupport', '>= 3.2', '< 6'
25
24
  gem.add_dependency 'addressable', '~> 2.3'
26
- gem.add_dependency 'roqua-support', '~> 0.1.18'
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.2
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: 2016-11-14 00:00:00.000000000 Z
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: '5.0'
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: '5.0'
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.18
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.18
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.1
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