Class: ThePlaidApi::WalletTransactionCounterparty

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

Overview

An object representing the e-wallet transaction’s counterparty

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(name:, numbers:, address: SKIP, date_of_birth: SKIP, additional_properties: nil) ⇒ WalletTransactionCounterparty

Returns a new instance of WalletTransactionCounterparty.



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 57

def initialize(name:, numbers:, address: SKIP, date_of_birth: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name
  @numbers = numbers
  @address = address unless address == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressPaymentInitiationAddress

The optional address of the payment recipient’s bank account. Required by most institutions outside of the UK.



24
25
26
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 24

def address
  @address
end

#date_of_birthDate

The counterparty’s birthdate, in [ISO 8601](wikipedia.org/wiki/ISO_8601) (YYYY-MM-DD) format.

Returns:

  • (Date)


29
30
31
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 29

def date_of_birth
  @date_of_birth
end

#nameString

The name of the counterparty

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 14

def name
  @name
end

#numbersWalletTransactionCounterpartyNumbers

The counterparty’s bank account numbers. Exactly one of IBAN or BACS data is required.



19
20
21
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 19

def numbers
  @numbers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  numbers = WalletTransactionCounterpartyNumbers.from_hash(hash['numbers']) if hash['numbers']
  address = PaymentInitiationAddress.from_hash(hash['address']) if hash['address']
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : 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.
  WalletTransactionCounterparty.new(name: name,
                                    numbers: numbers,
                                    address: address,
                                    date_of_birth: date_of_birth,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['numbers'] = 'numbers'
  @_hash['address'] = 'address'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
53
54
55
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 50

def self.nullables
  %w[
    address
    date_of_birth
  ]
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 42

def self.optionals
  %w[
    address
    date_of_birth
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
107
# File 'lib/the_plaid_api/models/wallet_transaction_counterparty.rb', line 102

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

#to_sObject

Provides a human-readable string representation of the object.



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

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