Class: Yardi::Validator::FaultResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/yardi/validator/fault_response.rb

Overview

Ensure that the response has no Fault nodes

Instance Method Summary collapse

Methods inherited from Base

#import_resident_id, #parse_date, #pms_prospect_request_params, #pms_resident_request_params, #remote_id, #send_pms_prospect_event, #send_pms_resident_event

Constructor Details

#initialize(action:, parsed_response:, params:) ⇒ FaultResponse

Returns a new instance of FaultResponse.

Parameters:

  • parsed_response (Hash<String, Object>)

    XML response parsed into a Hash



10
11
12
13
14
# File 'lib/yardi/validator/fault_response.rb', line 10

def initialize(action:, parsed_response:, params:)
  @action = action
  @response = parsed_response
  @params = params
end

Instance Method Details

#validate!Object

Raises:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/yardi/validator/fault_response.rb', line 17

def validate!
  return unless error?

  case action
  when 'GetResidents'
    send_pms_resident_event(lease: nil, resident_type: 'PRIMARY', params: params, error_message: error_message)
  when 'GetYardiGuestActivity_Search'
    send_pms_prospect_event(params: params, error_message: error_message)
  end
  raise Error::FaultResponse, error_message
end