Class: ThePlaidApi::SimulatedTransferSweep

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

Overview

A sweep returned from the ‘/sandbox/transfer/sweep/simulate` endpoint. Can be null if there are no transfers to include in a sweep.

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(id:, funding_account_id:, created:, amount:, iso_currency_code:, settled:, ledger_id: SKIP, expected_funds_available_date: SKIP, status: SKIP, trigger: SKIP, description: SKIP, network_trace_id: SKIP, failure_reason: SKIP, additional_properties: nil) ⇒ SimulatedTransferSweep

Returns a new instance of SimulatedTransferSweep.



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
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 147

def initialize(id:, funding_account_id:, created:, amount:,
               iso_currency_code:, settled:, ledger_id: SKIP,
               expected_funds_available_date: SKIP, status: SKIP,
               trigger: SKIP, description: SKIP, network_trace_id: SKIP,
               failure_reason: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @funding_account_id = 
  @ledger_id = ledger_id unless ledger_id == SKIP
  @created = created
  @amount = amount
  @iso_currency_code = iso_currency_code
  @settled = settled
  unless expected_funds_available_date == SKIP
    @expected_funds_available_date =
      expected_funds_available_date
  end
  @status = status unless status == SKIP
  @trigger = trigger unless trigger == SKIP
  @description = description unless description == SKIP
  @network_trace_id = network_trace_id unless network_trace_id == SKIP
  @failure_reason = failure_reason unless failure_reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountString

Signed decimal amount of the sweep as it appears on your sweep account ledger (e.g. “-10.00”) If amount is not present, the sweep was net-settled to zero and outstanding debits and credits between the sweep account and Plaid are balanced.

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 38

def amount
  @amount
end

#createdDateTime

The datetime when the sweep occurred, in RFC 3339 format.

Returns:

  • (DateTime)


30
31
32
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 30

def created
  @created
end

#descriptionString

The description of the deposit that will be passed to the receiving bank (up to 10 characters). Note that banks utilize this field differently, and may or may not show it on the bank statement.

Returns:

  • (String)


85
86
87
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 85

def description
  @description
end

#expected_funds_available_dateDate

The expected date when funds from a ledger deposit will be made available and can be withdrawn from the associated ledger balance. Only applies to deposits. This will be of the form YYYY-MM-DD.

Returns:

  • (Date)


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

def expected_funds_available_date
  @expected_funds_available_date
end

#failure_reasonSweepFailure

The failure reason if the status for a sweep is ‘“failed”` or `“returned”`. Null value otherwise.

Returns:



99
100
101
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 99

def failure_reason
  @failure_reason
end

#funding_account_idString

The id of the funding account to use, available in the Plaid Dashboard. This determines which of your business checking accounts will be credited or debited.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 22

def 
  @funding_account_id
end

#idString

Identifier of the sweep.

Returns:

  • (String)


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

def id
  @id
end

#iso_currency_codeString

The currency of the sweep, e.g. “USD”.

Returns:

  • (String)


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

def iso_currency_code
  @iso_currency_code
end

#ledger_idString

Plaid’s unique identifier for a Plaid Ledger Balance.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 26

def ledger_id
  @ledger_id
end

#network_trace_idString

The trace identifier for the transfer based on its network. This will only be set after the transfer has posted. For ‘ach` or `same-day-ach` transfers, this is the ACH trace number. For `rtp` transfers, this is the Transaction Identification number. For `wire` transfers, this is the IMAD (Input Message Accountability Data) number.

Returns:

  • (String)


94
95
96
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 94

def network_trace_id
  @network_trace_id
end

#settledDate

The date when the sweep settled, in the YYYY-MM-DD format.

Returns:

  • (Date)


46
47
48
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 46

def settled
  @settled
end

#statusSweepStatus

The status of a sweep transfer ‘“pending”` - The sweep is currently pending `“posted”` - The sweep has been posted `“settled”` - The sweep has settled. This is the terminal state of a successful credit sweep. `“returned”` - The sweep has been returned. This is the terminal state of a returned sweep. Returns of a sweep are extremely rare, since sweeps are money movement between your own bank account and your own Ledger. `“funds_available”` - Funds from the sweep have been released from hold and applied to the ledger’s available balance. (Only applicable to deposits.) This is the terminal state of a successful deposit sweep. ‘“failed”` - The sweep has failed. This is the terminal state of a failed sweep.

Returns:



68
69
70
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 68

def status
  @status
end

#triggerSweepTrigger

The trigger of the sweep ‘“manual”` - The sweep is created manually by the customer `“incoming”` - The sweep is created by incoming funds flow (e.g. Incoming Wire) `“balance_threshold”` - The sweep is created by balance threshold setting `“automatic_aggregate”` - The sweep is created by the Plaid automatic aggregation process. These funds did not pass through the Plaid Ledger balance.

Returns:



79
80
81
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 79

def trigger
  @trigger
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
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
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 175

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
   =
    hash.key?('funding_account_id') ? hash['funding_account_id'] : nil
  created = if hash.key?('created')
              (DateTimeHelper.from_rfc3339(hash['created']) if hash['created'])
            end
  amount = hash.key?('amount') ? hash['amount'] : nil
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil
  settled = hash.key?('settled') ? hash['settled'] : nil
  ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : SKIP
  expected_funds_available_date =
    hash.key?('expected_funds_available_date') ? hash['expected_funds_available_date'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  trigger = hash.key?('trigger') ? hash['trigger'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  network_trace_id =
    hash.key?('network_trace_id') ? hash['network_trace_id'] : SKIP
  failure_reason = SweepFailure.from_hash(hash['failure_reason']) if hash['failure_reason']

  # 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.
  SimulatedTransferSweep.new(id: id,
                             funding_account_id: ,
                             created: created,
                             amount: amount,
                             iso_currency_code: iso_currency_code,
                             settled: settled,
                             ledger_id: ledger_id,
                             expected_funds_available_date: expected_funds_available_date,
                             status: status,
                             trigger: trigger,
                             description: description,
                             network_trace_id: network_trace_id,
                             failure_reason: failure_reason,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 102

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['funding_account_id'] = 'funding_account_id'
  @_hash['ledger_id'] = 'ledger_id'
  @_hash['created'] = 'created'
  @_hash['amount'] = 'amount'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['settled'] = 'settled'
  @_hash['expected_funds_available_date'] =
    'expected_funds_available_date'
  @_hash['status'] = 'status'
  @_hash['trigger'] = 'trigger'
  @_hash['description'] = 'description'
  @_hash['network_trace_id'] = 'network_trace_id'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash
end

.nullablesObject

An array for nullable fields



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 135

def self.nullables
  %w[
    ledger_id
    settled
    expected_funds_available_date
    status
    trigger
    network_trace_id
    failure_reason
  ]
end

.optionalsObject

An array for optional fields



122
123
124
125
126
127
128
129
130
131
132
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 122

def self.optionals
  %w[
    ledger_id
    expected_funds_available_date
    status
    trigger
    description
    network_trace_id
    failure_reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



239
240
241
242
243
244
245
246
247
248
249
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 239

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, funding_account_id: #{@funding_account_id.inspect},"\
  " ledger_id: #{@ledger_id.inspect}, created: #{@created.inspect}, amount:"\
  " #{@amount.inspect}, iso_currency_code: #{@iso_currency_code.inspect}, settled:"\
  " #{@settled.inspect}, expected_funds_available_date:"\
  " #{@expected_funds_available_date.inspect}, status: #{@status.inspect}, trigger:"\
  " #{@trigger.inspect}, description: #{@description.inspect}, network_trace_id:"\
  " #{@network_trace_id.inspect}, failure_reason: #{@failure_reason.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_createdObject



223
224
225
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 223

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



228
229
230
231
232
233
234
235
236
# File 'lib/the_plaid_api/models/simulated_transfer_sweep.rb', line 228

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, funding_account_id: #{@funding_account_id}, ledger_id:"\
  " #{@ledger_id}, created: #{@created}, amount: #{@amount}, iso_currency_code:"\
  " #{@iso_currency_code}, settled: #{@settled}, expected_funds_available_date:"\
  " #{@expected_funds_available_date}, status: #{@status}, trigger: #{@trigger}, description:"\
  " #{@description}, network_trace_id: #{@network_trace_id}, failure_reason:"\
  " #{@failure_reason}, additional_properties: #{@additional_properties}>"
end