Class: ThePlaidApi::AssetReportTransaction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/asset_report_transaction.rb

Overview

A transaction on the asset report

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(account_id:, amount:, iso_currency_code:, unofficial_currency_code:, original_description:, date:, pending:, transaction_id:, category: SKIP, category_id: SKIP, credit_category: SKIP, check_number: SKIP, date_transacted: SKIP, location: SKIP, name: SKIP, merchant_name: SKIP, payment_meta: SKIP, pending_transaction_id: SKIP, account_owner: SKIP, transaction_type: SKIP, income_source_id: SKIP, additional_properties: nil) ⇒ AssetReportTransaction

Returns a new instance of AssetReportTransaction.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 213

def initialize(account_id:, amount:, iso_currency_code:,
               unofficial_currency_code:, original_description:, date:,
               pending:, transaction_id:, category: SKIP, category_id: SKIP,
               credit_category: SKIP, check_number: SKIP,
               date_transacted: SKIP, location: SKIP, name: SKIP,
               merchant_name: SKIP, payment_meta: SKIP,
               pending_transaction_id: SKIP, account_owner: SKIP,
               transaction_type: SKIP, income_source_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @amount = amount
  @iso_currency_code = iso_currency_code
  @unofficial_currency_code = unofficial_currency_code
  @original_description = original_description
  @category = category unless category == SKIP
  @category_id = category_id unless category_id == SKIP
  @credit_category = credit_category unless credit_category == SKIP
  @check_number = check_number unless check_number == SKIP
  @date = date
  @date_transacted = date_transacted unless date_transacted == SKIP
  @location = location unless location == SKIP
  @name = name unless name == SKIP
  @merchant_name = merchant_name unless merchant_name == SKIP
  @payment_meta = payment_meta unless payment_meta == SKIP
  @pending = pending
  @pending_transaction_id = pending_transaction_id unless pending_transaction_id == SKIP
  @account_owner =  unless  == SKIP
  @transaction_id = transaction_id
  @transaction_type = transaction_type unless transaction_type == SKIP
  @income_source_id = income_source_id unless income_source_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The ID of the account in which this transaction occurred.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 14

def 
  @account_id
end

#account_ownerString

The name of the account owner. This field is not typically populated and only relevant when dealing with sub-accounts.

Returns:

  • (String)


132
133
134
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 132

def 
  @account_owner
end

#amountFloat

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, debit card purchases are positive; credit card payments, direct deposits, and refunds are negative.

Returns:

  • (Float)


22
23
24
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 22

def amount
  @amount
end

#categoryArray[String]

A hierarchical array of the categories to which this transaction belongs. For a full list of categories, see [‘/categories/get`](plaid.com/docs/api/products/transactions/#cate goriesget). This field will only appear in an Asset Report with Insights.

Returns:

  • (Array[String])


50
51
52
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 50

def category
  @category
end

#category_idString

The ID of the category to which this transaction belongs. For a full list of categories, see [‘/categories/get`](plaid.com/docs/api/products/transactions/#cate goriesget). This field will only appear in an Asset Report with Insights.

Returns:

  • (String)


58
59
60
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 58

def category_id
  @category_id
end

#check_numberString

The check number of the transaction. This field is only populated for check transactions.

Returns:

  • (String)


71
72
73
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 71

def check_number
  @check_number
end

#credit_categoryCreditCategory

Information describing the intent of the transaction. Most relevant for credit use cases, but not limited to such use cases. See the [‘taxonomy csv file`](plaid.com/documents/credit-category-taxonomy.csv) for a full list of credit categories.

Returns:



66
67
68
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 66

def credit_category
  @credit_category
end

#dateDate

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](wikipedia.org/wiki/ISO_8601) format ( ‘YYYY-MM-DD` ).

Returns:

  • (Date)


78
79
80
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 78

def date
  @date
end

#date_transactedString

The date on which the transaction took place, in IS0 8601 format.

Returns:

  • (String)


82
83
84
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 82

def date_transacted
  @date_transacted
end

#income_source_idString

A unique identifier for an income source.

Returns:

  • (String)


148
149
150
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 148

def income_source_id
  @income_source_id
end

#iso_currency_codeString

The ISO-4217 currency code of the transaction. Always ‘null` if `unofficial_currency_code` is non-null.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 27

def iso_currency_code
  @iso_currency_code
end

#locationTransactionLocation

A representation of where a transaction took place. Location data is provided only for transactions at physical locations, not for online transactions. Location data availability depends primarily on the merchant and is most likely to be populated for transactions at large retail chains; small, local businesses are less likely to have location data available.

Returns:



91
92
93
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 91

def location
  @location
end

#merchant_nameString

The merchant name, as enriched by Plaid. This is typically a more human-readable version of the merchant counterparty in the transaction. For some bank transactions (such as checks or account transfers) where there is no meaningful merchant name, this value will be ‘null`.

Returns:

  • (String)


105
106
107
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 105

def merchant_name
  @merchant_name
end

#nameString

The merchant name or transaction description. This is a legacy field that is no longer maintained. For merchant name, use the ‘merchant_name` field. For description, use the `original_description` field. This field will only appear in an Asset Report with Insights.

Returns:

  • (String)


98
99
100
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 98

def name
  @name
end

#original_descriptionString

The string returned by the financial institution to describe the transaction.

Returns:

  • (String)


42
43
44
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 42

def original_description
  @original_description
end

#payment_metaPaymentMeta

Transaction information specific to inter-bank transfers. If the transaction was not an inter-bank transfer, all fields will be ‘null`. If the `transactions` object was returned by a Transactions endpoint such as `/transactions/sync` or `/transactions/get`, the `payment_meta` key will always appear, but no data elements are guaranteed. If the `transactions` object was returned by an Assets endpoint such as `/asset_report/get/` or `/asset_report/pdf/get`, this field will only appear in an Asset Report with Insights.

Returns:



116
117
118
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 116

def payment_meta
  @payment_meta
end

#pendingTrueClass | FalseClass

When ‘true`, identifies the transaction as pending or unsettled. Pending transaction details (name, type, amount, category ID) may change before they are settled.

Returns:

  • (TrueClass | FalseClass)


122
123
124
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 122

def pending
  @pending
end

#pending_transaction_idString

The ID of a posted transaction’s associated pending transaction, where applicable.

Returns:

  • (String)


127
128
129
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 127

def pending_transaction_id
  @pending_transaction_id
end

#transaction_idString

The unique ID of the transaction. Like all Plaid identifiers, the ‘transaction_id` is case sensitive.

Returns:

  • (String)


137
138
139
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 137

def transaction_id
  @transaction_id
end

#transaction_typeAssetReportTransactionType

‘digital:` transactions that took place online. `place:` transactions that were made at a physical location. `special:` transactions that relate to banks, e.g. fees or deposits. `unresolved:` transactions that do not fit into the other three types.



144
145
146
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 144

def transaction_type
  @transaction_type
end

#unofficial_currency_codeString

The unofficial currency code associated with the transaction. 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. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `unofficial_currency_code`s.

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 37

def unofficial_currency_code
  @unofficial_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 250

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
  amount = hash.key?('amount') ? hash['amount'] : 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
  original_description =
    hash.key?('original_description') ? hash['original_description'] : nil
  date = hash.key?('date') ? hash['date'] : nil
  pending = hash.key?('pending') ? hash['pending'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  category = hash.key?('category') ? hash['category'] : SKIP
  category_id = hash.key?('category_id') ? hash['category_id'] : SKIP
  credit_category = CreditCategory.from_hash(hash['credit_category']) if
    hash['credit_category']
  check_number = hash.key?('check_number') ? hash['check_number'] : SKIP
  date_transacted =
    hash.key?('date_transacted') ? hash['date_transacted'] : SKIP
  location = TransactionLocation.from_hash(hash['location']) if hash['location']
  name = hash.key?('name') ? hash['name'] : SKIP
  merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP
  payment_meta = PaymentMeta.from_hash(hash['payment_meta']) if hash['payment_meta']
  pending_transaction_id =
    hash.key?('pending_transaction_id') ? hash['pending_transaction_id'] : SKIP
   = hash.key?('account_owner') ? hash['account_owner'] : SKIP
  transaction_type =
    hash.key?('transaction_type') ? hash['transaction_type'] : SKIP
  income_source_id =
    hash.key?('income_source_id') ? hash['income_source_id'] : SKIP

  # 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.
  AssetReportTransaction.new(account_id: ,
                             amount: amount,
                             iso_currency_code: iso_currency_code,
                             unofficial_currency_code: unofficial_currency_code,
                             original_description: original_description,
                             date: date,
                             pending: pending,
                             transaction_id: transaction_id,
                             category: category,
                             category_id: category_id,
                             credit_category: credit_category,
                             check_number: check_number,
                             date_transacted: date_transacted,
                             location: location,
                             name: name,
                             merchant_name: merchant_name,
                             payment_meta: payment_meta,
                             pending_transaction_id: pending_transaction_id,
                             account_owner: ,
                             transaction_type: transaction_type,
                             income_source_id: income_source_id,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 151

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['amount'] = 'amount'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['unofficial_currency_code'] = 'unofficial_currency_code'
  @_hash['original_description'] = 'original_description'
  @_hash['category'] = 'category'
  @_hash['category_id'] = 'category_id'
  @_hash['credit_category'] = 'credit_category'
  @_hash['check_number'] = 'check_number'
  @_hash['date'] = 'date'
  @_hash['date_transacted'] = 'date_transacted'
  @_hash['location'] = 'location'
  @_hash['name'] = 'name'
  @_hash['merchant_name'] = 'merchant_name'
  @_hash['payment_meta'] = 'payment_meta'
  @_hash['pending'] = 'pending'
  @_hash['pending_transaction_id'] = 'pending_transaction_id'
  @_hash['account_owner'] = 'account_owner'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['transaction_type'] = 'transaction_type'
  @_hash['income_source_id'] = 'income_source_id'
  @_hash
end

.nullablesObject

An array for nullable fields



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 197

def self.nullables
  %w[
    iso_currency_code
    unofficial_currency_code
    original_description
    category
    category_id
    credit_category
    check_number
    date_transacted
    merchant_name
    pending_transaction_id
    account_owner
  ]
end

.optionalsObject

An array for optional fields



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 178

def self.optionals
  %w[
    category
    category_id
    credit_category
    check_number
    date_transacted
    location
    name
    merchant_name
    payment_meta
    pending_transaction_id
    account_owner
    transaction_type
    income_source_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 333

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, amount: #{@amount.inspect},"\
  " iso_currency_code: #{@iso_currency_code.inspect}, unofficial_currency_code:"\
  " #{@unofficial_currency_code.inspect}, original_description:"\
  " #{@original_description.inspect}, category: #{@category.inspect}, category_id:"\
  " #{@category_id.inspect}, credit_category: #{@credit_category.inspect}, check_number:"\
  " #{@check_number.inspect}, date: #{@date.inspect}, date_transacted:"\
  " #{@date_transacted.inspect}, location: #{@location.inspect}, name: #{@name.inspect},"\
  " merchant_name: #{@merchant_name.inspect}, payment_meta: #{@payment_meta.inspect}, pending:"\
  " #{@pending.inspect}, pending_transaction_id: #{@pending_transaction_id.inspect},"\
  " account_owner: #{@account_owner.inspect}, transaction_id: #{@transaction_id.inspect},"\
  " transaction_type: #{@transaction_type.inspect}, income_source_id:"\
  " #{@income_source_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/the_plaid_api/models/asset_report_transaction.rb', line 318

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, amount: #{@amount}, iso_currency_code:"\
  " #{@iso_currency_code}, unofficial_currency_code: #{@unofficial_currency_code},"\
  " original_description: #{@original_description}, category: #{@category}, category_id:"\
  " #{@category_id}, credit_category: #{@credit_category}, check_number: #{@check_number},"\
  " date: #{@date}, date_transacted: #{@date_transacted}, location: #{@location}, name:"\
  " #{@name}, merchant_name: #{@merchant_name}, payment_meta: #{@payment_meta}, pending:"\
  " #{@pending}, pending_transaction_id: #{@pending_transaction_id}, account_owner:"\
  " #{@account_owner}, transaction_id: #{@transaction_id}, transaction_type:"\
  " #{@transaction_type}, income_source_id: #{@income_source_id}, additional_properties:"\
  " #{@additional_properties}>"
end