Class: ModernTreasury::InternalAccountUpdateRequest

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

Overview

InternalAccountUpdateRequest 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(name: SKIP, metadata: SKIP, parent_account_id: SKIP, counterparty_id: SKIP, additional_properties: nil) ⇒ InternalAccountUpdateRequest

Returns a new instance of InternalAccountUpdateRequest.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 54

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

  @name = name unless name == SKIP
  @metadata =  unless  == SKIP
  @parent_account_id =  unless  == SKIP
  @counterparty_id = counterparty_id unless counterparty_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#counterparty_idString

The Counterparty associated to this account.

Returns:

  • (String)


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

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])


19
20
21
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 19

def 
  @metadata
end

#nameString

The nickname for the internal account.

Returns:

  • (String)


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

def name
  @name
end

#parent_account_idString

The parent internal account for this account.

Returns:

  • (String)


23
24
25
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 23

def 
  @parent_account_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
   = hash.key?('metadata') ? hash['metadata'] : SKIP
   =
    hash.key?('parent_account_id') ? hash['parent_account_id'] : SKIP
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : 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.
  InternalAccountUpdateRequest.new(name: name,
                                   metadata: ,
                                   parent_account_id: ,
                                   counterparty_id: counterparty_id,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['metadata'] = 'metadata'
  @_hash['parent_account_id'] = 'parent_account_id'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 40

def self.optionals
  %w[
    name
    metadata
    parent_account_id
    counterparty_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



94
95
96
97
98
99
# File 'lib/modern_treasury/models/internal_account_update_request.rb', line 94

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