change_health 0.10.0 → 0.11.0
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: 767cc901793797d00ab0ad05891f50875a58cc4e872a0a40f6c5624c458c2187
|
4
|
+
data.tar.gz: f8e2abe6dc0bdd724dfa36c0fbaa793ef693380d1e92bee62c883c0f1d807262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b4f26498031de59b118145015e3219712f2cb9d80e1aa671ac0cff4708db92406b7a234c9c885584bb1bab7ae6fe2011e868a4c554c51992028699966db5add
|
7
|
+
data.tar.gz: 279f7b1032b48d196e72614ffd41c79519026b9dac34c83d8413806e48f115c915442259783e6db0399e7bbe8b5f7e3345fb2186015bad653c5a7789bd1d3039
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,21 @@ 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
|
+
## [0.11.0] - [2020-04-23]
|
8
|
+
### Added
|
9
|
+
- EligibilityData#medicare?
|
10
|
+
- EligibilityData#plan\_id
|
11
|
+
- EligibilityData#plan?
|
12
|
+
- EligibilityBenefits#where\_not
|
13
|
+
- EligibilityBenefits#+
|
14
|
+
- EligibilityBenefit#additional\_info
|
15
|
+
- EligibilityBenefit#descriptions
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- EligibilityData initialize now checks for sub-classes of EligibilityBenefits with trading partner
|
19
|
+
- EligibilityData initialize now checks for sub-classes of EligibilityBenefits with trading partner responds to `factory` to choose sub-class
|
20
|
+
- EligibilityBenefits initializes `self.class` type in case it's a subclass
|
21
|
+
|
7
22
|
## [0.10.0] - [2020-04-09]
|
8
23
|
### Added
|
9
24
|
- Add Trading Partner API querying capability
|
@@ -74,6 +89,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
74
89
|
- Authentication
|
75
90
|
- Configuration
|
76
91
|
|
92
|
+
[0.11.0]: https://github.com/WeInfuse/change_health/compare/v0.10.0...v0.11.0
|
77
93
|
[0.10.0]: https://github.com/WeInfuse/change_health/compare/v0.9.0...v0.10.0
|
78
94
|
[0.9.0]: https://github.com/WeInfuse/change_health/compare/v0.8.0...v0.9.0
|
79
95
|
[0.8.0]: https://github.com/WeInfuse/change_health/compare/v0.7.0...v0.8.0
|
@@ -14,7 +14,8 @@ module ChangeHealth
|
|
14
14
|
CHILD = 'CHD'
|
15
15
|
EMPLOYEE = 'EMP'
|
16
16
|
FAMILY = 'FAM'
|
17
|
-
EMPLOYEE_AND_CHILD
|
17
|
+
EMPLOYEE_AND_CHILD = 'ECH'
|
18
|
+
EMPLOYEE_AND_SPOUSE = 'ESP'
|
18
19
|
|
19
20
|
VISIT = '27'
|
20
21
|
YEAR = '23'
|
@@ -32,7 +33,8 @@ module ChangeHealth
|
|
32
33
|
child: CHILD,
|
33
34
|
employee: EMPLOYEE,
|
34
35
|
family: FAMILY,
|
35
|
-
employee_and_child: EMPLOYEE_AND_CHILD
|
36
|
+
employee_and_child: EMPLOYEE_AND_CHILD,
|
37
|
+
employee_and_spouse: EMPLOYEE_AND_SPOUSE
|
36
38
|
}
|
37
39
|
TIMEFRAMES = {
|
38
40
|
visit: VISIT,
|
@@ -68,7 +70,7 @@ module ChangeHealth
|
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
71
|
-
%w(insuranceType insuranceTypeCode benefitsDateInformation).each do |method|
|
73
|
+
%w(insuranceType insuranceTypeCode benefitsDateInformation additionalInformation).each do |method|
|
72
74
|
define_method("#{method}") do
|
73
75
|
self[method]
|
74
76
|
end
|
@@ -76,6 +78,13 @@ module ChangeHealth
|
|
76
78
|
alias_method :date_info, :benefitsDateInformation
|
77
79
|
alias_method :insurance_type, :insuranceType
|
78
80
|
alias_method :insurance_type_code, :insuranceTypeCode
|
81
|
+
alias_method :additional_info, :additionalInformation
|
82
|
+
|
83
|
+
def descriptions
|
84
|
+
data = self.additionalInformation || []
|
85
|
+
|
86
|
+
data.map {|info| info['description'] }.compact
|
87
|
+
end
|
79
88
|
|
80
89
|
def in_plan_network?
|
81
90
|
return 'Y' == self[:inPlanNetworkIndicatorCode] || self[:inPlanNetworkIndicatorCode].nil? && self.medicare?
|
@@ -6,7 +6,15 @@ module ChangeHealth
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def where(**kwargs)
|
9
|
-
|
9
|
+
self.class.new(self.select {|benefit| kwargs.all? {|k,v| benefit_matches?(benefit, k, v) } })
|
10
|
+
end
|
11
|
+
|
12
|
+
def where_not(**kwargs)
|
13
|
+
self.class.new(self.reject {|benefit| kwargs.all? {|k,v| benefit_matches?(benefit, k, v) } })
|
14
|
+
end
|
15
|
+
|
16
|
+
def +(other_obj)
|
17
|
+
self.class.new(self.to_a + other_obj.to_a)
|
10
18
|
end
|
11
19
|
|
12
20
|
def find_by(**kwargs)
|
@@ -25,17 +33,24 @@ module ChangeHealth
|
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
|
-
def individual_coinsurance_visit(**kwargs)
|
29
|
-
self.individual.coinsurances.visits.where(kwargs).first
|
30
|
-
end
|
31
|
-
|
32
36
|
%w(family individual employee child employee_and_child).each do |method|
|
33
37
|
alias_method method, "#{method}s"
|
34
38
|
|
35
|
-
%w(copayment
|
36
|
-
|
39
|
+
%w(copayment coinsurance).each do |type_mod|
|
40
|
+
method_name = "#{method}_#{type_mod}"
|
41
|
+
alias_name = method_name.gsub('copayment', 'copay')
|
42
|
+
|
43
|
+
define_method(method_name) do |**kwargs|
|
44
|
+
self.send(method).send("#{type_mod}s").where(kwargs).first
|
45
|
+
end
|
46
|
+
|
47
|
+
alias_method alias_name, method_name if alias_name != method_name
|
48
|
+
end
|
49
|
+
|
50
|
+
%w(deductible out_of_pocket).each do |type_mod|
|
51
|
+
%w(year remaining).each do |time_mod|
|
37
52
|
method_name = "#{method}_#{type_mod}_#{time_mod}"
|
38
|
-
alias_name = method_name.gsub('
|
53
|
+
alias_name = method_name.gsub('out_of_pocket', 'oop')
|
39
54
|
|
40
55
|
define_method(method_name) do |**kwargs|
|
41
56
|
self.send(method).send("#{type_mod}s").send("#{time_mod}s").where(kwargs).first || self.send(method).send("#{type_mod}s").where(kwargs).first
|
@@ -28,7 +28,11 @@ module ChangeHealth
|
|
28
28
|
return '1' == plan_status(service_code: service_code).dig('statusCode')
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
def dependents?
|
32
|
+
true == self.dependents&.any?
|
33
|
+
end
|
34
|
+
|
35
|
+
%w(planStatus benefitsInformation controlNumber planDateInformation dependents).each do |v|
|
32
36
|
define_method(v) do
|
33
37
|
@raw.dig(v)
|
34
38
|
end
|
@@ -56,17 +60,40 @@ module ChangeHealth
|
|
56
60
|
ChangeHealth::Models::EligibilityData::PARSE_DATE.call(self.plan_date_range[1])
|
57
61
|
end
|
58
62
|
|
59
|
-
|
60
63
|
def plan_status(service_code: )
|
61
64
|
self.planStatus&.find {|plan| plan.dig('serviceTypeCodes').include?(service_code) } || {}
|
62
65
|
end
|
63
66
|
|
64
67
|
def benefits
|
65
|
-
ChangeHealth::Models::EligibilityBenefits
|
68
|
+
kname = "ChangeHealth::Models::EligibilityBenefits#{self.trading_partner_id&.upcase}"
|
69
|
+
klazz = Object.const_get(kname) if Module.const_defined?(kname)
|
70
|
+
klazz ||= ChangeHealth::Models::EligibilityBenefits
|
71
|
+
|
72
|
+
if klazz.respond_to?(:factory)
|
73
|
+
klazz = klazz.factory(self)
|
74
|
+
end
|
75
|
+
|
76
|
+
klazz.new(self.benefitsInformation || [])
|
77
|
+
end
|
78
|
+
|
79
|
+
def medicare?(**kwargs)
|
80
|
+
false == benefits.empty? && benefits.where(kwargs).all? {|b| b.medicare? }
|
81
|
+
end
|
82
|
+
|
83
|
+
def plan?(name)
|
84
|
+
self.plan_names.any? {|pname| name == pname }
|
85
|
+
end
|
86
|
+
|
87
|
+
def plan_names
|
88
|
+
self.planStatus&.map {|plan_status| plan_status['planDetails'] }&.compact || []
|
89
|
+
end
|
90
|
+
|
91
|
+
def trading_partner?(name)
|
92
|
+
self.trading_partner_id == name
|
66
93
|
end
|
67
94
|
|
68
|
-
def
|
69
|
-
|
95
|
+
def trading_partner_id
|
96
|
+
@raw['tradingPartnerServiceId']
|
70
97
|
end
|
71
98
|
|
72
99
|
alias_method :control_number, :controlNumber
|
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: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|