Class: InvestecOpenApi::Models::Transaction
- Defined in:
- lib/investec_open_api/models/transaction.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#id ⇒ Object
At this point, there is no unique identifier being returned from Investec’s API.
Class Method Details
.from_api(params) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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 |
Instance Method Details
#id ⇒ Object
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.
18 19 20 21 22 23 24 |
# File 'lib/investec_open_api/models/transaction.rb', line 18 def id [ amount.to_i, description, date.to_s ].map(&:to_s).join('-') end |