Class: Weft::Payment
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Weft::Payment
- Defined in:
- lib/weft/generated/models/payment.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Amount in atomic units (1 USDC = 1,000,000).
-
#amount_formatted ⇒ Object
Human-readable amount (e.g. "1.00 USDC").
-
#api_key_name ⇒ Object
Returns the value of attribute api_key_name.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#fee_amount ⇒ Object
Returns the value of attribute fee_amount.
-
#id ⇒ Object
Returns the value of attribute id.
-
#network ⇒ Object
CAIP-2 chain identifier.
-
#payer_address ⇒ Object
Returns the value of attribute payer_address.
-
#recipient_address ⇒ Object
Returns the value of attribute recipient_address.
-
#resource_host ⇒ Object
Returns the value of attribute resource_host.
-
#resource_url ⇒ Object
Returns the value of attribute resource_url.
-
#settled_at ⇒ Object
Returns the value of attribute settled_at.
-
#settlement_latency_ms ⇒ Object
Returns the value of attribute settlement_latency_ms.
-
#tx_hash ⇒ Object
Returns the value of attribute tx_hash.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Payment
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Payment
Initializes the object
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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 |
# File 'lib/weft/generated/models/payment.rb', line 107 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::Payment` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::Payment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'tx_hash') self.tx_hash = attributes[:'tx_hash'] else self.tx_hash = nil end if attributes.key?(:'payer_address') self.payer_address = attributes[:'payer_address'] else self.payer_address = nil end if attributes.key?(:'recipient_address') self.recipient_address = attributes[:'recipient_address'] else self.recipient_address = nil end if attributes.key?(:'amount') self.amount = attributes[:'amount'] else self.amount = nil end if attributes.key?(:'amount_formatted') self.amount_formatted = attributes[:'amount_formatted'] else self.amount_formatted = nil end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = nil end if attributes.key?(:'network') self.network = attributes[:'network'] else self.network = nil end if attributes.key?(:'resource_url') self.resource_url = attributes[:'resource_url'] end if attributes.key?(:'resource_host') self.resource_host = attributes[:'resource_host'] end if attributes.key?(:'fee_amount') self.fee_amount = attributes[:'fee_amount'] end if attributes.key?(:'settlement_latency_ms') self.settlement_latency_ms = attributes[:'settlement_latency_ms'] end if attributes.key?(:'settled_at') self.settled_at = attributes[:'settled_at'] else self.settled_at = nil end if attributes.key?(:'api_key_name') self.api_key_name = attributes[:'api_key_name'] else self.api_key_name = nil end end |
Instance Attribute Details
#amount ⇒ Object
Amount in atomic units (1 USDC = 1,000,000)
27 28 29 |
# File 'lib/weft/generated/models/payment.rb', line 27 def amount @amount end |
#amount_formatted ⇒ Object
Human-readable amount (e.g. "1.00 USDC")
30 31 32 |
# File 'lib/weft/generated/models/payment.rb', line 30 def amount_formatted @amount_formatted end |
#api_key_name ⇒ Object
Returns the value of attribute api_key_name.
47 48 49 |
# File 'lib/weft/generated/models/payment.rb', line 47 def api_key_name @api_key_name end |
#currency ⇒ Object
Returns the value of attribute currency.
32 33 34 |
# File 'lib/weft/generated/models/payment.rb', line 32 def currency @currency end |
#fee_amount ⇒ Object
Returns the value of attribute fee_amount.
41 42 43 |
# File 'lib/weft/generated/models/payment.rb', line 41 def fee_amount @fee_amount end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/weft/generated/models/payment.rb', line 18 def id @id end |
#network ⇒ Object
CAIP-2 chain identifier
35 36 37 |
# File 'lib/weft/generated/models/payment.rb', line 35 def network @network end |
#payer_address ⇒ Object
Returns the value of attribute payer_address.
22 23 24 |
# File 'lib/weft/generated/models/payment.rb', line 22 def payer_address @payer_address end |
#recipient_address ⇒ Object
Returns the value of attribute recipient_address.
24 25 26 |
# File 'lib/weft/generated/models/payment.rb', line 24 def recipient_address @recipient_address end |
#resource_host ⇒ Object
Returns the value of attribute resource_host.
39 40 41 |
# File 'lib/weft/generated/models/payment.rb', line 39 def resource_host @resource_host end |
#resource_url ⇒ Object
Returns the value of attribute resource_url.
37 38 39 |
# File 'lib/weft/generated/models/payment.rb', line 37 def resource_url @resource_url end |
#settled_at ⇒ Object
Returns the value of attribute settled_at.
45 46 47 |
# File 'lib/weft/generated/models/payment.rb', line 45 def settled_at @settled_at end |
#settlement_latency_ms ⇒ Object
Returns the value of attribute settlement_latency_ms.
43 44 45 |
# File 'lib/weft/generated/models/payment.rb', line 43 def settlement_latency_ms @settlement_latency_ms end |
#tx_hash ⇒ Object
Returns the value of attribute tx_hash.
20 21 22 |
# File 'lib/weft/generated/models/payment.rb', line 20 def tx_hash @tx_hash end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
70 71 72 |
# File 'lib/weft/generated/models/payment.rb', line 70 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
75 76 77 |
# File 'lib/weft/generated/models/payment.rb', line 75 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/weft/generated/models/payment.rb', line 50 def self.attribute_map { :'id' => :'id', :'tx_hash' => :'tx_hash', :'payer_address' => :'payer_address', :'recipient_address' => :'recipient_address', :'amount' => :'amount', :'amount_formatted' => :'amount_formatted', :'currency' => :'currency', :'network' => :'network', :'resource_url' => :'resource_url', :'resource_host' => :'resource_host', :'fee_amount' => :'fee_amount', :'settlement_latency_ms' => :'settlement_latency_ms', :'settled_at' => :'settled_at', :'api_key_name' => :'api_key_name' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/weft/generated/models/payment.rb', line 399 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
100 101 102 103 |
# File 'lib/weft/generated/models/payment.rb', line 100 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/weft/generated/models/payment.rb', line 80 def self.openapi_types { :'id' => :'Integer', :'tx_hash' => :'String', :'payer_address' => :'String', :'recipient_address' => :'String', :'amount' => :'Integer', :'amount_formatted' => :'String', :'currency' => :'String', :'network' => :'String', :'resource_url' => :'String', :'resource_host' => :'String', :'fee_amount' => :'Integer', :'settlement_latency_ms' => :'Integer', :'settled_at' => :'Time', :'api_key_name' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/weft/generated/models/payment.rb', line 365 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && tx_hash == o.tx_hash && payer_address == o.payer_address && recipient_address == o.recipient_address && amount == o.amount && amount_formatted == o.amount_formatted && currency == o.currency && network == o.network && resource_url == o.resource_url && resource_host == o.resource_host && fee_amount == o.fee_amount && settlement_latency_ms == o.settlement_latency_ms && settled_at == o.settled_at && api_key_name == o.api_key_name end |
#eql?(o) ⇒ Boolean
386 387 388 |
# File 'lib/weft/generated/models/payment.rb', line 386 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
392 393 394 |
# File 'lib/weft/generated/models/payment.rb', line 392 def hash [id, tx_hash, payer_address, recipient_address, amount, amount_formatted, currency, network, resource_url, resource_host, fee_amount, settlement_latency_ms, settled_at, api_key_name].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/weft/generated/models/payment.rb', line 200 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @tx_hash.nil? invalid_properties.push('invalid value for "tx_hash", tx_hash cannot be nil.') end if @payer_address.nil? invalid_properties.push('invalid value for "payer_address", payer_address cannot be nil.') end if @recipient_address.nil? invalid_properties.push('invalid value for "recipient_address", recipient_address cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end if @amount_formatted.nil? invalid_properties.push('invalid value for "amount_formatted", amount_formatted cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @network.nil? invalid_properties.push('invalid value for "network", network cannot be nil.') end if @settled_at.nil? invalid_properties.push('invalid value for "settled_at", settled_at cannot be nil.') end if @api_key_name.nil? invalid_properties.push('invalid value for "api_key_name", api_key_name cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/weft/generated/models/payment.rb', line 421 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/weft/generated/models/payment.rb', line 248 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @tx_hash.nil? return false if @payer_address.nil? return false if @recipient_address.nil? return false if @amount.nil? return false if @amount_formatted.nil? return false if @currency.nil? return false if @network.nil? return false if @settled_at.nil? return false if @api_key_name.nil? true end |