class ChangeHealthcare::Eligibility::Inspector
Provides basic inspection capabilities for a benefits information response.
Attributes
@return [ChangeHealthcare::Eligibility::SwaggerClient::Response]
Public Class Methods
Set up an inspector for a response.
@param response [ChangeHealthcare::Eligibility::SwaggerClient::Response]
# File lib/change_healthcare/eligibility/inspector.rb, line 10 def initialize(response) @response = response end
Public Instance Methods
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.
@param matcher [#===] matcher to match against, using `#===` @return [true,false]
# 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
Benefits Information for active coverage
@return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
# File lib/change_healthcare/eligibility/inspector.rb, line 63 def active_coverage_information benefits_information.select do |bv| bv.name == 'Active Coverage' end end
A list of all benefits information.
@return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
# File lib/change_healthcare/eligibility/inspector.rb, line 73 def benefits_information response.benefits_information || [] end
All BV records for co-insurance.
@return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
# File lib/change_healthcare/eligibility/inspector.rb, line 43 def coinsurance_records benefits_information.select do |bv| bv.name = 'Co-Insurance' end end
All BV records for co-payment.
@return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
# File lib/change_healthcare/eligibility/inspector.rb, line 53 def copayment_records benefits_information.select do |bv| bv.name = 'Co-Payment' end end
All benefits information records that describe a deductible.
@return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
# File lib/change_healthcare/eligibility/inspector.rb, line 33 def deductible_records benefits_information.select do |bv| bv.name == 'Deductible' end end