class InvestecOpenApi::Models::Transaction
Public Class Methods
from_api(params)
click to toggle source
Calls superclass method
InvestecOpenApi::Models::Base::from_api
# File lib/investec_open_api/models/transaction.rb, line 26 def self.from_api(params) if params['amount'].present? adjusted_amount = params['amount'] * 100 adjusted_amount = -adjusted_amount if params['type'] == 'DEBIT' params['amount'] = Money.new(adjusted_amount, "ZAR") end if params['transactionDate'] params['date'] = params['transactionDate'] end super end
Public Instance Methods
id()
click to toggle source
At this point, there is no unique identifier being returned from Investec's API. This method serves to create a stable unique identifier based on the transaction details.
# File lib/investec_open_api/models/transaction.rb, line 18 def id [ amount.to_i, description, date.to_s ].map(&:to_s).join('-') end