Class: ModernTreasury::CounterpartyUpdateRequest

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

Overview

CounterpartyUpdateRequest 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, email: SKIP, metadata: SKIP, send_remittance_advice: SKIP, taxpayer_identifier: SKIP, additional_properties: nil) ⇒ CounterpartyUpdateRequest

Returns a new instance of CounterpartyUpdateRequest.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 61

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

  @name = name unless name == SKIP
  @email = email unless email == SKIP
  @metadata =  unless  == SKIP
  @send_remittance_advice = send_remittance_advice unless send_remittance_advice == SKIP
  @taxpayer_identifier = taxpayer_identifier unless taxpayer_identifier == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#emailString

A new email for the counterparty.

Returns:

  • (String)


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

def email
  @email
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])


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

def 
  @metadata
end

#nameString

A new name for the counterparty. Will only update if passed.

Returns:

  • (String)


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

def name
  @name
end

#send_remittance_adviceTrueClass | FalseClass

If this is ‘true`, Modern Treasury will send an email to the counterparty whenever an associated payment order is sent to the bank.

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 28

def send_remittance_advice
  @send_remittance_advice
end

#taxpayer_identifierString

Either a valid SSN or EIN.

Returns:

  • (String)


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

def taxpayer_identifier
  @taxpayer_identifier
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 76

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['email'] = 'email'
  @_hash['metadata'] = 'metadata'
  @_hash['send_remittance_advice'] = 'send_remittance_advice'
  @_hash['taxpayer_identifier'] = 'taxpayer_identifier'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    name
    email
    metadata
    send_remittance_advice
    taxpayer_identifier
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
119
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 113

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

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
# File 'lib/modern_treasury/models/counterparty_update_request.rb', line 105

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