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) ⇒ ExternalAccountUpdateRequest

Returns a new instance of ExternalAccountUpdateRequest.



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

def initialize(party_type = SKIP,  = SKIP,
               counterparty_id = SKIP, name = SKIP, party_name = SKIP,
               party_address = SKIP,  = SKIP)
  @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
end

Instance Attribute Details

#account_typeAccountTypeEnum

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_typePartyTypeEnum

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.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 92

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 object from extracted values.
  ExternalAccountUpdateRequest.new(party_type,
                                   ,
                                   counterparty_id,
                                   name,
                                   party_name,
                                   party_address,
                                   )
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.



124
125
126
127
128
129
130
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 124

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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/modern_treasury/models/external_account_update_request.rb', line 116

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}>"
end