Class: ModernTreasury::CounterpartyCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::CounterpartyCreateRequest
- Defined in:
- lib/modern_treasury/models/counterparty_create_request.rb
Overview
CounterpartyCreateRequest Model.
Instance Attribute Summary collapse
-
#accounting ⇒ Accounting1
The verification status of the counterparty.
-
#accounts ⇒ Array[Account1]
The accounts for this counterparty.
-
#email ⇒ String
The counterparty’s email.
-
#ledger_type ⇒ LedgerType
An optional type to auto-sync the counterparty to your ledger.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
A human friendly name for this counterparty.
-
#send_remittance_advice ⇒ TrueClass | FalseClass
Send an email to the counterparty whenever an associated payment order is sent to the bank.
-
#taxpayer_identifier ⇒ String
Either a valid SSN or EIN.
-
#verification_status ⇒ VerificationStatus1
The verification status of the counterparty.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name:, accounts: SKIP, email: SKIP, metadata: SKIP, send_remittance_advice: SKIP, verification_status: SKIP, accounting: SKIP, ledger_type: SKIP, taxpayer_identifier: SKIP, additional_properties: nil) ⇒ CounterpartyCreateRequest
constructor
A new instance of CounterpartyCreateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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:, accounts: SKIP, email: SKIP, metadata: SKIP, send_remittance_advice: SKIP, verification_status: SKIP, accounting: SKIP, ledger_type: SKIP, taxpayer_identifier: SKIP, additional_properties: nil) ⇒ CounterpartyCreateRequest
Returns a new instance of CounterpartyCreateRequest.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 88 def initialize(name:, accounts: SKIP, email: SKIP, metadata: SKIP, send_remittance_advice: SKIP, verification_status: SKIP, accounting: SKIP, ledger_type: SKIP, taxpayer_identifier: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @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 @additional_properties = additional_properties end |
Instance Attribute Details
#accounting ⇒ Accounting1
The verification status of the counterparty.
40 41 42 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 40 def accounting @accounting end |
#accounts ⇒ Array[Account1]
The accounts for this counterparty.
18 19 20 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 18 def accounts @accounts end |
#email ⇒ String
The counterparty’s email.
22 23 24 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 22 def email @email end |
#ledger_type ⇒ LedgerType
An optional type to auto-sync the counterparty to your ledger. Either ‘customer` or `vendor`.
45 46 47 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 45 def ledger_type @ledger_type end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
27 28 29 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 27 def @metadata end |
#name ⇒ String
A human friendly name for this counterparty.
14 15 16 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 14 def name @name end |
#send_remittance_advice ⇒ TrueClass | FalseClass
Send an email to the counterparty whenever an associated payment order is sent to the bank.
32 33 34 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 32 def send_remittance_advice @send_remittance_advice end |
#taxpayer_identifier ⇒ String
Either a valid SSN or EIN.
49 50 51 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 49 def taxpayer_identifier @taxpayer_identifier end |
#verification_status ⇒ VerificationStatus1
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.
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 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 108 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 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. CounterpartyCreateRequest.new(name: name, accounts: accounts, email: email, metadata: , send_remittance_advice: send_remittance_advice, verification_status: verification_status, accounting: accounting, ledger_type: ledger_type, taxpayer_identifier: taxpayer_identifier, additional_properties: additional_properties) end |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
165 166 167 168 169 170 171 172 173 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 165 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}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
155 156 157 158 159 160 161 162 |
# File 'lib/modern_treasury/models/counterparty_create_request.rb', line 155 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}, additional_properties:"\ " #{@additional_properties}>" end |