Class: Amsi::Validator::RequestErrors
- Inherits:
-
Object
- Object
- Amsi::Validator::RequestErrors
- Defined in:
- lib/amsi/validator/request_errors.rb
Overview
Ensure there are no errors in the wrapped contents of the body.
This validator works on responses that have the following format:
<?xml version=“1.0” encoding=“utf-8”?> <soap:Envelope xmlns:soap=“schemas.xmlsoap.org/soap/envelope/” xmlns:xsi=“www.w3.org/2001/XMLSchema-instance” xmlns:xsd=“www.w3.org/2001/XMLSchema”>
<soap:Body>
<GetPropertyResidentsResponse xmlns="http://tempuri.org/">
<GetPropertyResidentsResult><InternetTrafficResponse><webservice>Leasing</webservice><webmethod>GetPropertyResidents</webmethod><Error><ErrorCode>1</ErrorCode><ErrorDescription>Validation of user credentials failed.</ErrorDescription></Error></InternetTrafficResponse></GetPropertyResidentsResult>
</GetPropertyResidentsResponse>
</soap:Body>
</soap:Envelope>
Instance Method Summary collapse
-
#initialize(response) ⇒ RequestErrors
constructor
A new instance of RequestErrors.
- #validate! ⇒ Object
Constructor Details
#initialize(response) ⇒ RequestErrors
Returns a new instance of RequestErrors.
21 22 23 |
# File 'lib/amsi/validator/request_errors.rb', line 21 def initialize(response) @response = response end |
Instance Method Details
#validate! ⇒ Object
27 28 29 30 31 |
# File 'lib/amsi/validator/request_errors.rb', line 27 def validate! return unless error? raise Amsi::Error::BadRequest, [error] end |