Class: ThePlaidApi::MonitoringIncomeInsights

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

Overview

An object representing the income subcategory of the 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(total_monthly_income:, income_sources_counts:, forecasted_monthly_income:, historical_annual_income:, income_sources:, additional_properties: nil) ⇒ MonitoringIncomeInsights

Returns a new instance of MonitoringIncomeInsights.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 56

def initialize(total_monthly_income:, income_sources_counts:,
               forecasted_monthly_income:, historical_annual_income:,
               income_sources:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @total_monthly_income = total_monthly_income
  @income_sources_counts = income_sources_counts
  @forecasted_monthly_income = forecasted_monthly_income
  @historical_annual_income = historical_annual_income
  @income_sources = income_sources
  @additional_properties = additional_properties
end

Instance Attribute Details

#forecasted_monthly_incomeForecastedMonthlyIncome

An object representing the predicted average monthly net income amount. This amount reflects the funds deposited into the account and may not include any withheld income such as taxes or other payroll deductions



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

def forecasted_monthly_income
  @forecasted_monthly_income
end

#historical_annual_incomeHistoricalAnnualIncome

An object representing the historical annual income amount.



28
29
30
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 28

def historical_annual_income
  @historical_annual_income
end

#income_sourcesArray[MonitoringIncomeSource]

The income sources for this Item. Each entry in the array is a single income source

Returns:



33
34
35
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 33

def income_sources
  @income_sources
end

#income_sources_countsIncomeSourcesCounts

Details about the number of income sources

Returns:



18
19
20
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 18

def income_sources_counts
  @income_sources_counts
end

#total_monthly_incomeTotalMonthlyIncomeInsights

Details about about the total monthly income



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

def total_monthly_income
  @total_monthly_income
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_monthly_income = TotalMonthlyIncomeInsights.from_hash(hash['total_monthly_income']) if
    hash['total_monthly_income']
  income_sources_counts = IncomeSourcesCounts.from_hash(hash['income_sources_counts']) if
    hash['income_sources_counts']
  if hash['forecasted_monthly_income']
    forecasted_monthly_income = ForecastedMonthlyIncome.from_hash(hash['forecasted_monthly_income'])
  end
  if hash['historical_annual_income']
    historical_annual_income = HistoricalAnnualIncome.from_hash(hash['historical_annual_income'])
  end
  # Parameter is an array, so we need to iterate through it
  income_sources = nil
  unless hash['income_sources'].nil?
    income_sources = []
    hash['income_sources'].each do |structure|
      income_sources << (MonitoringIncomeSource.from_hash(structure) if structure)
    end
  end

  income_sources = nil unless hash.key?('income_sources')

  # 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.
  MonitoringIncomeInsights.new(total_monthly_income: total_monthly_income,
                               income_sources_counts: income_sources_counts,
                               forecasted_monthly_income: forecasted_monthly_income,
                               historical_annual_income: historical_annual_income,
                               income_sources: income_sources,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_monthly_income'] = 'total_monthly_income'
  @_hash['income_sources_counts'] = 'income_sources_counts'
  @_hash['forecasted_monthly_income'] = 'forecasted_monthly_income'
  @_hash['historical_annual_income'] = 'historical_annual_income'
  @_hash['income_sources'] = 'income_sources'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_monthly_income: #{@total_monthly_income.inspect},"\
  " income_sources_counts: #{@income_sources_counts.inspect}, forecasted_monthly_income:"\
  " #{@forecasted_monthly_income.inspect}, historical_annual_income:"\
  " #{@historical_annual_income.inspect}, income_sources: #{@income_sources.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
119
# File 'lib/the_plaid_api/models/monitoring_income_insights.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_monthly_income: #{@total_monthly_income}, income_sources_counts:"\
  " #{@income_sources_counts}, forecasted_monthly_income: #{@forecasted_monthly_income},"\
  " historical_annual_income: #{@historical_annual_income}, income_sources:"\
  " #{@income_sources}, additional_properties: #{@additional_properties}>"
end