Class: ThePlaidApi::CreditBankIncomeSource

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

Overview

Detailed information for the income source.

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(income_source_id: SKIP, income_description: SKIP, income_category: SKIP, account_id: SKIP, start_date: SKIP, end_date: SKIP, pay_frequency: SKIP, total_amount: SKIP, transaction_count: SKIP, historical_summary: SKIP, additional_properties: nil) ⇒ CreditBankIncomeSource

Returns a new instance of CreditBankIncomeSource.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 128

def initialize(income_source_id: SKIP, income_description: SKIP,
               income_category: SKIP, account_id: SKIP, start_date: SKIP,
               end_date: SKIP, pay_frequency: SKIP, total_amount: SKIP,
               transaction_count: SKIP, historical_summary: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @income_source_id = income_source_id unless income_source_id == SKIP
  @income_description = income_description unless income_description == SKIP
  @income_category = income_category unless income_category == SKIP
  @account_id =  unless  == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @pay_frequency = pay_frequency unless pay_frequency == SKIP
  @total_amount = total_amount unless total_amount == SKIP
  @transaction_count = transaction_count unless transaction_count == SKIP
  @historical_summary = historical_summary unless historical_summary == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Plaid’s unique identifier for the account.

Returns:

  • (String)


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

def 
  @account_id
end

#end_dateDate

Maximum of all dates within the specific income sources in the user’s bank account for days requested by the client. The date will be returned in an ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


70
71
72
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 70

def end_date
  @end_date
end

#historical_summaryArray[CreditBankIncomeHistoricalSummary]

Number of transactions for the income source within the start and end date.



89
90
91
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 89

def historical_summary
  @historical_summary
end

#income_categoryCreditBankIncomeCategory

The income category. ‘BANK_INTEREST`: Interest earned from a bank account. `BENEFIT_OTHER`: Government benefits other than retirement, unemployment, child support, or disability. Currently used only in the UK, to represent benefits such as Cost of Living Payments. `CASH`: Deprecated and used only for existing legacy implementations. Has been replaced by `CASH_DEPOSIT` and `TRANSFER_FROM_APPLICATION`. `CASH_DEPOSIT`: A cash or check deposit. `CHILD_SUPPORT`: Child support payments received. `GIG_ECONOMY`: Income earned as a gig economy worker, e.g. driving for Uber, Lyft, Postmates, DoorDash, etc. `LONG_TERM_DISABILITY`: Disability payments, including Social Security disability benefits. `OTHER`: Income that could not be categorized as any other income category. `MILITARY`: Veterans benefits. Income earned as salary for serving in the military (e.g. through DFAS) will be classified as `SALARY` rather than `MILITARY`. `RENTAL`: Income earned from a rental property. Income may be identified as rental when the payment is received through a rental platform, e.g. Airbnb; rent paid directly by the tenant to the property owner (e.g. via cash, check, or ACH) will typically not be classified as rental income. `RETIREMENT`: Payments from private retirement systems, pensions, and government retirement programs, including Social Security retirement benefits. `SALARY`: Payment from an employer to an earner or other form of permanent employment. `TAX_REFUND`: A tax refund. `TRANSFER_FROM_APPLICATION`: Deposits from a money transfer app, such as Venmo, Cash App, or Zelle. `UNEMPLOYMENT`: Unemployment benefits. In the UK, includes certain low-income benefits such as the Universal Credit.



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

def income_category
  @income_category
end

#income_descriptionString

The most common name or original description for the underlying income transactions.

Returns:

  • (String)


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

def income_description
  @income_description
end

#income_source_idString

A unique identifier for an income source.

Returns:

  • (String)


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

def income_source_id
  @income_source_id
end

#pay_frequencyCreditBankIncomePayFrequency

The income pay frequency.



74
75
76
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 74

def pay_frequency
  @pay_frequency
end

#start_dateDate

Minimum of all dates within the specific income sources in the user’s bank account for days requested by the client. The date will be returned in an ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


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

def start_date
  @start_date
end

#total_amountFloat

Total amount of earnings in the user’s bank account for the specific income source for days requested by the client.

Returns:

  • (Float)


79
80
81
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 79

def total_amount
  @total_amount
end

#transaction_countInteger

Number of transactions for the income source within the start and end date.

Returns:

  • (Integer)


84
85
86
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 84

def transaction_count
  @transaction_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



150
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 150

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  income_source_id =
    hash.key?('income_source_id') ? hash['income_source_id'] : SKIP
  income_description =
    hash.key?('income_description') ? hash['income_description'] : SKIP
  income_category =
    hash.key?('income_category') ? hash['income_category'] : SKIP
   = hash.key?('account_id') ? hash['account_id'] : SKIP
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  pay_frequency = hash.key?('pay_frequency') ? hash['pay_frequency'] : SKIP
  total_amount = hash.key?('total_amount') ? hash['total_amount'] : SKIP
  transaction_count =
    hash.key?('transaction_count') ? hash['transaction_count'] : SKIP
  # Parameter is an array, so we need to iterate through it
  historical_summary = nil
  unless hash['historical_summary'].nil?
    historical_summary = []
    hash['historical_summary'].each do |structure|
      historical_summary << (CreditBankIncomeHistoricalSummary.from_hash(structure) if structure)
    end
  end

  historical_summary = SKIP unless hash.key?('historical_summary')

  # 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.
  CreditBankIncomeSource.new(income_source_id: income_source_id,
                             income_description: income_description,
                             income_category: income_category,
                             account_id: ,
                             start_date: start_date,
                             end_date: end_date,
                             pay_frequency: pay_frequency,
                             total_amount: total_amount,
                             transaction_count: transaction_count,
                             historical_summary: historical_summary,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 92

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['income_source_id'] = 'income_source_id'
  @_hash['income_description'] = 'income_description'
  @_hash['income_category'] = 'income_category'
  @_hash['account_id'] = 'account_id'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash['total_amount'] = 'total_amount'
  @_hash['transaction_count'] = 'transaction_count'
  @_hash['historical_summary'] = 'historical_summary'
  @_hash
end

.nullablesObject

An array for nullable fields



124
125
126
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 124

def self.nullables
  []
end

.optionalsObject

An array for optional fields



108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 108

def self.optionals
  %w[
    income_source_id
    income_description
    income_category
    account_id
    start_date
    end_date
    pay_frequency
    total_amount
    transaction_count
    historical_summary
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



211
212
213
214
215
216
217
218
219
220
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 211

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} income_source_id: #{@income_source_id.inspect}, income_description:"\
  " #{@income_description.inspect}, income_category: #{@income_category.inspect}, account_id:"\
  " #{@account_id.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, pay_frequency: #{@pay_frequency.inspect}, total_amount:"\
  " #{@total_amount.inspect}, transaction_count: #{@transaction_count.inspect},"\
  " historical_summary: #{@historical_summary.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



200
201
202
203
204
205
206
207
208
# File 'lib/the_plaid_api/models/credit_bank_income_source.rb', line 200

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} income_source_id: #{@income_source_id}, income_description:"\
  " #{@income_description}, income_category: #{@income_category}, account_id: #{@account_id},"\
  " start_date: #{@start_date}, end_date: #{@end_date}, pay_frequency: #{@pay_frequency},"\
  " total_amount: #{@total_amount}, transaction_count: #{@transaction_count},"\
  " historical_summary: #{@historical_summary}, additional_properties:"\
  " #{@additional_properties}>"
end