Class: ModernTreasury::RoutingDetail
- Defined in:
- lib/modern_treasury/models/routing_detail.rb
Overview
RoutingDetail Model.
Instance Attribute Summary collapse
-
#bank_address ⇒ Address
The name of the bank.
-
#bank_name ⇒ String
The name of the bank.
-
#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.
-
#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.
-
#object ⇒ String
TODO: Write general description for this method.
-
#payment_type ⇒ PaymentType1
If the routing detail is to be used for a specific payment type this field will be populated, otherwise null.
-
#routing_number ⇒ String
The routing number of the bank.
-
#routing_number_type ⇒ RoutingNumberType
One of ‘aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.
-
#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.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, routing_number:, routing_number_type:, payment_type:, bank_name:, bank_address:) ⇒ RoutingDetail
constructor
A new instance of RoutingDetail.
-
#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:, routing_number:, routing_number_type:, payment_type:, bank_name:, bank_address:) ⇒ RoutingDetail
Returns a new instance of RoutingDetail.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 94 def initialize(id:, object:, live_mode:, created_at:, updated_at:, discarded_at:, routing_number:, routing_number_type:, payment_type:, bank_name:, bank_address:) @id = id @object = object @live_mode = live_mode @created_at = created_at @updated_at = updated_at @discarded_at = discarded_at @routing_number = routing_number @routing_number_type = routing_number_type @payment_type = payment_type @bank_name = bank_name @bank_address = bank_address end |
Instance Attribute Details
#bank_address ⇒ Address
The name of the bank.
61 62 63 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 61 def bank_address @bank_address end |
#bank_name ⇒ String
The name of the bank.
57 58 59 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 57 def bank_name @bank_name 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/routing_detail.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/routing_detail.rb', line 39 def discarded_at @discarded_at end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/routing_detail.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/routing_detail.rb', line 24 def live_mode @live_mode end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 19 def object @object end |
#payment_type ⇒ PaymentType1
If the routing detail is to be used for a specific payment type this field will be populated, otherwise null.
53 54 55 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 53 def payment_type @payment_type end |
#routing_number ⇒ String
The routing number of the bank.
43 44 45 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 43 def routing_number @routing_number end |
#routing_number_type ⇒ RoutingNumberType
One of ‘aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.
48 49 50 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 48 def routing_number_type @routing_number_type 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/routing_detail.rb', line 34 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 111 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 routing_number = hash.key?('routing_number') ? hash['routing_number'] : nil routing_number_type = hash.key?('routing_number_type') ? hash['routing_number_type'] : nil payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil bank_name = hash.key?('bank_name') ? hash['bank_name'] : nil bank_address = Address.from_hash(hash['bank_address']) if hash['bank_address'] # Create object from extracted values. RoutingDetail.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, discarded_at: discarded_at, routing_number: routing_number, routing_number_type: routing_number_type, payment_type: payment_type, bank_name: bank_name, bank_address: bank_address) end |
.names ⇒ Object
A mapping from model property names to API property names.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 64 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['routing_number'] = 'routing_number' @_hash['routing_number_type'] = 'routing_number_type' @_hash['payment_type'] = 'payment_type' @_hash['bank_name'] = 'bank_name' @_hash['bank_address'] = 'bank_address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 89 90 91 92 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 86 def self.nullables %w[ discarded_at payment_type bank_address ] end |
.optionals ⇒ Object
An array for optional fields
81 82 83 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 81 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 163 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.object, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.live_mode, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value.created_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.updated_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.discarded_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.routing_number, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.routing_number_type, ->(val) { RoutingNumberType.validate(val) }) and APIHelper.valid_type?(value.payment_type, ->(val) { PaymentType1.validate(val) }) and APIHelper.valid_type?(value.bank_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.bank_address, ->(val) { Address.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['object'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['live_mode'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value['created_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['updated_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['discarded_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['routing_number'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['routing_number_type'], ->(val) { RoutingNumberType.validate(val) }) and APIHelper.valid_type?(value['payment_type'], ->(val) { PaymentType1.validate(val) }) and APIHelper.valid_type?(value['bank_name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['bank_address'], ->(val) { Address.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
231 232 233 234 235 236 237 238 239 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 231 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}, routing_number:"\ " #{@routing_number.inspect}, routing_number_type: #{@routing_number_type.inspect},"\ " payment_type: #{@payment_type.inspect}, bank_name: #{@bank_name.inspect}, bank_address:"\ " #{@bank_address.inspect}>" end |
#to_custom_created_at ⇒ Object
149 150 151 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 149 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_discarded_at ⇒ Object
157 158 159 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 157 def to_custom_discarded_at DateTimeHelper.to_rfc3339(discarded_at) end |
#to_custom_updated_at ⇒ Object
153 154 155 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 153 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
222 223 224 225 226 227 228 |
# File 'lib/modern_treasury/models/routing_detail.rb', line 222 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},"\ " routing_number: #{@routing_number}, routing_number_type: #{@routing_number_type},"\ " payment_type: #{@payment_type}, bank_name: #{@bank_name}, bank_address: #{@bank_address}>" end |