Class: ThePlaidApi::LinkSessionResults

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

Overview

The set of results for a Link session.

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(item_add_results:, cra_item_add_results:, cra_update_results:, bank_income_results:, payroll_income_results:, document_income_results:, cra_document_upload_results: SKIP, protect_results: SKIP, additional_properties: nil) ⇒ LinkSessionResults

Returns a new instance of LinkSessionResults.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/the_plaid_api/models/link_session_results.rb', line 77

def initialize(item_add_results:, cra_item_add_results:,
               cra_update_results:, bank_income_results:,
               payroll_income_results:, document_income_results:,
               cra_document_upload_results: SKIP, protect_results: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_add_results = item_add_results
  @cra_item_add_results = cra_item_add_results
  @cra_update_results = cra_update_results
  @bank_income_results = bank_income_results
  @payroll_income_results = payroll_income_results
  @document_income_results = document_income_results
  unless cra_document_upload_results == SKIP
    @cra_document_upload_results =
      cra_document_upload_results
  end
  @protect_results = protect_results unless protect_results == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_income_resultsArray[LinkSessionBankIncomeResult]

The set of bank income verifications for the Link session.

Returns:



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

def bank_income_results
  @bank_income_results
end

#cra_document_upload_resultsLinkSessionCraDocumentUploadResult

The details of a document upload CRA session in link



40
41
42
# File 'lib/the_plaid_api/models/link_session_results.rb', line 40

def cra_document_upload_results
  @cra_document_upload_results
end

#cra_item_add_resultsArray[LinkSessionCraItemAddResult]

The set of Plaid Check Item adds for the Link session.

Returns:



20
21
22
# File 'lib/the_plaid_api/models/link_session_results.rb', line 20

def cra_item_add_results
  @cra_item_add_results
end

#cra_update_resultsArray[LinkSessionCraUpdateResult]

The set of Plaid Check Item updates for the Link session.

Returns:



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

def cra_update_results
  @cra_update_results
end

#document_income_resultsCreditSessionDocumentIncomeResult

The details of a document income verification in Link



36
37
38
# File 'lib/the_plaid_api/models/link_session_results.rb', line 36

def document_income_results
  @document_income_results
end

#item_add_resultsArray[LinkSessionItemAddResult]

The set of Item adds for the Link session. If you are not receiving this field and are instead receiving the deprecated ‘on_success` field, contact your Account Manager to update your integration.

Returns:



16
17
18
# File 'lib/the_plaid_api/models/link_session_results.rb', line 16

def item_add_results
  @item_add_results
end

#payroll_income_resultsArray[LinkSessionPayrollIncomeResult]

The set of payroll income verifications for the Link session.

Returns:



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

def payroll_income_results
  @payroll_income_results
end

#protect_resultsLinkSessionProtectResult

Plaid Protect details from the Link session



44
45
46
# File 'lib/the_plaid_api/models/link_session_results.rb', line 44

def protect_results
  @protect_results
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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
# File 'lib/the_plaid_api/models/link_session_results.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  item_add_results = nil
  unless hash['item_add_results'].nil?
    item_add_results = []
    hash['item_add_results'].each do |structure|
      item_add_results << (LinkSessionItemAddResult.from_hash(structure) if structure)
    end
  end

  item_add_results = nil unless hash.key?('item_add_results')
  # Parameter is an array, so we need to iterate through it
  cra_item_add_results = nil
  unless hash['cra_item_add_results'].nil?
    cra_item_add_results = []
    hash['cra_item_add_results'].each do |structure|
      cra_item_add_results << (LinkSessionCraItemAddResult.from_hash(structure) if structure)
    end
  end

  cra_item_add_results = nil unless hash.key?('cra_item_add_results')
  # Parameter is an array, so we need to iterate through it
  cra_update_results = nil
  unless hash['cra_update_results'].nil?
    cra_update_results = []
    hash['cra_update_results'].each do |structure|
      cra_update_results << (LinkSessionCraUpdateResult.from_hash(structure) if structure)
    end
  end

  cra_update_results = nil unless hash.key?('cra_update_results')
  # Parameter is an array, so we need to iterate through it
  bank_income_results = nil
  unless hash['bank_income_results'].nil?
    bank_income_results = []
    hash['bank_income_results'].each do |structure|
      bank_income_results << (LinkSessionBankIncomeResult.from_hash(structure) if structure)
    end
  end

  bank_income_results = nil unless hash.key?('bank_income_results')
  # Parameter is an array, so we need to iterate through it
  payroll_income_results = nil
  unless hash['payroll_income_results'].nil?
    payroll_income_results = []
    hash['payroll_income_results'].each do |structure|
      payroll_income_results << (LinkSessionPayrollIncomeResult.from_hash(structure) if structure)
    end
  end

  payroll_income_results = nil unless hash.key?('payroll_income_results')
  if hash['document_income_results']
    document_income_results = CreditSessionDocumentIncomeResult.from_hash(hash['document_income_results'])
  end
  if hash['cra_document_upload_results']
    cra_document_upload_results = LinkSessionCraDocumentUploadResult.from_hash(hash['cra_document_upload_results'])
  end
  protect_results = LinkSessionProtectResult.from_hash(hash['protect_results']) if
    hash['protect_results']

  # 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.
  LinkSessionResults.new(item_add_results: item_add_results,
                         cra_item_add_results: cra_item_add_results,
                         cra_update_results: cra_update_results,
                         bank_income_results: bank_income_results,
                         payroll_income_results: payroll_income_results,
                         document_income_results: document_income_results,
                         cra_document_upload_results: cra_document_upload_results,
                         protect_results: protect_results,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/link_session_results.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_add_results'] = 'item_add_results'
  @_hash['cra_item_add_results'] = 'cra_item_add_results'
  @_hash['cra_update_results'] = 'cra_update_results'
  @_hash['bank_income_results'] = 'bank_income_results'
  @_hash['payroll_income_results'] = 'payroll_income_results'
  @_hash['document_income_results'] = 'document_income_results'
  @_hash['cra_document_upload_results'] = 'cra_document_upload_results'
  @_hash['protect_results'] = 'protect_results'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/link_session_results.rb', line 69

def self.nullables
  %w[
    document_income_results
    cra_document_upload_results
    protect_results
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    cra_document_upload_results
    protect_results
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



194
195
196
197
198
199
200
201
202
203
# File 'lib/the_plaid_api/models/link_session_results.rb', line 194

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_add_results: #{@item_add_results.inspect}, cra_item_add_results:"\
  " #{@cra_item_add_results.inspect}, cra_update_results: #{@cra_update_results.inspect},"\
  " bank_income_results: #{@bank_income_results.inspect}, payroll_income_results:"\
  " #{@payroll_income_results.inspect}, document_income_results:"\
  " #{@document_income_results.inspect}, cra_document_upload_results:"\
  " #{@cra_document_upload_results.inspect}, protect_results: #{@protect_results.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



183
184
185
186
187
188
189
190
191
# File 'lib/the_plaid_api/models/link_session_results.rb', line 183

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_add_results: #{@item_add_results}, cra_item_add_results:"\
  " #{@cra_item_add_results}, cra_update_results: #{@cra_update_results}, bank_income_results:"\
  " #{@bank_income_results}, payroll_income_results: #{@payroll_income_results},"\
  " document_income_results: #{@document_income_results}, cra_document_upload_results:"\
  " #{@cra_document_upload_results}, protect_results: #{@protect_results},"\
  " additional_properties: #{@additional_properties}>"
end