Sha256: b7532ea00e45492ccad737863a7c426d9a15691c8b985bcdee54b8cda01bff8f
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require "money" module InvestecOpenApi::Models class Transaction < Base attr_reader :id, :account_id, :posted_order, :type, :transaction_type, :status, :card_number, :amount, :description, :running_balance, :date, :posting_date, :value_date, :action_date def initialize(params) super set_id end # 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. def set_id @id = [ amount.to_i, description, date.to_s ].map(&:to_s).join('-') end def self.from_api(params, currency = "ZAR") params["currency"] = currency should_make_amount_negative = params['type'] == 'DEBIT' convert_param_value_to_money(params, "amount", "currency", should_make_amount_negative) convert_param_value_to_money(params, "runningBalance") rewrite_param_key(params, "transactionDate", "date") convert_param_value_to_date(params, "date") convert_param_value_to_date(params, "postingDate") convert_param_value_to_date(params, "valueDate") convert_param_value_to_date(params, "actionDate") new params end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
investec_open_api-2.0.0 | lib/investec_open_api/models/transaction.rb |