Class: Yardi::Validator::ErrorResponse
- Defined in:
- lib/yardi/validator/error_response.rb
Overview
Ensure that the response has no Messages with messageType=Error.
Instance Method Summary collapse
-
#initialize(action:, parsed_response:, params:) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #validate! ⇒ Object
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:) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
10 11 12 13 14 |
# File 'lib/yardi/validator/error_response.rb', line 10 def initialize(action:, parsed_response:, params:) @action = action @response = parsed_response @params = params end |
Instance Method Details
#validate! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yardi/validator/error_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: .join('. ')) when 'GetYardiGuestActivity_Search' if params[:send_prospect_events] != false send_pms_prospect_event(params: params, error_message: .join('. ')) end end canceled_guest_err_msg = "Status is 'Canceled Guest', Prospect must be reactivated (ReActivate event)" .each do || raise Error::CanceledGuest, .join('. ') if .include?(canceled_guest_err_msg) end guest_err_msg = 'Error: No guests exist with the given search criteria.' raise Error::GuestsNotFound, .join('. ') if .include?(guest_err_msg) raise Error::ErrorResponse, .join('. ') end |