Class: ThePlaidApi::BankTransferFailure

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

Overview

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

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(ach_return_code: SKIP, description: SKIP, additional_properties: nil) ⇒ BankTransferFailure

Returns a new instance of BankTransferFailure.



47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 47

def initialize(ach_return_code: SKIP, description: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ach_return_code = ach_return_code unless ach_return_code == SKIP
  @description = description unless description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#ach_return_codeString

The ACH return code, e.g. ‘R01`. A return code will be provided if and only if the transfer status is `reversed`. For a full listing of ACH return codes, see [Bank Transfers errors](plaid.com/docs/errors/bank-transfers/#ach-return-codes).

Returns:

  • (String)


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

def ach_return_code
  @ach_return_code
end

#descriptionString

A human-readable description of the reason for the failure or reversal.

Returns:

  • (String)


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

def description
  @description
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ach_return_code =
    hash.key?('ach_return_code') ? hash['ach_return_code'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP

  # 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.
  BankTransferFailure.new(ach_return_code: ach_return_code,
                          description: description,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ach_return_code'] = 'ach_return_code'
  @_hash['description'] = 'description'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
44
45
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 41

def self.nullables
  %w[
    ach_return_code
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    ach_return_code
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 87

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

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
# File 'lib/the_plaid_api/models/bank_transfer_failure.rb', line 80

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