Class: ThePlaidApi::TransferSweep
- Defined in:
- lib/the_plaid_api/models/transfer_sweep.rb
Overview
Describes a sweep of funds to / from the sweep account. A sweep is associated with many sweep events (events of type ‘swept` or `return_swept`) which can be retrieved by invoking the `/transfer/event/list` endpoint with the corresponding `sweep_id`. `swept` events occur when the transfer amount is credited or debited from your sweep account, depending on the `type` of the transfer. `return_swept` events occur when a transfer is returned and Plaid undoes the credit or debit. The total sum of the `swept` and `return_swept` events is equal to the `amount` of the sweep Plaid creates and matches the amount of the entry on your sweep account ledger.
Instance Attribute Summary collapse
-
#amount ⇒ String
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.
-
#created ⇒ DateTime
The datetime when the sweep occurred, in RFC 3339 format.
-
#description ⇒ String
The description of the deposit that will be passed to the receiving bank (up to 10 characters).
-
#expected_funds_available_date ⇒ Date
The expected date when funds from a ledger deposit will be made available and can be withdrawn from the associated ledger balance.
-
#failure_reason ⇒ SweepFailure
The failure reason if the status for a sweep is ‘“failed”` or `“returned”`.
-
#funding_account_id ⇒ String
The id of the funding account to use, available in the Plaid Dashboard.
-
#id ⇒ String
Identifier of the sweep.
-
#iso_currency_code ⇒ String
The currency of the sweep, e.g.
-
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
-
#network_trace_id ⇒ String
The trace identifier for the transfer based on its network.
-
#settled ⇒ Date
The date when the sweep settled, in the YYYY-MM-DD format.
-
#status ⇒ SweepStatus
The status of a sweep transfer ‘“pending”` - The sweep is currently pending `“posted”` - The sweep has been posted `“settled”` - The sweep has settled.
-
#trigger ⇒ SweepTrigger
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.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#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) ⇒ TransferSweep
constructor
A new instance of TransferSweep.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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) ⇒ TransferSweep
Returns a new instance of TransferSweep.
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 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 154 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 = 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
#amount ⇒ String
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.
45 46 47 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 45 def amount @amount end |
#created ⇒ DateTime
The datetime when the sweep occurred, in RFC 3339 format.
37 38 39 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 37 def created @created end |
#description ⇒ String
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.
92 93 94 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 92 def description @description end |
#expected_funds_available_date ⇒ Date
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.
59 60 61 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 59 def expected_funds_available_date @expected_funds_available_date end |
#failure_reason ⇒ SweepFailure
The failure reason if the status for a sweep is ‘“failed”` or `“returned”`. Null value otherwise.
106 107 108 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 106 def failure_reason @failure_reason end |
#funding_account_id ⇒ String
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.
29 30 31 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 29 def funding_account_id @funding_account_id end |
#id ⇒ String
Identifier of the sweep.
23 24 25 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 23 def id @id end |
#iso_currency_code ⇒ String
The currency of the sweep, e.g. “USD”.
49 50 51 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 49 def iso_currency_code @iso_currency_code end |
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
33 34 35 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 33 def ledger_id @ledger_id end |
#network_trace_id ⇒ String
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.
101 102 103 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 101 def network_trace_id @network_trace_id end |
#settled ⇒ Date
The date when the sweep settled, in the YYYY-MM-DD format.
53 54 55 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 53 def settled @settled end |
#status ⇒ SweepStatus
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.
75 76 77 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 75 def status @status end |
#trigger ⇒ SweepTrigger
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.
86 87 88 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 86 def trigger @trigger end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 222 223 224 225 226 227 228 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 182 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil funding_account_id = 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. TransferSweep.new(id: id, funding_account_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 |
.names ⇒ Object
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 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 109 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 |
.nullables ⇒ Object
An array for nullable fields
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 142 def self.nullables %w[ ledger_id settled expected_funds_available_date status trigger network_trace_id failure_reason ] end |
.optionals ⇒ Object
An array for optional fields
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 129 def self.optionals %w[ ledger_id expected_funds_available_date status trigger description network_trace_id failure_reason ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 246 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_created ⇒ Object
230 231 232 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 230 def to_custom_created DateTimeHelper.to_rfc3339(created) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
235 236 237 238 239 240 241 242 243 |
# File 'lib/the_plaid_api/models/transfer_sweep.rb', line 235 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 |