Class: ModernTreasury::ExternalAccountUpdateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/external_account_update_request.rb

Overview

ExternalAccountUpdateRequest Model.

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(party_type: SKIP, account_type: SKIP, counterparty_id: SKIP, name: SKIP, party_name: SKIP, party_address: SKIP, metadata: SKIP, additional_properties: nil) ⇒ ExternalAccountUpdateRequest

Returns a new instance of ExternalAccountUpdateRequest.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 79

def initialize(party_type: SKIP, account_type: SKIP, counterparty_id: SKIP,
               name: SKIP, party_name: SKIP, party_address: SKIP,
               metadata: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @party_type = party_type unless party_type == SKIP
  @account_type =  unless  == SKIP
  @counterparty_id = counterparty_id unless counterparty_id == SKIP
  @name = name unless name == SKIP
  @party_name = party_name unless party_name == SKIP
  @party_address = party_address unless party_address == SKIP
  @metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_typeAccountType

Can be ‘checking`, `savings` or `other`.

Returns:



18
19
20
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 18

def 
  @account_type
end

#counterparty_idUUID | String

Can be ‘checking`, `savings` or `other`.

Returns:

  • (UUID | String)


22
23
24
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 22

def counterparty_id
  @counterparty_id
end

#metadataHash[String, String]

Additional data in the form of key-value pairs. Pairs can be removed by passing an empty string or ‘null` as the value.

Returns:

  • (Hash[String, String])


42
43
44
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 42

def 
  @metadata
end

#nameString

A nickname for the external account. This is only for internal usage and won’t affect any payments

Returns:

  • (String)


27
28
29
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 27

def name
  @name
end

#party_addressAddressRequest

If this value isn’t provided, it will be inherited from the counterparty’s name.

Returns:



37
38
39
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 37

def party_address
  @party_address
end

#party_nameString

If this value isn’t provided, it will be inherited from the counterparty’s name.

Returns:

  • (String)


32
33
34
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 32

def party_name
  @party_name
end

#party_typePartyType

Either ‘individual` or `business`.

Returns:



14
15
16
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 14

def party_type
  @party_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  party_type = hash.key?('party_type') ? hash['party_type'] : SKIP
   = hash.key?('account_type') ? hash['account_type'] : SKIP
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  party_name = hash.key?('party_name') ? hash['party_name'] : SKIP
  party_address = AddressRequest.from_hash(hash['party_address']) if hash['party_address']
   = hash.key?('metadata') ? hash['metadata'] : 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.
  ExternalAccountUpdateRequest.new(party_type: party_type,
                                   account_type: ,
                                   counterparty_id: counterparty_id,
                                   name: name,
                                   party_name: party_name,
                                   party_address: party_address,
                                   metadata: ,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['party_type'] = 'party_type'
  @_hash['account_type'] = 'account_type'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['name'] = 'name'
  @_hash['party_name'] = 'party_name'
  @_hash['party_address'] = 'party_address'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
74
75
76
77
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 71

def self.nullables
  %w[
    party_type
    counterparty_id
    name
  ]
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 58

def self.optionals
  %w[
    party_type
    account_type
    counterparty_id
    name
    party_name
    party_address
    metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} party_type: #{@party_type.inspect}, account_type: #{@account_type.inspect},"\
  " counterparty_id: #{@counterparty_id.inspect}, name: #{@name.inspect}, party_name:"\
  " #{@party_name.inspect}, party_address: #{@party_address.inspect}, metadata:"\
  " #{@metadata.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
134
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} party_type: #{@party_type}, account_type: #{@account_type},"\
  " counterparty_id: #{@counterparty_id}, name: #{@name}, party_name: #{@party_name},"\
  " party_address: #{@party_address}, metadata: #{@metadata}, additional_properties:"\
  " #{@additional_properties}>"
end