Class: ThePlaidApi::BankTransferEvent

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

Overview

Represents an event in the Bank Transfers API.

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(event_id:, timestamp:, event_type:, account_id:, bank_transfer_id:, origination_account_id:, bank_transfer_type:, bank_transfer_amount:, bank_transfer_iso_currency_code:, failure_reason:, direction:, additional_properties: nil) ⇒ BankTransferEvent

Returns a new instance of BankTransferEvent.



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

def initialize(event_id:, timestamp:, event_type:, account_id:,
               bank_transfer_id:, origination_account_id:,
               bank_transfer_type:, bank_transfer_amount:,
               bank_transfer_iso_currency_code:, failure_reason:,
               direction:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @event_id = event_id
  @timestamp = timestamp
  @event_type = event_type
  @account_id = 
  @bank_transfer_id = bank_transfer_id
  @origination_account_id = 
  @bank_transfer_type = bank_transfer_type
  @bank_transfer_amount = bank_transfer_amount
  @bank_transfer_iso_currency_code = bank_transfer_iso_currency_code
  @failure_reason = failure_reason
  @direction = direction
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The account ID associated with the bank transfer.

Returns:

  • (String)


35
36
37
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 35

def 
  @account_id
end

#bank_transfer_amountString

The bank transfer amount.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 53

def bank_transfer_amount
  @bank_transfer_amount
end

#bank_transfer_idString

Plaid’s unique identifier for a bank transfer.

Returns:

  • (String)


39
40
41
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 39

def bank_transfer_id
  @bank_transfer_id
end

#bank_transfer_iso_currency_codeString

The currency of the bank transfer amount.

Returns:

  • (String)


57
58
59
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 57

def bank_transfer_iso_currency_code
  @bank_transfer_iso_currency_code
end

#bank_transfer_typeBankTransferType

The type of bank 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.

Returns:



49
50
51
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 49

def bank_transfer_type
  @bank_transfer_type
end

#directionBankTransferDirection

Indicates the direction of the transfer: ‘outbound` for API-initiated transfers, or `inbound` for payments received by the FBO account.



67
68
69
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 67

def direction
  @direction
end

#event_idInteger

Plaid’s unique identifier for this event. IDs are sequential unsigned 64-bit integers.

Returns:

  • (Integer)


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

def event_id
  @event_id
end

#event_typeBankTransferEventType

The type of event that this bank transfer represents. ‘pending`: A new transfer was created; it is in the pending state. `cancelled`: The transfer was cancelled by the client. `failed`: The transfer failed, no funds were moved. `posted`: The transfer has been successfully submitted to the payment network. `reversed`: A posted transfer was reversed.



31
32
33
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 31

def event_type
  @event_type
end

#failure_reasonBankTransferFailure

The failure reason if the type of this transfer is ‘“failed”` or `“reversed”`. Null value otherwise.

Returns:



62
63
64
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 62

def failure_reason
  @failure_reason
end

#origination_account_idString

The ID of the origination account that this balance belongs to.

Returns:

  • (String)


43
44
45
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 43

def 
  @origination_account_id
end

#timestampDateTime

The datetime when this event occurred. This will be of the form ‘2006-01-02T15:04:05Z`.

Returns:

  • (DateTime)


21
22
23
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 21

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  event_id = hash.key?('event_id') ? hash['event_id'] : nil
  timestamp = if hash.key?('timestamp')
                (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
              end
  event_type = hash.key?('event_type') ? hash['event_type'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
  bank_transfer_id =
    hash.key?('bank_transfer_id') ? hash['bank_transfer_id'] : nil
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : nil
  bank_transfer_type =
    hash.key?('bank_transfer_type') ? hash['bank_transfer_type'] : nil
  bank_transfer_amount =
    hash.key?('bank_transfer_amount') ? hash['bank_transfer_amount'] : nil
  bank_transfer_iso_currency_code =
    hash.key?('bank_transfer_iso_currency_code') ? hash['bank_transfer_iso_currency_code'] : nil
  failure_reason = BankTransferFailure.from_hash(hash['failure_reason']) if
    hash['failure_reason']
  direction = hash.key?('direction') ? hash['direction'] : 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.
  BankTransferEvent.new(event_id: event_id,
                        timestamp: timestamp,
                        event_type: event_type,
                        account_id: ,
                        bank_transfer_id: bank_transfer_id,
                        origination_account_id: ,
                        bank_transfer_type: bank_transfer_type,
                        bank_transfer_amount: bank_transfer_amount,
                        bank_transfer_iso_currency_code: bank_transfer_iso_currency_code,
                        failure_reason: failure_reason,
                        direction: direction,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 70

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['event_id'] = 'event_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash['event_type'] = 'event_type'
  @_hash['account_id'] = 'account_id'
  @_hash['bank_transfer_id'] = 'bank_transfer_id'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash['bank_transfer_type'] = 'bank_transfer_type'
  @_hash['bank_transfer_amount'] = 'bank_transfer_amount'
  @_hash['bank_transfer_iso_currency_code'] =
    'bank_transfer_iso_currency_code'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['direction'] = 'direction'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
96
97
98
99
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 93

def self.nullables
  %w[
    origination_account_id
    failure_reason
    direction
  ]
end

.optionalsObject

An array for optional fields



88
89
90
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 88

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
194
195
196
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 187

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} event_id: #{@event_id.inspect}, timestamp: #{@timestamp.inspect},"\
  " event_type: #{@event_type.inspect}, account_id: #{@account_id.inspect}, bank_transfer_id:"\
  " #{@bank_transfer_id.inspect}, origination_account_id: #{@origination_account_id.inspect},"\
  " bank_transfer_type: #{@bank_transfer_type.inspect}, bank_transfer_amount:"\
  " #{@bank_transfer_amount.inspect}, bank_transfer_iso_currency_code:"\
  " #{@bank_transfer_iso_currency_code.inspect}, failure_reason: #{@failure_reason.inspect},"\
  " direction: #{@direction.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_timestampObject



170
171
172
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 170

def to_custom_timestamp
  DateTimeHelper.to_rfc3339(timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



175
176
177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/bank_transfer_event.rb', line 175

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} event_id: #{@event_id}, timestamp: #{@timestamp}, event_type:"\
  " #{@event_type}, account_id: #{@account_id}, bank_transfer_id: #{@bank_transfer_id},"\
  " origination_account_id: #{@origination_account_id}, bank_transfer_type:"\
  " #{@bank_transfer_type}, bank_transfer_amount: #{@bank_transfer_amount},"\
  " bank_transfer_iso_currency_code: #{@bank_transfer_iso_currency_code}, failure_reason:"\
  " #{@failure_reason}, direction: #{@direction}, additional_properties:"\
  " #{@additional_properties}>"
end