Class: ThePlaidApi::CraIncomeTransaction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::CraIncomeTransaction
- Defined in:
- lib/the_plaid_api/models/cra_income_transaction.rb
Overview
The transaction data for an income stream.
Instance Attribute Summary collapse
-
#account_id ⇒ String
Plaid’s unique identifier for the account.
-
#amount ⇒ Float
The settled value of the transaction, denominated in the transaction’s currency as stated in ‘iso_currency_code` or `unofficial_currency_code`.
-
#date ⇒ Date
For pending transactions, the date that the transaction occurred; for posted transactions, the date that the transaction posted.
-
#iso_currency_code ⇒ String
The ISO 4217 currency code of the amount or balance.
-
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error.
-
#original_description ⇒ String
The string returned by the financial institution to describe the transaction.
-
#outlier ⇒ CraIncomeTransactionOutlier
Metadata on whether this income transaction is an outlier.
-
#transaction_id ⇒ String
The unique ID of the transaction.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the amount or balance.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(transaction_id:, item_id:, account_id:, amount:, date:, original_description:, iso_currency_code:, unofficial_currency_code:, outlier:, additional_properties: nil) ⇒ CraIncomeTransaction
constructor
A new instance of CraIncomeTransaction.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(transaction_id:, item_id:, account_id:, amount:, date:, original_description:, iso_currency_code:, unofficial_currency_code:, outlier:, additional_properties: nil) ⇒ CraIncomeTransaction
Returns a new instance of CraIncomeTransaction.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 97 def initialize(transaction_id:, item_id:, account_id:, amount:, date:, original_description:, iso_currency_code:, unofficial_currency_code:, outlier:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @transaction_id = transaction_id @item_id = item_id @account_id = account_id @amount = amount @date = date @original_description = original_description @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @outlier = outlier @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
Plaid’s unique identifier for the account. This value will not change unless Plaid can’t reconcile the account with the data returned by the financial institution. This may occur, for example, when the name of the account changes. If this happens a new ‘account_id` will be assigned to the account. If an account with a specific `account_id` disappears instead of changing, the account is likely closed. Closed accounts are not returned by the Plaid API. Like all Plaid identifiers, the `account_id` is case sensitive.
31 32 33 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 31 def account_id @account_id end |
#amount ⇒ Float
The settled value of the transaction, denominated in the transaction’s currency as stated in ‘iso_currency_code` or `unofficial_currency_code`. Positive values when money moves out of the account; negative values when money moves in. For example, credit card purchases are positive; credit card payment, direct deposits, and refunds are negative.
40 41 42 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 40 def amount @amount end |
#date ⇒ Date
For pending transactions, the date that the transaction occurred; for posted transactions, the date that the transaction posted. Both dates are returned in an ISO 8601 format (YYYY-MM-DD).
46 47 48 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 46 def date @date end |
#iso_currency_code ⇒ String
The ISO 4217 currency code of the amount or balance.
55 56 57 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 55 def iso_currency_code @iso_currency_code end |
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error
19 20 21 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 19 def item_id @item_id end |
#original_description ⇒ String
The string returned by the financial institution to describe the transaction.
51 52 53 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 51 def original_description @original_description end |
#outlier ⇒ CraIncomeTransactionOutlier
Metadata on whether this income transaction is an outlier.
67 68 69 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 67 def outlier @outlier end |
#transaction_id ⇒ String
The unique ID of the transaction. Like all Plaid identifiers, the ‘transaction_id` is case sensitive.
15 16 17 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 15 def transaction_id @transaction_id end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the amount or balance. Always ‘null` if `iso_currency_code` is non-null. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries.
63 64 65 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 63 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 117 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : nil item_id = hash.key?('item_id') ? hash['item_id'] : nil account_id = hash.key?('account_id') ? hash['account_id'] : nil amount = hash.key?('amount') ? hash['amount'] : nil date = hash.key?('date') ? hash['date'] : nil original_description = hash.key?('original_description') ? hash['original_description'] : nil iso_currency_code = hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil unofficial_currency_code = hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : nil outlier = CraIncomeTransactionOutlier.from_hash(hash['outlier']) if hash['outlier'] # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. CraIncomeTransaction.new(transaction_id: transaction_id, item_id: item_id, account_id: account_id, amount: amount, date: date, original_description: original_description, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, outlier: outlier, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 70 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_id'] = 'transaction_id' @_hash['item_id'] = 'item_id' @_hash['account_id'] = 'account_id' @_hash['amount'] = 'amount' @_hash['date'] = 'date' @_hash['original_description'] = 'original_description' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash['outlier'] = 'outlier' @_hash end |
.nullables ⇒ Object
An array for nullable fields
90 91 92 93 94 95 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 90 def self.nullables %w[ iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 85 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
166 167 168 169 170 171 172 173 174 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 166 def inspect class_name = self.class.name.split('::').last "<#{class_name} transaction_id: #{@transaction_id.inspect}, item_id: #{@item_id.inspect},"\ " account_id: #{@account_id.inspect}, amount: #{@amount.inspect}, date: #{@date.inspect},"\ " original_description: #{@original_description.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, outlier: #{@outlier.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
156 157 158 159 160 161 162 163 |
# File 'lib/the_plaid_api/models/cra_income_transaction.rb', line 156 def to_s class_name = self.class.name.split('::').last "<#{class_name} transaction_id: #{@transaction_id}, item_id: #{@item_id}, account_id:"\ " #{@account_id}, amount: #{@amount}, date: #{@date}, original_description:"\ " #{@original_description}, iso_currency_code: #{@iso_currency_code},"\ " unofficial_currency_code: #{@unofficial_currency_code}, outlier: #{@outlier},"\ " additional_properties: #{@additional_properties}>" end |