Class: RealPage::Validator::RequestErrors

Inherits:
Object
  • Object
show all
Defined in:
lib/real_page/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:

<s:Envelope>

<s:Body>
  <actionnameResponse>
    <actionnameResult>
      <actionnameresponse>
        <success>false</success>
        <errorcount>1</errorcount>
        <errors>
          <error>
            <severity>Critical</severity>
            <errornumber>1</errornumber>
            <errormessage>something went wrong</errormessage>
            <internalerrormessage/>
          </error>
        </errors>
      </actionnameresponse>
    </actionnameResult>
  </actionnameResponse>
</s:Body>

</s:Envelope>

Instance Method Summary collapse

Constructor Details

#initialize(response, request_params, request_name) ⇒ RequestErrors

Returns a new instance of RequestErrors.

Parameters:

  • response (Hash<String, Object>)

    the XML response parsed into a Hash



41
42
43
44
45
# File 'lib/real_page/validator/request_errors.rb', line 41

def initialize(response, request_params, request_name)
  @response = response
  @request_params = request_params
  @request_name = request_name
end

Instance Method Details

#validate!Object

Raises:



49
50
51
52
53
# File 'lib/real_page/validator/request_errors.rb', line 49

def validate!
  return unless error?
  send_request_error_to_snowflake
  raise RealPage::Error::BadRequest.new(errors)
end