Class: ThePlaidApi::IncomeSummary

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

Overview

The verified fields from a paystub verification. All fields are provided as reported on the paystub.

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(employer_name:, employee_name:, ytd_gross_income:, ytd_net_income:, pay_frequency:, projected_wage:, verified_transaction:, additional_properties: nil) ⇒ IncomeSummary

Returns a new instance of IncomeSummary.



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

def initialize(employer_name:, employee_name:, ytd_gross_income:,
               ytd_net_income:, pay_frequency:, projected_wage:,
               verified_transaction:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @employer_name = employer_name
  @employee_name = employee_name
  @ytd_gross_income = ytd_gross_income
  @ytd_net_income = ytd_net_income
  @pay_frequency = pay_frequency
  @projected_wage = projected_wage
  @verified_transaction = verified_transaction
  @additional_properties = additional_properties
end

Instance Attribute Details

#employee_nameEmployeeIncomeSummaryFieldString

The name of the employee, as reported on the paystub.



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

def employee_name
  @employee_name
end

#employer_nameEmployerIncomeSummaryFieldString

The name of the employer, as reported on the paystub.



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

def employer_name
  @employer_name
end

#pay_frequencyPayFrequency

The frequency of the pay period.

Returns:



32
33
34
# File 'lib/the_plaid_api/models/income_summary.rb', line 32

def pay_frequency
  @pay_frequency
end

#projected_wageProjectedIncomeSummaryFieldNumber

The employee’s estimated annual salary, as derived from information reported on the paystub.



37
38
39
# File 'lib/the_plaid_api/models/income_summary.rb', line 37

def projected_wage
  @projected_wage
end

#verified_transactionTransactionData

Information about the matched direct deposit transaction used to verify a user’s payroll information.

Returns:



42
43
44
# File 'lib/the_plaid_api/models/income_summary.rb', line 42

def verified_transaction
  @verified_transaction
end

#ytd_gross_incomeYtdGrossIncomeSummaryFieldNumber

Year-to-date pre-tax earnings, as reported on the paystub.



23
24
25
# File 'lib/the_plaid_api/models/income_summary.rb', line 23

def ytd_gross_income
  @ytd_gross_income
end

#ytd_net_incomeYtdNetIncomeSummaryFieldNumber

Year-to-date earnings after any tax withholdings, benefit payments or deductions, as reported on the paystub.



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

def ytd_net_income
  @ytd_net_income
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
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
120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/income_summary.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  employer_name = EmployerIncomeSummaryFieldString.from_hash(hash['employer_name']) if
    hash['employer_name']
  employee_name = EmployeeIncomeSummaryFieldString.from_hash(hash['employee_name']) if
    hash['employee_name']
  ytd_gross_income = YtdGrossIncomeSummaryFieldNumber.from_hash(hash['ytd_gross_income']) if
    hash['ytd_gross_income']
  ytd_net_income = YtdNetIncomeSummaryFieldNumber.from_hash(hash['ytd_net_income']) if
    hash['ytd_net_income']
  pay_frequency = PayFrequency.from_hash(hash['pay_frequency']) if hash['pay_frequency']
  projected_wage = ProjectedIncomeSummaryFieldNumber.from_hash(hash['projected_wage']) if
    hash['projected_wage']
  verified_transaction = TransactionData.from_hash(hash['verified_transaction']) if
    hash['verified_transaction']

  # 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.
  IncomeSummary.new(employer_name: employer_name,
                    employee_name: employee_name,
                    ytd_gross_income: ytd_gross_income,
                    ytd_net_income: ytd_net_income,
                    pay_frequency: pay_frequency,
                    projected_wage: projected_wage,
                    verified_transaction: verified_transaction,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/income_summary.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['employer_name'] = 'employer_name'
  @_hash['employee_name'] = 'employee_name'
  @_hash['ytd_gross_income'] = 'ytd_gross_income'
  @_hash['ytd_net_income'] = 'ytd_net_income'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash['projected_wage'] = 'projected_wage'
  @_hash['verified_transaction'] = 'verified_transaction'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/income_summary.rb', line 63

def self.nullables
  %w[
    employer_name
    employee_name
    ytd_gross_income
    ytd_net_income
    pay_frequency
    projected_wage
    verified_transaction
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/income_summary.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} employer_name: #{@employer_name.inspect}, employee_name:"\
  " #{@employee_name.inspect}, ytd_gross_income: #{@ytd_gross_income.inspect}, ytd_net_income:"\
  " #{@ytd_net_income.inspect}, pay_frequency: #{@pay_frequency.inspect}, projected_wage:"\
  " #{@projected_wage.inspect}, verified_transaction: #{@verified_transaction.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} employer_name: #{@employer_name}, employee_name: #{@employee_name},"\
  " ytd_gross_income: #{@ytd_gross_income}, ytd_net_income: #{@ytd_net_income}, pay_frequency:"\
  " #{@pay_frequency}, projected_wage: #{@projected_wage}, verified_transaction:"\
  " #{@verified_transaction}, additional_properties: #{@additional_properties}>"
end