Class: ModernTreasury::Counterparty
- Defined in:
- lib/modern_treasury/models/counterparty.rb
Overview
Counterparty Model.
Instance Attribute Summary collapse
-
#accounts ⇒ Array[Account]
The accounts for this counterparty.
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#discarded_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#email ⇒ String
The counterparty’s email.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
A human friendly name for this counterparty.
-
#object ⇒ String
TODO: Write general description for this method.
-
#send_remittance_advice ⇒ TrueClass | FalseClass
Send an email to the counterparty whenever an associated payment order is sent to the bank.
-
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#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(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, name:, accounts:, email:, metadata:, send_remittance_advice:, verification_status:) ⇒ Counterparty
constructor
A new instance of Counterparty.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_discarded_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#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(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, name:, accounts:, email:, metadata:, send_remittance_advice:, verification_status:) ⇒ Counterparty
Returns a new instance of Counterparty.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/modern_treasury/models/counterparty.rb', line 99 def initialize(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, name:, accounts:, email:, metadata:, send_remittance_advice:, verification_status:) @id = id @object = object @live_mode = live_mode @created_at = created_at @updated_at = updated_at @discarded_at = discarded_at @name = name @accounts = accounts @email = email @metadata = @send_remittance_advice = send_remittance_advice @verification_status = verification_status end |
Instance Attribute Details
#accounts ⇒ Array[Account]
The accounts for this counterparty.
47 48 49 |
# File 'lib/modern_treasury/models/counterparty.rb', line 47 def accounts @accounts end |
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/counterparty.rb', line 29 def created_at @created_at end |
#discarded_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
39 40 41 |
# File 'lib/modern_treasury/models/counterparty.rb', line 39 def discarded_at @discarded_at end |
#email ⇒ String
The counterparty’s email.
51 52 53 |
# File 'lib/modern_treasury/models/counterparty.rb', line 51 def email @email end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/counterparty.rb', line 15 def id @id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/counterparty.rb', line 24 def live_mode @live_mode end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
56 57 58 |
# File 'lib/modern_treasury/models/counterparty.rb', line 56 def @metadata end |
#name ⇒ String
A human friendly name for this counterparty.
43 44 45 |
# File 'lib/modern_treasury/models/counterparty.rb', line 43 def name @name end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/counterparty.rb', line 19 def object @object end |
#send_remittance_advice ⇒ TrueClass | FalseClass
Send an email to the counterparty whenever an associated payment order is sent to the bank.
61 62 63 |
# File 'lib/modern_treasury/models/counterparty.rb', line 61 def send_remittance_advice @send_remittance_advice end |
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
34 35 36 |
# File 'lib/modern_treasury/models/counterparty.rb', line 34 def updated_at @updated_at end |
#verification_status ⇒ VerificationStatus1
The verification status of the counterparty.
65 66 67 |
# File 'lib/modern_treasury/models/counterparty.rb', line 65 def verification_status @verification_status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/modern_treasury/models/counterparty.rb', line 117 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil object = hash.key?('object') ? hash['object'] : nil live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end discarded_at = if hash.key?('discarded_at') (DateTimeHelper.from_rfc3339(hash['discarded_at']) if hash['discarded_at']) end 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 << (Account.from_hash(structure) if structure) end end accounts = nil unless hash.key?('accounts') email = hash.key?('email') ? hash['email'] : nil = hash.key?('metadata') ? hash['metadata'] : nil send_remittance_advice = hash.key?('send_remittance_advice') ? hash['send_remittance_advice'] : nil verification_status = hash.key?('verification_status') ? hash['verification_status'] : nil # Create object from extracted values. Counterparty.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, discarded_at: discarded_at, name: name, accounts: accounts, email: email, metadata: , send_remittance_advice: send_remittance_advice, verification_status: verification_status) end |
.names ⇒ Object
A mapping from model property names to API property names.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/modern_treasury/models/counterparty.rb', line 68 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['discarded_at'] = 'discarded_at' @_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 end |
.nullables ⇒ Object
An array for nullable fields
91 92 93 94 95 96 97 |
# File 'lib/modern_treasury/models/counterparty.rb', line 91 def self.nullables %w[ discarded_at name email ] end |
.optionals ⇒ Object
An array for optional fields
86 87 88 |
# File 'lib/modern_treasury/models/counterparty.rb', line 86 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
189 190 191 192 193 194 195 196 197 |
# File 'lib/modern_treasury/models/counterparty.rb', line 189 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, discarded_at: #{@discarded_at.inspect}, name: #{@name.inspect},"\ " accounts: #{@accounts.inspect}, email: #{@email.inspect}, metadata: #{@metadata.inspect},"\ " send_remittance_advice: #{@send_remittance_advice.inspect}, verification_status:"\ " #{@verification_status.inspect}>" end |
#to_custom_created_at ⇒ Object
166 167 168 |
# File 'lib/modern_treasury/models/counterparty.rb', line 166 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_discarded_at ⇒ Object
174 175 176 |
# File 'lib/modern_treasury/models/counterparty.rb', line 174 def to_custom_discarded_at DateTimeHelper.to_rfc3339(discarded_at) end |
#to_custom_updated_at ⇒ Object
170 171 172 |
# File 'lib/modern_treasury/models/counterparty.rb', line 170 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
179 180 181 182 183 184 185 186 |
# File 'lib/modern_treasury/models/counterparty.rb', line 179 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, discarded_at: #{@discarded_at}, name:"\ " #{@name}, accounts: #{@accounts}, email: #{@email}, metadata: #{@metadata},"\ " send_remittance_advice: #{@send_remittance_advice}, verification_status:"\ " #{@verification_status}>" end |