Class: ThePlaidApi::CraBankIncomeTransaction

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

Overview

The transactions data for the end user’s income source(s).

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(transaction_id:, amount:, date:, original_description:, pending:, iso_currency_code:, unofficial_currency_code:, name: SKIP, check_number: SKIP, bonus_type: SKIP, additional_properties: nil) ⇒ CraBankIncomeTransaction

Returns a new instance of CraBankIncomeTransaction.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 109

def initialize(transaction_id:, amount:, date:, original_description:,
               pending:, iso_currency_code:, unofficial_currency_code:,
               name: SKIP, check_number: SKIP, bonus_type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transaction_id = transaction_id
  @amount = amount
  @date = date
  @name = name unless name == SKIP
  @original_description = original_description
  @pending = pending
  @check_number = check_number unless check_number == SKIP
  @iso_currency_code = iso_currency_code
  @unofficial_currency_code = unofficial_currency_code
  @bonus_type = bonus_type unless bonus_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

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

Returns:

  • (Float)


24
25
26
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 24

def amount
  @amount
end

#bonus_typeCraBankIncomeBonusType

The type of bonus that this transaction represents, if it is a bonus. ‘BONUS_INCLUDED`: Bonus is included in this transaction along with the normal pay `BONUS_ONLY`: This transaction is a standalone bonus



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

def bonus_type
  @bonus_type
end

#check_numberString

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

Returns:

  • (String)


52
53
54
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 52

def check_number
  @check_number
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 format (YYYY-MM-DD).

Returns:

  • (Date)


30
31
32
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 30

def date
  @date
end

#iso_currency_codeString

The ISO 4217 currency code of the amount or balance.

Returns:

  • (String)


56
57
58
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 56

def iso_currency_code
  @iso_currency_code
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.

Returns:

  • (String)


36
37
38
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 36

def name
  @name
end

#original_descriptionString

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

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 41

def original_description
  @original_description
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)


47
48
49
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 47

def pending
  @pending
end

#transaction_idString

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

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 15

def transaction_id
  @transaction_id
end

#unofficial_currency_codeString

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.

Returns:

  • (String)


64
65
66
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 64

def unofficial_currency_code
  @unofficial_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 130

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_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
  pending = hash.key?('pending') ? hash['pending'] : 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
  name = hash.key?('name') ? hash['name'] : SKIP
  check_number = hash.key?('check_number') ? hash['check_number'] : SKIP
  bonus_type = hash.key?('bonus_type') ? hash['bonus_type'] : 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.
  CraBankIncomeTransaction.new(transaction_id: transaction_id,
                               amount: amount,
                               date: date,
                               original_description: original_description,
                               pending: pending,
                               iso_currency_code: iso_currency_code,
                               unofficial_currency_code: unofficial_currency_code,
                               name: name,
                               check_number: check_number,
                               bonus_type: bonus_type,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 74

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['amount'] = 'amount'
  @_hash['date'] = 'date'
  @_hash['name'] = 'name'
  @_hash['original_description'] = 'original_description'
  @_hash['pending'] = 'pending'
  @_hash['check_number'] = 'check_number'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['unofficial_currency_code'] = 'unofficial_currency_code'
  @_hash['bonus_type'] = 'bonus_type'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
102
103
104
105
106
107
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 99

def self.nullables
  %w[
    original_description
    check_number
    iso_currency_code
    unofficial_currency_code
    bonus_type
  ]
end

.optionalsObject

An array for optional fields



90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 90

def self.optionals
  %w[
    name
    check_number
    bonus_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



181
182
183
184
185
186
187
188
189
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 181

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id.inspect}, amount: #{@amount.inspect},"\
  " date: #{@date.inspect}, name: #{@name.inspect}, original_description:"\
  " #{@original_description.inspect}, pending: #{@pending.inspect}, check_number:"\
  " #{@check_number.inspect}, iso_currency_code: #{@iso_currency_code.inspect},"\
  " unofficial_currency_code: #{@unofficial_currency_code.inspect}, bonus_type:"\
  " #{@bonus_type.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



171
172
173
174
175
176
177
178
# File 'lib/the_plaid_api/models/cra_bank_income_transaction.rb', line 171

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id}, amount: #{@amount}, date: #{@date},"\
  " name: #{@name}, original_description: #{@original_description}, pending: #{@pending},"\
  " check_number: #{@check_number}, iso_currency_code: #{@iso_currency_code},"\
  " unofficial_currency_code: #{@unofficial_currency_code}, bonus_type: #{@bonus_type},"\
  " additional_properties: #{@additional_properties}>"
end