Class: ThePlaidApi::TransferRepayment

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

Overview

A repayment is created automatically after one or more guaranteed transactions receive a return. If there are multiple eligible returns in a day, they are batched together into a single repayment. Repayments are sent over ACH, with funds typically available on the next banking day.

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(repayment_id:, created:, amount:, iso_currency_code:, additional_properties: nil) ⇒ TransferRepayment

Returns a new instance of TransferRepayment.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 52

def initialize(repayment_id:, created:, amount:, iso_currency_code:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @repayment_id = repayment_id
  @created = created
  @amount = amount
  @iso_currency_code = iso_currency_code
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountString

Decimal amount of the repayment as it appears on your account ledger.

Returns:

  • (String)


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

def amount
  @amount
end

#createdDateTime

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

Returns:

  • (DateTime)


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

def created
  @created
end

#iso_currency_codeString

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

Returns:

  • (String)


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

def iso_currency_code
  @iso_currency_code
end

#repayment_idString

Identifier of the repayment.

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 18

def repayment_id
  @repayment_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  repayment_id = hash.key?('repayment_id') ? hash['repayment_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

  # 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.
  TransferRepayment.new(repayment_id: repayment_id,
                        created: created,
                        amount: amount,
                        iso_currency_code: iso_currency_code,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['repayment_id'] = 'repayment_id'
  @_hash['created'] = 'created'
  @_hash['amount'] = 'amount'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
110
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} repayment_id: #{@repayment_id.inspect}, created: #{@created.inspect},"\
  " amount: #{@amount.inspect}, iso_currency_code: #{@iso_currency_code.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_createdObject



92
93
94
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 92

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
102
# File 'lib/the_plaid_api/models/transfer_repayment.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} repayment_id: #{@repayment_id}, created: #{@created}, amount: #{@amount},"\
  " iso_currency_code: #{@iso_currency_code}, additional_properties:"\
  " #{@additional_properties}>"
end