Class: ChangeHealth::Response::EligibilityBenefit
- Inherits:
-
Hash
- Object
- Hash
- ChangeHealth::Response::EligibilityBenefit
- Includes:
- Hashie::Extensions::IndifferentAccess, Hashie::Extensions::MergeInitializer
- Defined in:
- lib/change_health/response/eligibility/eligibility_benefit.rb
Constant Summary collapse
- OUT_OF_POCKET =
'G'
- COPAYMENT =
'B'
- COINSURANCE =
'A'
- NON_COVERED =
'I'
- DEDUCTIBLE =
'C'
- INDIVIDUAL =
'IND'
- CHILD =
'CHD'
- EMPLOYEE =
'EMP'
- FAMILY =
'FAM'
- EMPLOYEE_AND_CHILD =
'ECH'
- EMPLOYEE_AND_SPOUSE =
'ESP'
- VISIT =
'27'
- SERVICE_YEAR =
'22'
- YEAR =
'23'
- YTD =
'24'
- DAY =
'7'
- REMAINING =
'29'
- CODES =
{ out_of_pocket: OUT_OF_POCKET, copayment: COPAYMENT, coinsurance: COINSURANCE, non_covered: NON_COVERED, deductible: DEDUCTIBLE }
- COVERAGES =
{ individual: INDIVIDUAL, child: CHILD, employee: EMPLOYEE, family: FAMILY, employee_and_child: EMPLOYEE_AND_CHILD, employee_and_spouse: EMPLOYEE_AND_SPOUSE }
- TIMEFRAMES =
{ visit: VISIT, year: YEAR, remaining: REMAINING }
- MEDICARE =
{ part_a: 'MA', part_b: 'MB', primary: 'MP' }
- HELPERS =
{ timeQualifierCode: TIMEFRAMES, coverageLevelCode: COVERAGES, code: CODES }
Instance Method Summary collapse
- #amount ⇒ Object
- #descriptions ⇒ Object
- #in_plan_network? ⇒ Boolean (also: #in_plan?, #in_network?)
- #medicare? ⇒ Boolean
- #plan_date_range ⇒ Object
- #plan_date_range_end ⇒ Object
- #plan_date_range_start ⇒ Object
- #services ⇒ Object
Instance Method Details
#amount ⇒ Object
98 99 100 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 98 def amount self.coinsurance? ? self.benefitPercent : self.benefitAmount end |
#descriptions ⇒ Object
86 87 88 89 90 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 86 def descriptions data = self.additionalInformation || [] data.map {|info| info['description'] }.compact end |
#in_plan_network? ⇒ Boolean Also known as: in_plan?, in_network?
92 93 94 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 92 def in_plan_network? return 'Y' == self[:inPlanNetworkIndicatorCode] || self[:inPlanNetworkIndicatorCode].nil? && self.medicare? end |
#medicare? ⇒ Boolean
66 67 68 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 66 def medicare? MEDICARE.values.include?(self.insuranceTypeCode) end |
#plan_date_range ⇒ Object
117 118 119 120 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 117 def plan_date_range pd = self.date_info&.dig('plan') || '' pd.split('-') end |
#plan_date_range_end ⇒ Object
126 127 128 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 126 def plan_date_range_end ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[1]) end |
#plan_date_range_start ⇒ Object
122 123 124 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 122 def plan_date_range_start ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[0]) end |
#services ⇒ Object
102 103 104 |
# File 'lib/change_health/response/eligibility/eligibility_benefit.rb', line 102 def services self['serviceTypeCodes']&.each_with_index&.map {|stc, i| [stc, self['serviceTypes']&.at(i)]} || [] end |