Class: ThePlaidApi::MonitoringIncomeSource

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

Overview

An object representing an 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:, income_description:, income_category:, last_transaction_date:, additional_properties: nil) ⇒ MonitoringIncomeSource

Returns a new instance of MonitoringIncomeSource.



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

def initialize(income_source_id:, income_description:, income_category:,
               last_transaction_date:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @income_source_id = income_source_id
  @income_description = income_description
  @income_category = income_category
  @last_transaction_date = last_transaction_date
  @additional_properties = additional_properties
end

Instance Attribute Details

#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/monitoring_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/monitoring_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/monitoring_income_source.rb', line 14

def income_source_id
  @income_source_id
end

#last_transaction_dateDate

The last detected transaction date for this income source

Returns:

  • (Date)


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

def last_transaction_date
  @last_transaction_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/the_plaid_api/models/monitoring_income_source.rb', line 93

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'] : nil
  income_description =
    hash.key?('income_description') ? hash['income_description'] : nil
  income_category =
    hash.key?('income_category') ? hash['income_category'] : nil
  last_transaction_date =
    hash.key?('last_transaction_date') ? hash['last_transaction_date'] : nil

  # 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.
  MonitoringIncomeSource.new(income_source_id: income_source_id,
                             income_description: income_description,
                             income_category: income_category,
                             last_transaction_date: last_transaction_date,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
# File 'lib/the_plaid_api/models/monitoring_income_source.rb', line 61

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['last_transaction_date'] = 'last_transaction_date'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/the_plaid_api/models/monitoring_income_source.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
# File 'lib/the_plaid_api/models/monitoring_income_source.rb', line 130

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},"\
  " last_transaction_date: #{@last_transaction_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/the_plaid_api/models/monitoring_income_source.rb', line 122

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}, last_transaction_date:"\
  " #{@last_transaction_date}, additional_properties: #{@additional_properties}>"
end