Class: ChangeHealthcare::Eligibility::Inspector
- Inherits:
-
Object
- Object
- ChangeHealthcare::Eligibility::Inspector
- Defined in:
- lib/change_healthcare/eligibility/inspector.rb
Overview
Provides basic inspection capabilities for a benefits information response.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#active_coverage?(matcher) ⇒ true, false
Does this document certify we have coverage for a service type matching the given matcher? ‘#===` on this matcher should take a string and return a boolean value.
-
#active_coverage_information ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
Benefits Information for active coverage.
-
#benefits_information ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
A list of all benefits information.
-
#coinsurance_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All BV records for co-insurance.
-
#copayment_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All BV records for co-payment.
-
#deductible_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All benefits information records that describe a deductible.
-
#initialize(response) ⇒ Inspector
constructor
Set up an inspector for a response.
Constructor Details
#initialize(response) ⇒ Inspector
Set up an inspector for a response.
10 11 12 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 10 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ ChangeHealthcare::Eligibility::SwaggerClient::Response (readonly)
79 80 81 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 79 def response @response end |
Instance Method Details
#active_coverage?(matcher) ⇒ true, false
Does this document certify we have coverage for a service type matching the given matcher? ‘#===` on this matcher should take a string and return a boolean value.
We use ‘#===` as there’s a lot of service type codes, and you might want to use a ‘Proc`, a `Set`, or a `Regexp` to do your matching.
23 24 25 26 27 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 23 def active_coverage?(matcher) active_coverage_information.any? do |coverage| (coverage.service_types || []).any? { |type| matcher === type } # rubocop:disable Style/CaseEquality end end |
#active_coverage_information ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
Benefits Information for active coverage
63 64 65 66 67 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 63 def active_coverage_information benefits_information.select do |bv| bv.name == 'Active Coverage' end end |
#benefits_information ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
A list of all benefits information.
73 74 75 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 73 def benefits_information response.benefits_information || [] end |
#coinsurance_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All BV records for co-insurance.
43 44 45 46 47 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 43 def coinsurance_records benefits_information.select do |bv| bv.name = 'Co-Insurance' end end |
#copayment_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All BV records for co-payment.
53 54 55 56 57 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 53 def copayment_records benefits_information.select do |bv| bv.name = 'Co-Payment' end end |
#deductible_records ⇒ Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>
All benefits information records that describe a deductible.
33 34 35 36 37 |
# File 'lib/change_healthcare/eligibility/inspector.rb', line 33 def deductible_records benefits_information.select do |bv| bv.name == 'Deductible' end end |