Class: VAProfile::Models::Transaction
- Defined in:
- lib/va_profile/models/transaction.rb
Constant Summary collapse
- STATUSES =
%w[ REJECTED RECEIVED RECEIVED_ERROR_QUEUE RECEIVED_DEAD_LETTER_QUEUE COMPLETED_SUCCESS COMPLETED_NO_CHANGES_DETECTED COMPLETED_FAILURE ].freeze
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::Transaction
Converts a decoded JSON response from VAProfile to an instance of the Transaction model.
Instance Method Summary collapse
Class Method Details
.build_from(body) ⇒ VAProfile::Models::Transaction
Converts a decoded JSON response from VAProfile to an instance of the Transaction model
34 35 36 37 38 39 40 41 |
# File 'lib/va_profile/models/transaction.rb', line 34 def self.build_from(body) = body['tx_messages']&.map { |m| VAProfile::Models::Message.build_from(m) } VAProfile::Models::Transaction.new( messages: || [], id: body['tx_audit_id'], status: body['tx_status'] || body['status'] ) end |
Instance Method Details
#completed_success? ⇒ Boolean
27 28 29 |
# File 'lib/va_profile/models/transaction.rb', line 27 def completed_success? status == 'COMPLETED_SUCCESS' end |
#received? ⇒ Boolean
23 24 25 |
# File 'lib/va_profile/models/transaction.rb', line 23 def received? status == 'RECEIVED' end |