change_health 0.14.0 → 1.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69bacf8024e568af3c7dbbdfe638ede842f44392fc870128a7da9242ce7a7094
|
4
|
+
data.tar.gz: d1e9b4d07f32e0631b75820cfe31e0aa4a6f37f77ccebe8e63cdbf826a29ea90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa7f24775ab4760c110a0b3977a51170c4d465651753b184c65be967a1d48708d3564b63357db110ea8d538be2bece70bb07282623c85c35dc5d789fa68c0703
|
7
|
+
data.tar.gz: 8307d1353765e881915c50ee02b3c280c5abb73e42f94f9f814f3089c004b6e7d0c4c70130070f964f9922f5496f5b46a8b582956d945cac2d4ddbb6a561cc0d
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.0.3] - [2021-04-26]
|
8
|
+
### Added
|
9
|
+
- Model::Error#represents_down? - adds ability to distinguish error representing down state
|
10
|
+
- Model::Error#retryable? - retryable when down
|
11
|
+
- EligibilityData#recommend_retry? - recommend retry when down
|
12
|
+
|
13
|
+
## [1.0.2] - [2021-04-06]
|
14
|
+
### Added
|
15
|
+
- EligibilityData#recommend_retry? - fix a bug in the search statement
|
16
|
+
|
17
|
+
## [1.0.1] - [2021-03-24]
|
18
|
+
### Added
|
19
|
+
- EligibilityData#plan_status - adds ability to select instead of find
|
20
|
+
- EligibilityData#inactive? active? - use new plan_status select
|
21
|
+
|
22
|
+
## [1.0.0] - [2021-03-17]
|
23
|
+
### Added
|
24
|
+
- Model::Error - help with error codes
|
25
|
+
- EligibilityData#recommend_retry? - if it looks like you can retry the exact same request
|
26
|
+
- EligibilityData#inactive? - looks for plan status 6
|
27
|
+
|
28
|
+
## [0.15.0] - [2020-06-12]
|
29
|
+
### Added
|
30
|
+
- Extensions - InNetworkMissing for plans that don't provide in network indicators.
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
- Bug where active codes with no service codes cause exception.
|
34
|
+
|
7
35
|
## [0.14.0] - [2020-05-07]
|
8
36
|
### Added
|
9
37
|
- Extensions - mixins for common overrides
|
@@ -104,6 +132,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
104
132
|
- Authentication
|
105
133
|
- Configuration
|
106
134
|
|
135
|
+
[1.0.3]: https://github.com/WeInfuse/change_health/compare/v1.0.2...v1.0.3
|
136
|
+
[1.0.2]: https://github.com/WeInfuse/change_health/compare/v1.0.1...v1.0.2
|
137
|
+
[1.0.1]: https://github.com/WeInfuse/change_health/compare/v1.0.0...v1.0.1
|
138
|
+
[1.0.0]: https://github.com/WeInfuse/change_health/compare/v0.15.0...v1.0.0
|
139
|
+
[0.15.0]: https://github.com/WeInfuse/change_health/compare/v0.14.0...v0.15.0
|
107
140
|
[0.14.0]: https://github.com/WeInfuse/change_health/compare/v0.13.0...v0.14.0
|
108
141
|
[0.13.0]: https://github.com/WeInfuse/change_health/compare/v0.12.0...v0.13.0
|
109
142
|
[0.12.0]: https://github.com/WeInfuse/change_health/compare/v0.11.0...v0.12.0
|
@@ -6,6 +6,12 @@ module ChangeHealth
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
module InNetworkMissing
|
10
|
+
def in_network
|
11
|
+
self.where_not(inPlanNetworkIndicatorCode: 'N')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
9
15
|
module DeductiblesIgnoreSpecialistZero
|
10
16
|
def deductibles
|
11
17
|
super.where_not(serviceTypeCodes: '98', benefitAmount: '0')
|
@@ -1,8 +1,64 @@
|
|
1
1
|
module ChangeHealth
|
2
2
|
module Models
|
3
|
+
class Error
|
4
|
+
attr_reader :data
|
5
|
+
|
6
|
+
SIMPLE_RETRY_CODES = %w[
|
7
|
+
42
|
8
|
+
80
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
NO_RESUBMIT_MESSAGES = [
|
12
|
+
'resubmission not allowed',
|
13
|
+
'do not resubmit'
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
DOWN_FIELD = 'Http Header'.freeze
|
17
|
+
|
18
|
+
DOWN_MESSAGE = 'Please review http headers for this API, please contact support if you are unsure how to resolve.'.freeze
|
19
|
+
|
20
|
+
def initialize(data)
|
21
|
+
@data = data
|
22
|
+
end
|
23
|
+
|
24
|
+
def message
|
25
|
+
field_message || code_message
|
26
|
+
end
|
27
|
+
|
28
|
+
def field_message
|
29
|
+
"#{field}: #{description}" if field?
|
30
|
+
end
|
31
|
+
|
32
|
+
def code_message
|
33
|
+
"#{code}: #{description}" if code?
|
34
|
+
end
|
35
|
+
|
36
|
+
def represents_down?
|
37
|
+
field == DOWN_FIELD && description == DOWN_MESSAGE
|
38
|
+
end
|
39
|
+
|
40
|
+
def retryable?
|
41
|
+
represents_down? ||
|
42
|
+
(code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? {|msg| followupAction.downcase.include?(msg) })
|
43
|
+
end
|
44
|
+
|
45
|
+
%w[field description code followupAction location].each do |method_name|
|
46
|
+
define_method("#{method_name}?") do
|
47
|
+
false == send(method_name).nil?
|
48
|
+
end
|
49
|
+
|
50
|
+
define_method("#{method_name}") do
|
51
|
+
@data[method_name]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
3
56
|
class EligibilityData
|
4
57
|
attr_reader :response, :raw
|
5
58
|
|
59
|
+
ACTIVE = '1'
|
60
|
+
INACTIVE = '6'
|
61
|
+
|
6
62
|
PARSE_DATE = ->(d) {
|
7
63
|
begin
|
8
64
|
d = Date.strptime(d, ChangeHealth::Models::DATE_FORMAT)
|
@@ -25,18 +81,40 @@ module ChangeHealth
|
|
25
81
|
end
|
26
82
|
|
27
83
|
def active?(service_code: '30')
|
28
|
-
|
84
|
+
plan_status(service_code: service_code, single: false).any? {|status| ACTIVE == status['statusCode'] }
|
85
|
+
end
|
86
|
+
|
87
|
+
def inactive?(service_code: '30')
|
88
|
+
plan_status(service_code: service_code, single: false).any? {|status| INACTIVE == status['statusCode'] }
|
29
89
|
end
|
30
90
|
|
31
91
|
def errors?
|
32
92
|
self.errors.is_a?(Array) && false == self.errors.empty?
|
33
93
|
end
|
34
94
|
|
95
|
+
def errors
|
96
|
+
errors = @raw.dig('errors') || []
|
97
|
+
|
98
|
+
errors.flatten.map {|error| ChangeHealth::Models::Error.new(error) }
|
99
|
+
end
|
100
|
+
|
101
|
+
def recommend_retry?
|
102
|
+
return false unless errors?
|
103
|
+
|
104
|
+
return true if errors.any?(&:represents_down?)
|
105
|
+
|
106
|
+
error_codes = errors.select(&:code?)
|
107
|
+
|
108
|
+
return false if error_codes.empty?
|
109
|
+
|
110
|
+
return error_codes.all?(&:retryable?)
|
111
|
+
end
|
112
|
+
|
35
113
|
def dependents?
|
36
114
|
true == self.dependents&.any?
|
37
115
|
end
|
38
116
|
|
39
|
-
%w(planStatus benefitsInformation controlNumber planDateInformation dependents
|
117
|
+
%w(planStatus benefitsInformation controlNumber planDateInformation dependents).each do |v|
|
40
118
|
define_method(v) do
|
41
119
|
@raw.dig(v)
|
42
120
|
end
|
@@ -64,8 +142,12 @@ module ChangeHealth
|
|
64
142
|
ChangeHealth::Models::EligibilityData::PARSE_DATE.call(self.plan_date_range[1])
|
65
143
|
end
|
66
144
|
|
67
|
-
def plan_status(service_code: )
|
68
|
-
|
145
|
+
def plan_status(service_code: , single: true)
|
146
|
+
if true == single
|
147
|
+
self.planStatus&.find {|plan| plan.dig('serviceTypeCodes')&.include?(service_code) } || {}
|
148
|
+
else
|
149
|
+
self.planStatus&.select {|plan| plan.dig('serviceTypeCodes')&.include?(service_code) } || []
|
150
|
+
end
|
69
151
|
end
|
70
152
|
|
71
153
|
def benefits
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: change_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|