Class: Plaid::IncomeSummary

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/plaid/models/income_summary.rb', line 65

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

TODO: Write general description for this method



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

def employee_name
  @employee_name
end

#employer_nameEmployerIncomeSummaryFieldString

TODO: Write general description for this method



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

def employer_name
  @employer_name
end

#pay_frequencyPayFrequency

TODO: Write general description for this method

Returns:



31
32
33
# File 'lib/plaid/models/income_summary.rb', line 31

def pay_frequency
  @pay_frequency
end

#projected_wageProjectedIncomeSummaryFieldNumber

TODO: Write general description for this method



35
36
37
# File 'lib/plaid/models/income_summary.rb', line 35

def projected_wage
  @projected_wage
end

#verified_transactionTransactionData

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

Returns:



40
41
42
# File 'lib/plaid/models/income_summary.rb', line 40

def verified_transaction
  @verified_transaction
end

#ytd_gross_incomeYtdGrossIncomeSummaryFieldNumber

TODO: Write general description for this method



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

def ytd_gross_income
  @ytd_gross_income
end

#ytd_net_incomeYtdNetIncomeSummaryFieldNumber

TODO: Write general description for this method



27
28
29
# File 'lib/plaid/models/income_summary.rb', line 27

def ytd_net_income
  @ytd_net_income
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
111
112
113
114
115
116
# File 'lib/plaid/models/income_summary.rb', line 82

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.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/plaid/models/income_summary.rb', line 43

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



61
62
63
# File 'lib/plaid/models/income_summary.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
# File 'lib/plaid/models/income_summary.rb', line 56

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



119
120
121
122
123
124
125
# File 'lib/plaid/models/income_summary.rb', line 119

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