Class: Trizetto::Api::Eligibility::WebService::ValidationFailure
- Inherits:
-
Object
- Object
- Trizetto::Api::Eligibility::WebService::ValidationFailure
- Defined in:
- lib/trizetto/api/eligibility/web_service/validation_failure.rb
Overview
Wraps a validation error returned in the SOAP response body
Example
failure = ValidationFailure.new({affected_fields: {string: "InsuranceNum"}, message: "Please enter InsuranceNum."}`)
failure.affected_fields # =>["InsuranceNum"]
failure.message # => "Please enter InsuranceNum."
Instance Attribute Summary collapse
-
#affected_fields ⇒ Object
An array of strings indicating which fields had a validation failure.
-
#message ⇒ Object
The validation error associated with the affected fields.
Instance Method Summary collapse
-
#initialize(validation_failure_hash) ⇒ ValidationFailure
constructor
Initialize the Validation failure from a parsed DoInquiry response hash.
- #to_h ⇒ Object
Constructor Details
#initialize(validation_failure_hash) ⇒ ValidationFailure
Initialize the Validation failure from a parsed DoInquiry response hash
35 36 37 38 |
# File 'lib/trizetto/api/eligibility/web_service/validation_failure.rb', line 35 def initialize(validation_failure_hash) self.affected_fields = Array((validation_failure_hash.dig(:affected_fields) || {})[:string]) self. = validation_failure_hash[:message] end |
Instance Attribute Details
#affected_fields ⇒ Object
An array of strings indicating which fields had a validation failure.
While the WSDL has this as an array, in practice, there is one field in that array
WSDL Reference
<s:element minOccurs="0" maxOccurs="1" name="AffectedFields" type="tns:ArrayOfString" />
23 24 25 |
# File 'lib/trizetto/api/eligibility/web_service/validation_failure.rb', line 23 def affected_fields @affected_fields end |
#message ⇒ Object
The validation error associated with the affected fields
WSDL Reference
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
31 32 33 |
# File 'lib/trizetto/api/eligibility/web_service/validation_failure.rb', line 31 def @message end |
Instance Method Details
#to_h ⇒ Object
40 41 42 |
# File 'lib/trizetto/api/eligibility/web_service/validation_failure.rb', line 40 def to_h {affected_fields: affected_fields, message: } end |