Class: ThePlaidApi::CreditBankIncomeTransaction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/credit_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(amount: SKIP, date: SKIP, name: SKIP, original_description: SKIP, pending: SKIP, transaction_id: SKIP, check_number: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, additional_properties: nil) ⇒ CreditBankIncomeTransaction

Returns a new instance of CreditBankIncomeTransaction.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 104

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

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

Instance Attribute Details

#amountFloat

The settled value of the transaction, denominated in the transactions’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)


19
20
21
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 19

def amount
  @amount
end

#check_numberString

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

Returns:

  • (String)


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

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)


25
26
27
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 25

def date
  @date
end

#iso_currency_codeString

The ISO 4217 currency code of the amount or balance.

Returns:

  • (String)


54
55
56
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 54

def iso_currency_code
  @iso_currency_code
end

#nameString

The merchant name or transaction description.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 29

def name
  @name
end

#original_descriptionString

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

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 34

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)


40
41
42
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 40

def pending
  @pending
end

#transaction_idString

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

Returns:

  • (String)


45
46
47
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 45

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)


62
63
64
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 62

def unofficial_currency_code
  @unofficial_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
154
155
156
157
158
159
160
161
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 125

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 65

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

.nullablesObject

An array for nullable fields



95
96
97
98
99
100
101
102
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 95

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

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 80

def self.optionals
  %w[
    amount
    date
    name
    original_description
    pending
    transaction_id
    check_number
    iso_currency_code
    unofficial_currency_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



174
175
176
177
178
179
180
181
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 174

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

#to_sObject

Provides a human-readable string representation of the object.



164
165
166
167
168
169
170
171
# File 'lib/the_plaid_api/models/credit_bank_income_transaction.rb', line 164

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