Class: InvestecOpenApi::Models::Transaction
- Defined in:
- lib/investec_open_api/models/transaction.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#action_date ⇒ Object
readonly
Returns the value of attribute action_date.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#card_number ⇒ Object
readonly
Returns the value of attribute card_number.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#posted_order ⇒ Object
readonly
Returns the value of attribute posted_order.
-
#posting_date ⇒ Object
readonly
Returns the value of attribute posting_date.
-
#running_balance ⇒ Object
readonly
Returns the value of attribute running_balance.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#transaction_type ⇒ Object
readonly
Returns the value of attribute transaction_type.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uuid ⇒ Object
readonly
Unique identifier Composite key generated by Investec using the following formula: account_id.slice(0, 5) + posting_date.gsub(/-/, “”) + posted_order.to_s.rjust(7, “0”) This will only be populated for posted transaction on Private Bank Accounts.
-
#value_date ⇒ Object
readonly
Returns the value of attribute value_date.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Transaction
constructor
A new instance of Transaction.
-
#set_id ⇒ Object
Investec exposes a uuid for uniqueness so this is no longer needed (non-pending transactions).
Methods inherited from Base
convert_param_value_to_date, convert_param_value_to_money, rewrite_param_key
Constructor Details
#initialize(params) ⇒ Transaction
Returns a new instance of Transaction.
27 28 29 30 |
# File 'lib/investec_open_api/models/transaction.rb', line 27 def initialize(params) super set_id end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def account_id @account_id end |
#action_date ⇒ Object (readonly)
Returns the value of attribute action_date.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def action_date @action_date end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def amount @amount end |
#card_number ⇒ Object (readonly)
Returns the value of attribute card_number.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def card_number @card_number end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def id @id end |
#posted_order ⇒ Object (readonly)
Returns the value of attribute posted_order.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def posted_order @posted_order end |
#posting_date ⇒ Object (readonly)
Returns the value of attribute posting_date.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def posting_date @posting_date end |
#running_balance ⇒ Object (readonly)
Returns the value of attribute running_balance.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def running_balance @running_balance end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def status @status end |
#transaction_type ⇒ Object (readonly)
Returns the value of attribute transaction_type.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def transaction_type @transaction_type end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def type @type end |
#uuid ⇒ Object (readonly)
Unique identifier Composite key generated by Investec using the following formula: account_id.slice(0, 5) + posting_date.gsub(/-/, “”) + posted_order.to_s.rjust(7, “0”) This will only be populated for posted transaction on Private Bank Accounts. This is not a backend banking generated ID and will change if any of the properties making it up changes.
25 26 27 |
# File 'lib/investec_open_api/models/transaction.rb', line 25 def uuid @uuid end |
#value_date ⇒ Object (readonly)
Returns the value of attribute value_date.
5 6 7 |
# File 'lib/investec_open_api/models/transaction.rb', line 5 def value_date @value_date end |
Class Method Details
.from_api(params, currency = "ZAR") ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/investec_open_api/models/transaction.rb', line 42 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 |
Instance Method Details
#set_id ⇒ Object
Investec exposes a uuid for uniqueness so this is no longer needed (non-pending transactions). It is kept here for legacy purposes. It is also useful for pending transactions.
34 35 36 37 38 39 40 |
# File 'lib/investec_open_api/models/transaction.rb', line 34 def set_id @id = [ amount.to_i, description, date.to_s ].map(&:to_s).join('-') end |