Class: ModernTreasury::CounterpartyCreateRequest

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

Overview

CounterpartyCreateRequest 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 = nil, accounts = SKIP, email = SKIP, metadata = SKIP, send_remittance_advice = SKIP, verification_status = SKIP, accounting = SKIP, ledger_type = SKIP, taxpayer_identifier = SKIP) ⇒ CounterpartyCreateRequest

Returns a new instance of CounterpartyCreateRequest.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 88

def initialize(name = nil, accounts = SKIP, email = SKIP,  = SKIP,
               send_remittance_advice = SKIP, verification_status = SKIP,
               accounting = SKIP, ledger_type = SKIP,
               taxpayer_identifier = SKIP)
  @name = name
  @accounts = accounts unless accounts == SKIP
  @email = email unless email == SKIP
  @metadata =  unless  == SKIP
  @send_remittance_advice = send_remittance_advice unless send_remittance_advice == SKIP
  @verification_status = verification_status unless verification_status == SKIP
  @accounting = accounting unless accounting == SKIP
  @ledger_type = ledger_type unless ledger_type == SKIP
  @taxpayer_identifier = taxpayer_identifier unless taxpayer_identifier == SKIP
end

Instance Attribute Details

#accountingAccounting1

The verification status of the counterparty.

Returns:



40
41
42
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 40

def accounting
  @accounting
end

#accountsArray[Account1]

The accounts for this counterparty.

Returns:



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

def accounts
  @accounts
end

#emailString

The counterparty’s email.

Returns:

  • (String)


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

def email
  @email
end

#ledger_typeLedgerTypeEnum

An optional type to auto-sync the counterparty to your ledger. Either ‘customer` or `vendor`.

Returns:



45
46
47
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 45

def ledger_type
  @ledger_type
end

#metadataHash[String, String]

Additional data represented as key-value pairs. Both the key and value must be strings.

Returns:

  • (Hash[String, String])


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

def 
  @metadata
end

#nameString

A human friendly name for this counterparty.

Returns:

  • (String)


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

def name
  @name
end

#send_remittance_adviceTrueClass | FalseClass

Send an email to the counterparty whenever an associated payment order is sent to the bank.

Returns:

  • (TrueClass | FalseClass)


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

def send_remittance_advice
  @send_remittance_advice
end

#taxpayer_identifierString

Either a valid SSN or EIN.

Returns:

  • (String)


49
50
51
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 49

def taxpayer_identifier
  @taxpayer_identifier
end

#verification_statusVerificationStatus1Enum

The verification status of the counterparty.



36
37
38
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 36

def verification_status
  @verification_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['accounts'].nil?
    accounts = []
    hash['accounts'].each do |structure|
      accounts << (Account1.from_hash(structure) if structure)
    end
  end

  accounts = SKIP unless hash.key?('accounts')
  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
  verification_status =
    hash.key?('verification_status') ? hash['verification_status'] : SKIP
  accounting = Accounting1.from_hash(hash['accounting']) if hash['accounting']
  ledger_type = hash.key?('ledger_type') ? hash['ledger_type'] : SKIP
  taxpayer_identifier =
    hash.key?('taxpayer_identifier') ? hash['taxpayer_identifier'] : SKIP

  # Create object from extracted values.
  CounterpartyCreateRequest.new(name,
                                accounts,
                                email,
                                ,
                                send_remittance_advice,
                                verification_status,
                                accounting,
                                ledger_type,
                                taxpayer_identifier)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



81
82
83
84
85
86
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 81

def self.nullables
  %w[
    name
    email
  ]
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 67

def self.optionals
  %w[
    accounts
    email
    metadata
    send_remittance_advice
    verification_status
    accounting
    ledger_type
    taxpayer_identifier
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
159
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 152

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

#to_sObject

Provides a human-readable string representation of the object.



143
144
145
146
147
148
149
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 143

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