Class: Plaid::Transfer
- Defined in:
- lib/plaid/models/transfer.rb
Overview
Represents a transfer within the Transfers API.
Instance Attribute Summary collapse
-
#account_id ⇒ String
The account ID that should be credited/debited for this transfer.
-
#ach_class ⇒ AchClass
Specifies the use case of the transfer.
-
#amount ⇒ String
The amount of the transfer (decimal string with two digits of precision e.g. “10.00”).
-
#cancellable ⇒ TrueClass | FalseClass
When ‘true`, you can still cancel this transfer.
-
#created ⇒ DateTime
The datetime when this transfer was created.
-
#description ⇒ String
The description of the transfer.
-
#failure_reason ⇒ TransferFailure
The failure reason if the type of this transfer is ‘“failed”` or `“reversed”`.
-
#id ⇒ String
Plaid’s unique identifier for a transfer.
-
#metadata ⇒ Hash[String, String]
The Metadata object is a mapping of client-provided string fields to any string value.
-
#network ⇒ TransferNetwork
The network or rails used for the transfer.
-
#origination_account_id ⇒ String
Plaid’s unique identifier for the origination account that was used for this transfer.
-
#status ⇒ TransferStatus
The status of the transfer.
-
#type ⇒ TransferType1
The type of transfer.
-
#user ⇒ TransferUserInResponse
The legal name and other information for the account holder.
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:, ach_class:, account_id:, type:, user:, amount:, description:, created:, status:, network:, cancellable:, failure_reason:, metadata:, origination_account_id:, additional_properties: nil) ⇒ Transfer
constructor
A new instance of Transfer.
-
#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:, ach_class:, account_id:, type:, user:, amount:, description:, created:, status:, network:, cancellable:, failure_reason:, metadata:, origination_account_id:, additional_properties: nil) ⇒ Transfer
Returns a new instance of Transfer.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/plaid/models/transfer.rb', line 131 def initialize(id:, ach_class:, account_id:, type:, user:, amount:, description:, created:, status:, network:, cancellable:, failure_reason:, metadata:, origination_account_id:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @ach_class = ach_class @account_id = account_id @type = type @user = user @amount = amount @description = description @created = created @status = status @network = network @cancellable = cancellable @failure_reason = failure_reason @metadata = @origination_account_id = origination_account_id @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
The account ID that should be credited/debited for this transfer.
42 43 44 |
# File 'lib/plaid/models/transfer.rb', line 42 def account_id @account_id end |
#ach_class ⇒ AchClass
Specifies the use case of the transfer. Required for transfers on an ACH network. ‘“arc”` - Accounts Receivable Entry `“cbr`” - Cross Border Entry `“ccd”` - Corporate Credit or Debit - fund transfer between two corporate bank accounts `“cie”` - Customer Initiated Entry `“cor”` - Automated Notification of Change `“ctx”` - Corporate Trade Exchange `“iat”` - International `“mte”` - Machine Transfer Entry `“pbr”` - Cross Border Entry `“pop”` - Point-of-Purchase Entry `“pos”` - Point-of-Sale Entry `“ppd”` - Prearranged Payment or Deposit - the transfer is part of a pre-existing relationship with a consumer, eg. bill payment `“rck”` - Re-presented Check Entry `“tel”` - Telephone-Initiated Entry `“web”` - Internet-Initiated Entry - debits from a consumer’s account where their authorization is obtained over the Internet
38 39 40 |
# File 'lib/plaid/models/transfer.rb', line 38 def ach_class @ach_class end |
#amount ⇒ String
The amount of the transfer (decimal string with two digits of precision e.g. “10.00”).
57 58 59 |
# File 'lib/plaid/models/transfer.rb', line 57 def amount @amount end |
#cancellable ⇒ TrueClass | FalseClass
When ‘true`, you can still cancel this transfer.
79 80 81 |
# File 'lib/plaid/models/transfer.rb', line 79 def cancellable @cancellable end |
#created ⇒ DateTime
The datetime when this transfer was created. This will be of the form ‘2006-01-02T15:04:05Z`
66 67 68 |
# File 'lib/plaid/models/transfer.rb', line 66 def created @created end |
#description ⇒ String
The description of the transfer.
61 62 63 |
# File 'lib/plaid/models/transfer.rb', line 61 def description @description end |
#failure_reason ⇒ TransferFailure
The failure reason if the type of this transfer is ‘“failed”` or `“reversed”`. Null value otherwise.
84 85 86 |
# File 'lib/plaid/models/transfer.rb', line 84 def failure_reason @failure_reason end |
#id ⇒ String
Plaid’s unique identifier for a transfer.
15 16 17 |
# File 'lib/plaid/models/transfer.rb', line 15 def id @id end |
#metadata ⇒ Hash[String, String]
The Metadata object is a mapping of client-provided string fields to any string value. The following limitations apply:
-
The JSON values must be Strings (no nested JSON objects allowed)
-
Only ASCII characters may be used
-
Maximum of 50 key/value pairs
-
Maximum key length of 40 characters
-
Maximum value length of 500 characters
94 95 96 |
# File 'lib/plaid/models/transfer.rb', line 94 def @metadata end |
#network ⇒ TransferNetwork
The network or rails used for the transfer. Valid options are ‘ach` or `same-day-ach`.
75 76 77 |
# File 'lib/plaid/models/transfer.rb', line 75 def network @network end |
#origination_account_id ⇒ String
Plaid’s unique identifier for the origination account that was used for this transfer.
99 100 101 |
# File 'lib/plaid/models/transfer.rb', line 99 def origination_account_id @origination_account_id end |
#status ⇒ TransferStatus
The status of the transfer.
70 71 72 |
# File 'lib/plaid/models/transfer.rb', line 70 def status @status end |
#type ⇒ TransferType1
The type of transfer. This will be either ‘debit` or `credit`. A `debit` indicates a transfer of money into the origination account; a `credit` indicates a transfer of money out of the origination account.
48 49 50 |
# File 'lib/plaid/models/transfer.rb', line 48 def type @type end |
#user ⇒ TransferUserInResponse
The legal name and other information for the account holder.
52 53 54 |
# File 'lib/plaid/models/transfer.rb', line 52 def user @user end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/plaid/models/transfer.rb', line 156 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil ach_class = hash.key?('ach_class') ? hash['ach_class'] : nil account_id = hash.key?('account_id') ? hash['account_id'] : nil type = hash.key?('type') ? hash['type'] : nil user = TransferUserInResponse.from_hash(hash['user']) if hash['user'] amount = hash.key?('amount') ? hash['amount'] : nil description = hash.key?('description') ? hash['description'] : nil created = if hash.key?('created') (DateTimeHelper.from_rfc3339(hash['created']) if hash['created']) end status = hash.key?('status') ? hash['status'] : nil network = hash.key?('network') ? hash['network'] : nil cancellable = hash.key?('cancellable') ? hash['cancellable'] : nil failure_reason = TransferFailure.from_hash(hash['failure_reason']) if hash['failure_reason'] = hash.key?('metadata') ? hash['metadata'] : nil origination_account_id = hash.key?('origination_account_id') ? hash['origination_account_id'] : nil # 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. Transfer.new(id: id, ach_class: ach_class, account_id: account_id, type: type, user: user, amount: amount, description: description, created: created, status: status, network: network, cancellable: cancellable, failure_reason: failure_reason, metadata: , origination_account_id: origination_account_id, additional_properties: additional_properties) end |
.names ⇒ Object
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/plaid/models/transfer.rb', line 102 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['ach_class'] = 'ach_class' @_hash['account_id'] = 'account_id' @_hash['type'] = 'type' @_hash['user'] = 'user' @_hash['amount'] = 'amount' @_hash['description'] = 'description' @_hash['created'] = 'created' @_hash['status'] = 'status' @_hash['network'] = 'network' @_hash['cancellable'] = 'cancellable' @_hash['failure_reason'] = 'failure_reason' @_hash['metadata'] = 'metadata' @_hash['origination_account_id'] = 'origination_account_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
127 128 129 |
# File 'lib/plaid/models/transfer.rb', line 127 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
122 123 124 |
# File 'lib/plaid/models/transfer.rb', line 122 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/plaid/models/transfer.rb', line 218 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, ach_class: #{@ach_class.inspect}, account_id:"\ " #{@account_id.inspect}, type: #{@type.inspect}, user: #{@user.inspect}, amount:"\ " #{@amount.inspect}, description: #{@description.inspect}, created: #{@created.inspect},"\ " status: #{@status.inspect}, network: #{@network.inspect}, cancellable:"\ " #{@cancellable.inspect}, failure_reason: #{@failure_reason.inspect}, metadata:"\ " #{@metadata.inspect}, origination_account_id: #{@origination_account_id.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_created ⇒ Object
203 204 205 |
# File 'lib/plaid/models/transfer.rb', line 203 def to_custom_created DateTimeHelper.to_rfc3339(created) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
208 209 210 211 212 213 214 215 |
# File 'lib/plaid/models/transfer.rb', line 208 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, ach_class: #{@ach_class}, account_id: #{@account_id}, type:"\ " #{@type}, user: #{@user}, amount: #{@amount}, description: #{@description}, created:"\ " #{@created}, status: #{@status}, network: #{@network}, cancellable: #{@cancellable},"\ " failure_reason: #{@failure_reason}, metadata: #{@metadata}, origination_account_id:"\ " #{@origination_account_id}, additional_properties: #{@additional_properties}>" end |