Class: Plaid::DepositSwitchGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/deposit_switch_get_response.rb

Overview

DepositSwitchGetResponse defines the response schema for ‘/deposit_switch/get`

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(deposit_switch_id:, target_account_id:, target_item_id:, state:, account_has_multiple_allocations:, is_allocated_remainder:, percent_allocated:, amount_allocated:, date_created:, date_completed:, request_id:, switch_method: SKIP, employer_name: SKIP, employer_id: SKIP, institution_name: SKIP, institution_id: SKIP, additional_properties: nil) ⇒ DepositSwitchGetResponse

Returns a new instance of DepositSwitchGetResponse.



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 159

def initialize(deposit_switch_id:, target_account_id:, target_item_id:,
               state:, account_has_multiple_allocations:,
               is_allocated_remainder:, percent_allocated:,
               amount_allocated:, date_created:, date_completed:,
               request_id:, switch_method: SKIP, employer_name: SKIP,
               employer_id: SKIP, institution_name: SKIP,
               institution_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @deposit_switch_id = deposit_switch_id
  @target_account_id = 
  @target_item_id = target_item_id
  @state = state
  @switch_method = switch_method unless switch_method == SKIP
  @account_has_multiple_allocations = 
  @is_allocated_remainder = is_allocated_remainder
  @percent_allocated = percent_allocated
  @amount_allocated = amount_allocated
  @employer_name = employer_name unless employer_name == SKIP
  @employer_id = employer_id unless employer_id == SKIP
  @institution_name = institution_name unless institution_name == SKIP
  @institution_id = institution_id unless institution_id == SKIP
  @date_created = date_created
  @date_completed = date_completed
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_has_multiple_allocationsTrueClass | FalseClass

When ‘true`, user’s direct deposit goes to multiple banks. When false, user’s direct deposit only goes to the target account. Always `null` if the deposit switch has not been completed.

Returns:

  • (TrueClass | FalseClass)


50
51
52
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 50

def 
  @account_has_multiple_allocations
end

#amount_allocatedFloat

The dollar amount of direct deposit allocated to the target account. Always ‘null` if the target account is not allocated an amount or if the deposit switch has not been completed.

Returns:

  • (Float)


70
71
72
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 70

def amount_allocated
  @amount_allocated
end

#date_completedDate

[ISO 8601](wikipedia.org/wiki/ISO_8601) date the deposit switch was completed. Always ‘null` if the deposit switch has not been completed.

Returns:

  • (Date)


100
101
102
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 100

def date_completed
  @date_completed
end

#date_createdDate

[ISO 8601](wikipedia.org/wiki/ISO_8601) date the deposit switch was created.

Returns:

  • (Date)


95
96
97
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 95

def date_created
  @date_created
end

#deposit_switch_idString

The ID of the deposit switch.

Returns:

  • (String)


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

def deposit_switch_id
  @deposit_switch_id
end

#employer_idString

The ID of the employer selected by the user. If the user did not select an employer, the value returned is ‘null`.

Returns:

  • (String)


80
81
82
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 80

def employer_id
  @employer_id
end

#employer_nameString

The name of the employer selected by the user. If the user did not select an employer, the value returned is ‘null`.

Returns:

  • (String)


75
76
77
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 75

def employer_name
  @employer_name
end

#institution_idString

The ID of the institution selected by the user. If the user did not select an institution, the value returned is ‘null`.

Returns:

  • (String)


90
91
92
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 90

def institution_id
  @institution_id
end

#institution_nameString

The name of the institution selected by the user. If the user did not select an institution, the value returned is ‘null`.

Returns:

  • (String)


85
86
87
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 85

def institution_name
  @institution_name
end

#is_allocated_remainderTrueClass | FalseClass

When ‘true`, the target account is allocated the remainder of direct deposit after all other allocations have been deducted. When `false`, user’s direct deposit is allocated as a percent or amount. Always `null` if the deposit switch has not been completed.

Returns:

  • (TrueClass | FalseClass)


57
58
59
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 57

def is_allocated_remainder
  @is_allocated_remainder
end

#percent_allocatedFloat

The percentage of direct deposit allocated to the target account. Always ‘null` if the target account is not allocated a percentage or if the deposit switch has not been completed or if `is_allocated_remainder` is true.

Returns:

  • (Float)


64
65
66
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 64

def percent_allocated
  @percent_allocated
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


106
107
108
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 106

def request_id
  @request_id
end

#stateState

The state, or status, of the deposit switch.

  • ‘initialized` – The deposit switch has been initialized with the user

entering the information required to submit the deposit switch request.

  • ‘processing` – The deposit switch request has been submitted and is

being processed.

  • ‘completed` – The user’s employer has fulfilled the deposit switch

request.

  • ‘error` – There was an error processing the deposit switch request.

Returns:



34
35
36
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 34

def state
  @state
end

#switch_methodSwitchMethod

The method used to make the deposit switch.

  • ‘instant` – User instantly switched their direct deposit to a new or

existing bank account by connecting their payroll or employer account.

  • ‘mail` – User requested that Plaid contact their employer by mail to

make the direct deposit switch.

  • ‘pdf` – User generated a PDF or email to be sent to their employer with

the information necessary to make the deposit switch.‘

Returns:



44
45
46
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 44

def switch_method
  @switch_method
end

#target_account_idString

The ID of the bank account the direct deposit was switched to.

Returns:

  • (String)


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

def 
  @target_account_id
end

#target_item_idString

The ID of the Item the direct deposit was switched to.

Returns:

  • (String)


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

def target_item_id
  @target_item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 189

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  deposit_switch_id =
    hash.key?('deposit_switch_id') ? hash['deposit_switch_id'] : nil
   =
    hash.key?('target_account_id') ? hash['target_account_id'] : nil
  target_item_id =
    hash.key?('target_item_id') ? hash['target_item_id'] : nil
  state = hash.key?('state') ? hash['state'] : nil
   =
    hash.key?('account_has_multiple_allocations') ? hash['account_has_multiple_allocations'] : nil
  is_allocated_remainder =
    hash.key?('is_allocated_remainder') ? hash['is_allocated_remainder'] : nil
  percent_allocated =
    hash.key?('percent_allocated') ? hash['percent_allocated'] : nil
  amount_allocated =
    hash.key?('amount_allocated') ? hash['amount_allocated'] : nil
  date_created = hash.key?('date_created') ? hash['date_created'] : nil
  date_completed =
    hash.key?('date_completed') ? hash['date_completed'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  switch_method = hash.key?('switch_method') ? hash['switch_method'] : SKIP
  employer_name = hash.key?('employer_name') ? hash['employer_name'] : SKIP
  employer_id = hash.key?('employer_id') ? hash['employer_id'] : SKIP
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : SKIP
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : SKIP

  # 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.
  DepositSwitchGetResponse.new(deposit_switch_id: deposit_switch_id,
                               target_account_id: ,
                               target_item_id: target_item_id,
                               state: state,
                               account_has_multiple_allocations: ,
                               is_allocated_remainder: is_allocated_remainder,
                               percent_allocated: percent_allocated,
                               amount_allocated: amount_allocated,
                               date_created: date_created,
                               date_completed: date_completed,
                               request_id: request_id,
                               switch_method: switch_method,
                               employer_name: employer_name,
                               employer_id: employer_id,
                               institution_name: institution_name,
                               institution_id: institution_id,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 109

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['deposit_switch_id'] = 'deposit_switch_id'
  @_hash['target_account_id'] = 'target_account_id'
  @_hash['target_item_id'] = 'target_item_id'
  @_hash['state'] = 'state'
  @_hash['switch_method'] = 'switch_method'
  @_hash['account_has_multiple_allocations'] =
    'account_has_multiple_allocations'
  @_hash['is_allocated_remainder'] = 'is_allocated_remainder'
  @_hash['percent_allocated'] = 'percent_allocated'
  @_hash['amount_allocated'] = 'amount_allocated'
  @_hash['employer_name'] = 'employer_name'
  @_hash['employer_id'] = 'employer_id'
  @_hash['institution_name'] = 'institution_name'
  @_hash['institution_id'] = 'institution_id'
  @_hash['date_created'] = 'date_created'
  @_hash['date_completed'] = 'date_completed'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 143

def self.nullables
  %w[
    target_account_id
    target_item_id
    account_has_multiple_allocations
    is_allocated_remainder
    percent_allocated
    amount_allocated
    employer_name
    employer_id
    institution_name
    institution_id
    date_completed
  ]
end

.optionalsObject

An array for optional fields



132
133
134
135
136
137
138
139
140
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 132

def self.optionals
  %w[
    switch_method
    employer_name
    employer_id
    institution_name
    institution_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 262

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} deposit_switch_id: #{@deposit_switch_id.inspect}, target_account_id:"\
  " #{@target_account_id.inspect}, target_item_id: #{@target_item_id.inspect}, state:"\
  " #{@state.inspect}, switch_method: #{@switch_method.inspect},"\
  " account_has_multiple_allocations: #{@account_has_multiple_allocations.inspect},"\
  " is_allocated_remainder: #{@is_allocated_remainder.inspect}, percent_allocated:"\
  " #{@percent_allocated.inspect}, amount_allocated: #{@amount_allocated.inspect},"\
  " employer_name: #{@employer_name.inspect}, employer_id: #{@employer_id.inspect},"\
  " institution_name: #{@institution_name.inspect}, institution_id:"\
  " #{@institution_id.inspect}, date_created: #{@date_created.inspect}, date_completed:"\
  " #{@date_completed.inspect}, request_id: #{@request_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/plaid/models/deposit_switch_get_response.rb', line 248

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} deposit_switch_id: #{@deposit_switch_id}, target_account_id:"\
  " #{@target_account_id}, target_item_id: #{@target_item_id}, state: #{@state},"\
  " switch_method: #{@switch_method}, account_has_multiple_allocations:"\
  " #{@account_has_multiple_allocations}, is_allocated_remainder: #{@is_allocated_remainder},"\
  " percent_allocated: #{@percent_allocated}, amount_allocated: #{@amount_allocated},"\
  " employer_name: #{@employer_name}, employer_id: #{@employer_id}, institution_name:"\
  " #{@institution_name}, institution_id: #{@institution_id}, date_created: #{@date_created},"\
  " date_completed: #{@date_completed}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end