change_health 0.13.0 → 1.0.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cfcfc82d3ec608b10581ec2e3e3ab3d9c32be70cf5bfa77c1ebfe5e8b555951
|
4
|
+
data.tar.gz: 2149e728393f0dfcf688a55f36130d06f89954f804b7453fe9099296323e3641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa77cb096c2306dc05c352e8df308d508f81baea56b6a9fbfde6f0950afb5ac036ff524324acd4a002ca4a17c8b33f7f17efe1d80bc3802b5a121726caaf798e
|
7
|
+
data.tar.gz: b13779d73d544eb5217b6d8efbfdd7c47bb1beb6df0ab3e4c3d9f8033a78c66c979a28d12c21600c836b9433578097360c8944c3b48d9f278a6c3f075d12f5e0
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,32 @@ 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.2] - [2021-04-06]
|
8
|
+
### Added
|
9
|
+
- EligibilityData#recommend_retry? - fix a bug in the search statement
|
10
|
+
|
11
|
+
## [1.0.1] - [2021-03-24]
|
12
|
+
### Added
|
13
|
+
- EligibilityData#plan_status - adds ability to select instead of find
|
14
|
+
- EligibilityData#inactive? active? - use new plan_status select
|
15
|
+
|
16
|
+
## [1.0.0] - [2021-03-17]
|
17
|
+
### Added
|
18
|
+
- Model::Error - help with error codes
|
19
|
+
- EligibilityData#recommend_retry? - if it looks like you can retry the exact same request
|
20
|
+
- EligibilityData#inactive? - looks for plan status 6
|
21
|
+
|
22
|
+
## [0.15.0] - [2020-06-12]
|
23
|
+
### Added
|
24
|
+
- Extensions - InNetworkMissing for plans that don't provide in network indicators.
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- Bug where active codes with no service codes cause exception.
|
28
|
+
|
29
|
+
## [0.14.0] - [2020-05-07]
|
30
|
+
### Added
|
31
|
+
- Extensions - mixins for common overrides
|
32
|
+
|
7
33
|
## [0.13.0] - [2020-05-05]
|
8
34
|
### Changed
|
9
35
|
- Removed `alias_method` for `where` helpers so you can override a single method
|
@@ -100,6 +126,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
100
126
|
- Authentication
|
101
127
|
- Configuration
|
102
128
|
|
129
|
+
[1.0.2]: https://github.com/WeInfuse/change_health/compare/v1.0.1...v1.0.2
|
130
|
+
[1.0.1]: https://github.com/WeInfuse/change_health/compare/v1.0.0...v1.0.1
|
131
|
+
[1.0.0]: https://github.com/WeInfuse/change_health/compare/v0.15.0...v1.0.0
|
132
|
+
[0.15.0]: https://github.com/WeInfuse/change_health/compare/v0.14.0...v0.15.0
|
133
|
+
[0.14.0]: https://github.com/WeInfuse/change_health/compare/v0.13.0...v0.14.0
|
103
134
|
[0.13.0]: https://github.com/WeInfuse/change_health/compare/v0.12.0...v0.13.0
|
104
135
|
[0.12.0]: https://github.com/WeInfuse/change_health/compare/v0.11.0...v0.12.0
|
105
136
|
[0.11.0]: https://github.com/WeInfuse/change_health/compare/v0.10.0...v0.11.0
|
data/lib/change_health.rb
CHANGED
@@ -4,6 +4,7 @@ require 'change_health/version'
|
|
4
4
|
require 'change_health/change_health_exception'
|
5
5
|
require 'change_health/connection'
|
6
6
|
require 'change_health/authentication'
|
7
|
+
require 'change_health/extensions'
|
7
8
|
require 'change_health/models/model'
|
8
9
|
require 'change_health/models/eligibility'
|
9
10
|
require 'change_health/models/eligibility_data'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Extensions
|
3
|
+
module InNetworkW
|
4
|
+
def in_network
|
5
|
+
self.where(inPlanNetworkIndicatorCode: 'Y') + self.where(inPlanNetworkIndicatorCode: 'W')
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module InNetworkMissing
|
10
|
+
def in_network
|
11
|
+
self.where_not(inPlanNetworkIndicatorCode: 'N')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module DeductiblesIgnoreSpecialistZero
|
16
|
+
def deductibles
|
17
|
+
super.where_not(serviceTypeCodes: '98', benefitAmount: '0')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module CopaymentsIgnoreSpecialistZero
|
22
|
+
def copayments
|
23
|
+
super.where_not(serviceTypeCodes: '98', benefitAmount: '0')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module CoinsurancesIgnoreSpecialistZero
|
28
|
+
def coinsurances
|
29
|
+
super.where_not(serviceTypeCodes: '98', benefitPercent: '0')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module IndividualsAllNonFamily
|
34
|
+
def individuals
|
35
|
+
self.where_not(coverageLevelCode: 'FAM')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,8 +1,55 @@
|
|
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
|
+
def initialize(data)
|
17
|
+
@data = data
|
18
|
+
end
|
19
|
+
|
20
|
+
def message
|
21
|
+
field_message || code_message
|
22
|
+
end
|
23
|
+
|
24
|
+
def field_message
|
25
|
+
"#{field}: #{description}" if field?
|
26
|
+
end
|
27
|
+
|
28
|
+
def code_message
|
29
|
+
"#{code}: #{description}" if code?
|
30
|
+
end
|
31
|
+
|
32
|
+
def retryable?
|
33
|
+
code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? {|msg| followupAction.downcase.include?(msg) }
|
34
|
+
end
|
35
|
+
|
36
|
+
%w[field description code followupAction location].each do |method_name|
|
37
|
+
define_method("#{method_name}?") do
|
38
|
+
false == send(method_name).nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
define_method("#{method_name}") do
|
42
|
+
@data[method_name]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
3
47
|
class EligibilityData
|
4
48
|
attr_reader :response, :raw
|
5
49
|
|
50
|
+
ACTIVE = '1'
|
51
|
+
INACTIVE = '6'
|
52
|
+
|
6
53
|
PARSE_DATE = ->(d) {
|
7
54
|
begin
|
8
55
|
d = Date.strptime(d, ChangeHealth::Models::DATE_FORMAT)
|
@@ -25,18 +72,38 @@ module ChangeHealth
|
|
25
72
|
end
|
26
73
|
|
27
74
|
def active?(service_code: '30')
|
28
|
-
|
75
|
+
plan_status(service_code: service_code, single: false).any? {|status| ACTIVE == status['statusCode'] }
|
76
|
+
end
|
77
|
+
|
78
|
+
def inactive?(service_code: '30')
|
79
|
+
plan_status(service_code: service_code, single: false).any? {|status| INACTIVE == status['statusCode'] }
|
29
80
|
end
|
30
81
|
|
31
82
|
def errors?
|
32
83
|
self.errors.is_a?(Array) && false == self.errors.empty?
|
33
84
|
end
|
34
85
|
|
86
|
+
def errors
|
87
|
+
errors = @raw.dig('errors') || []
|
88
|
+
|
89
|
+
errors.flatten.map {|error| ChangeHealth::Models::Error.new(error) }
|
90
|
+
end
|
91
|
+
|
92
|
+
def recommend_retry?
|
93
|
+
return false unless errors?
|
94
|
+
|
95
|
+
error_codes = errors.select(&:code?)
|
96
|
+
|
97
|
+
return false if error_codes.empty?
|
98
|
+
|
99
|
+
return error_codes.all?(&:retryable?)
|
100
|
+
end
|
101
|
+
|
35
102
|
def dependents?
|
36
103
|
true == self.dependents&.any?
|
37
104
|
end
|
38
105
|
|
39
|
-
%w(planStatus benefitsInformation controlNumber planDateInformation dependents
|
106
|
+
%w(planStatus benefitsInformation controlNumber planDateInformation dependents).each do |v|
|
40
107
|
define_method(v) do
|
41
108
|
@raw.dig(v)
|
42
109
|
end
|
@@ -64,8 +131,12 @@ module ChangeHealth
|
|
64
131
|
ChangeHealth::Models::EligibilityData::PARSE_DATE.call(self.plan_date_range[1])
|
65
132
|
end
|
66
133
|
|
67
|
-
def plan_status(service_code: )
|
68
|
-
|
134
|
+
def plan_status(service_code: , single: true)
|
135
|
+
if true == single
|
136
|
+
self.planStatus&.find {|plan| plan.dig('serviceTypeCodes')&.include?(service_code) } || {}
|
137
|
+
else
|
138
|
+
self.planStatus&.select {|plan| plan.dig('serviceTypeCodes')&.include?(service_code) } || []
|
139
|
+
end
|
69
140
|
end
|
70
141
|
|
71
142
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.9'
|
131
|
-
description:
|
131
|
+
description:
|
132
132
|
email:
|
133
133
|
- mike.crockett@weinfuse.com
|
134
134
|
executables: []
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/change_health/authentication.rb
|
147
147
|
- lib/change_health/change_health_exception.rb
|
148
148
|
- lib/change_health/connection.rb
|
149
|
+
- lib/change_health/extensions.rb
|
149
150
|
- lib/change_health/models/eligibility.rb
|
150
151
|
- lib/change_health/models/eligibility_benefit.rb
|
151
152
|
- lib/change_health/models/eligibility_benefits.rb
|
@@ -164,7 +165,7 @@ licenses:
|
|
164
165
|
- MIT
|
165
166
|
metadata:
|
166
167
|
allowed_push_host: https://rubygems.org
|
167
|
-
post_install_message:
|
168
|
+
post_install_message:
|
168
169
|
rdoc_options: []
|
169
170
|
require_paths:
|
170
171
|
- lib
|
@@ -179,9 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
- !ruby/object:Gem::Version
|
180
181
|
version: '0'
|
181
182
|
requirements: []
|
182
|
-
|
183
|
-
|
184
|
-
signing_key:
|
183
|
+
rubygems_version: 3.2.15
|
184
|
+
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: Ruby wrapper for the ChangeHealth API
|
187
187
|
test_files: []
|