Class: VAProfile::ContactInformation::AddressTransactionResponse

Inherits:
TransactionResponse show all
Defined in:
lib/va_profile/contact_information/transaction_response.rb

Constant Summary

Constants inherited from TransactionResponse

TransactionResponse::ERROR_STATUS

Constants included from Common::Client::Concerns::ServiceStatus

Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS

Instance Attribute Summary

Attributes inherited from TransactionResponse

#response_body

Attributes inherited from Common::Base

#errors_hash, #metadata

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TransactionResponse

error?

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods inherited from Response

#cache?, #initialize, #metadata, #ok?, #response_status

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, #initialize, max_per_page, per_page, sortable_attributes

Constructor Details

This class inherits a constructor from VAProfile::Response

Class Method Details

.from(*args) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/va_profile/contact_information/transaction_response.rb', line 42

def self.from(*args)
  return_val = super

  log_error

  return_val.response_body = @response_body
  return_val
end

.log_errorObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/va_profile/contact_information/transaction_response.rb', line 66

def self.log_error
  if error?
    PersonalInformationLog.create(
      error_class: 'VAProfile::ContactInformation::AddressTransactionResponseError',
      data:
        {
          address: @response_body['tx_push_input'].except(
            'address_id',
            'originating_source_system',
            'source_system_user',
            'effective_start_date',
            'vet360_id'
          ),
          errors: @response_body['tx_messages']
        }
    )
  end
rescue => e
  log_exception_to_sentry(e)
end

Instance Method Details

#changed_fieldObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/va_profile/contact_information/transaction_response.rb', line 51

def changed_field
  return :address unless response_body['tx_output']

  address_pou = response_body['tx_output'][0]['address_pou']

  case address_pou
  when VAProfile::Models::BaseAddress::RESIDENCE
    :residence_address
  when VAProfile::Models::BaseAddress::CORRESPONDENCE
    :correspondence_address
  else
    :address
  end
end