Class: Trizetto::Api::Eligibility::WebService::DoInquiryResponse
- Inherits:
-
Object
- Object
- Trizetto::Api::Eligibility::WebService::DoInquiryResponse
- Defined in:
- lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb
Overview
The parsed response from an eligibility check
Instance Attribute Summary collapse
-
#dependent ⇒ Object
The Dependent in the eligibility XML.
-
#eligibility_response_as_hash ⇒ Object
The eligibility response xml parsed into a hash.
-
#extra_processing_info ⇒ Object
Any validation error or messages provided in the response.
-
#info_receiver ⇒ Object
The inforeceiver in the eligibilty XML.
-
#info_source ⇒ Object
The infosource in the eligibilty XML.
-
#payer_id ⇒ Object
For a successful request, the identifier of the payer (insurance company).
-
#payer_name ⇒ Object
For a successful request, the name of the payer (insurance company).
-
#subscriber ⇒ Object
The Subscriber in the eligibility XML.
-
#success_code ⇒ Object
The SuccessCode in the XML response from the eligibility request.
-
#transaction_id ⇒ Object
For a successful request that returned an eligibility response, the transaction identifier from Trizetto.
Instance Method Summary collapse
-
#active_coverage_for?(service_type_code) ⇒ Boolean
Does the patient we asked about have active insurance coverage for this service type code? Service type codes are strings and the most common is 30, general health benefits coverage.
-
#errors ⇒ Object
Validation errors handled at Trizetto’s level.
-
#initialize(response) ⇒ DoInquiryResponse
constructor
A new instance of DoInquiryResponse.
-
#patient ⇒ Object
The dependent or the subscriber - the best guess at who is the patient.
-
#rejected? ⇒ Boolean
Was the eligibility check rejected.
-
#rejections ⇒ Object
Rejections can appear in the subscriber, info source, info receiver, and possibly in the dependent.
-
#success? ⇒ Boolean
Did we successfully get back an eligibility response from the payer.
Constructor Details
#initialize(response) ⇒ DoInquiryResponse
Returns a new instance of DoInquiryResponse.
68 69 70 71 72 73 74 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 68 def initialize(response) response = response.to_hash.dig(:do_inquiry_response, :do_inquiry_result) || {} self.success_code = response[:success_code] self.response_as_xml = response[:response_as_xml] self.extra_processing_info = ExtraProcessingInfo.new(response[:extra_processing_info]) end |
Instance Attribute Details
#dependent ⇒ Object
The Dependent in the eligibility XML.
55 56 57 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 55 def dependent @dependent end |
#eligibility_response_as_hash ⇒ Object
The eligibility response xml parsed into a hash.
45 46 47 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 45 def eligibility_response_as_hash @eligibility_response_as_hash end |
#extra_processing_info ⇒ Object
Any validation error or messages provided in the response
Example
client.extra_processing_info. # => ["Invalid InsuredFirstName Length."]
client.extra_processing_info.validation_failures.first.affected_fields # => ["InsuredFirstName"]
client.extra_processing_info.validation_failures.first. # => "Invalid InsuredFirstName Length."
42 43 44 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 42 def extra_processing_info @extra_processing_info end |
#info_receiver ⇒ Object
The inforeceiver in the eligibilty XML
65 66 67 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 65 def info_receiver @info_receiver end |
#info_source ⇒ Object
The infosource in the eligibilty XML
60 61 62 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 60 def info_source @info_source end |
#payer_id ⇒ Object
For a successful request, the identifier of the payer (insurance company)
31 32 33 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 31 def payer_id @payer_id end |
#payer_name ⇒ Object
For a successful request, the name of the payer (insurance company)
28 29 30 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 28 def payer_name @payer_name end |
#subscriber ⇒ Object
The Subscriber in the eligibility XML.
50 51 52 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 50 def subscriber @subscriber end |
#success_code ⇒ Object
The SuccessCode in the XML response from the eligibility request.
Takes on one of these values
-
Success
- The request was well formed and not missing any fields -
ValidationFailure
- The request was not valid. Maybe a field was formatted incorrectly or omitted. -
PayerTimeout
- ? -
PayerNotSupported
- ? -
SystemError
- ? -
PayerEnrollmentRequired
- ? -
ProviderEnrollmentRequired
- ? -
ProductRequired
- ?
20 21 22 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 20 def success_code @success_code end |
#transaction_id ⇒ Object
For a successful request that returned an eligibility response, the transaction identifier from Trizetto. Seems to be 30 random alpha numeric characters
25 26 27 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 25 def transaction_id @transaction_id end |
Instance Method Details
#active_coverage_for?(service_type_code) ⇒ Boolean
Does the patient we asked about have active insurance coverage for this service type code? Service type codes are strings and the most common is 30, general health benefits coverage.
Example
response.active_coverage_for?("30") #=> true
References
159 160 161 162 163 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 159 def active_coverage_for?(service_type_code) !!(patient && patient.benefits.any? do |benefit| benefit.active_coverage? && benefit.service_type_codes.include?(service_type_code.to_s) end) end |
#errors ⇒ Object
Validation errors handled at Trizetto’s level
144 145 146 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 144 def errors self.extra_processing_info end |
#patient ⇒ Object
The dependent or the subscriber - the best guess at who is the patient
119 120 121 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 119 def patient dependent || subscriber end |
#rejected? ⇒ Boolean
Was the eligibility check rejected. Eligibility checks may be rejected because they have expired, they don’t exist, the payer service is unable to response, or there were errors with the request handled at the payer level instead of through Trizetto. There can be multiple rejections on a single request
130 131 132 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 130 def rejected? !rejections.empty? end |
#rejections ⇒ Object
Rejections can appear in the subscriber, info source, info receiver, and possibly in the dependent. Additionaly, there can be multiple rejections in any one of those. This collects them all
137 138 139 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 137 def rejections [subscriber, dependent, info_receiver, info_source].compact.map(&:rejections).flatten.compact end |
#success? ⇒ Boolean
Did we successfully get back an eligibility response from the payer.
This does not mean the patient has active coverage.
114 115 116 |
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 114 def success? success_code == 'Success' && [transaction_id, payer_name, payer_id].none?(&:blank?) end |