Class: Yardi::Validator::EmptyResponse

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

Overview

Ensure that the response contains data. Sometimes Yardi will respond with just the outer shell of XML. For an example, @see empty_response.xml. We will also raise an error if Yardi returns a completely empty response.

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:) ⇒ EmptyResponse

Returns a new instance of EmptyResponse.

Parameters:

  • parsed_response (Hash<String, Object>)

    the XML response parsed into a Hash

  • action (String)

    The SOAP action this response is for. Yardi’s responses have nodes whose names include the SOAP action for the request that was made.



15
16
17
18
19
# File 'lib/yardi/validator/empty_response.rb', line 15

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

Instance Method Details

#validate!Object

Raises:



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/yardi/validator/empty_response.rb', line 23

def validate!
  return unless error?

  message = 'Yardi response contains no Result node.'

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