Class: UltracartClient::OrderReplacement
- Inherits:
-
Object
- Object
- UltracartClient::OrderReplacement
- Defined in:
- lib/ultracart_api/models/order_replacement.rb
Instance Attribute Summary collapse
-
#additional_merchant_notes_new_order ⇒ Object
Additional merchant notes to append to the new order.
-
#additional_merchant_notes_original_order ⇒ Object
Additional merchant notes to append to the original order.
-
#custom_field1 ⇒ Object
Custom field 1.
-
#custom_field2 ⇒ Object
Custom field 2.
-
#custom_field3 ⇒ Object
Custom field 3.
-
#custom_field4 ⇒ Object
Custom field 4.
-
#custom_field5 ⇒ Object
Custom field 5.
-
#custom_field6 ⇒ Object
Custom field 6.
-
#custom_field7 ⇒ Object
Custom field 7.
-
#free ⇒ Object
Set to true if this replacement shipment should be free for the customer.
-
#immediate_charge ⇒ Object
Set to true if you want to immediately charge the payment on this order, otherwise it will go to Accounts Receivable.
-
#items ⇒ Object
Items to include in the replacement order.
-
#original_order_id ⇒ Object
Original order id.
-
#shipping_method ⇒ Object
Shipping method to use.
-
#skip_payment ⇒ Object
Set to true if you want to skip the payment as if it was successful.
Class Method Summary collapse
-
.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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ OrderReplacement
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ OrderReplacement
Initializes the object
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 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 118 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::OrderReplacement` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::OrderReplacement`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'additional_merchant_notes_new_order') self.additional_merchant_notes_new_order = attributes[:'additional_merchant_notes_new_order'] end if attributes.key?(:'additional_merchant_notes_original_order') self.additional_merchant_notes_original_order = attributes[:'additional_merchant_notes_original_order'] end if attributes.key?(:'custom_field1') self.custom_field1 = attributes[:'custom_field1'] end if attributes.key?(:'custom_field2') self.custom_field2 = attributes[:'custom_field2'] end if attributes.key?(:'custom_field3') self.custom_field3 = attributes[:'custom_field3'] end if attributes.key?(:'custom_field4') self.custom_field4 = attributes[:'custom_field4'] end if attributes.key?(:'custom_field5') self.custom_field5 = attributes[:'custom_field5'] end if attributes.key?(:'custom_field6') self.custom_field6 = attributes[:'custom_field6'] end if attributes.key?(:'custom_field7') self.custom_field7 = attributes[:'custom_field7'] end if attributes.key?(:'free') self.free = attributes[:'free'] end if attributes.key?(:'immediate_charge') self.immediate_charge = attributes[:'immediate_charge'] end if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end if attributes.key?(:'original_order_id') self.original_order_id = attributes[:'original_order_id'] end if attributes.key?(:'shipping_method') self.shipping_method = attributes[:'shipping_method'] end if attributes.key?(:'skip_payment') self.skip_payment = attributes[:'skip_payment'] end end |
Instance Attribute Details
#additional_merchant_notes_new_order ⇒ Object
Additional merchant notes to append to the new order
19 20 21 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 19 def additional_merchant_notes_new_order @additional_merchant_notes_new_order end |
#additional_merchant_notes_original_order ⇒ Object
Additional merchant notes to append to the original order
22 23 24 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 22 def additional_merchant_notes_original_order @additional_merchant_notes_original_order end |
#custom_field1 ⇒ Object
Custom field 1
25 26 27 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 25 def custom_field1 @custom_field1 end |
#custom_field2 ⇒ Object
Custom field 2
28 29 30 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 28 def custom_field2 @custom_field2 end |
#custom_field3 ⇒ Object
Custom field 3
31 32 33 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 31 def custom_field3 @custom_field3 end |
#custom_field4 ⇒ Object
Custom field 4
34 35 36 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 34 def custom_field4 @custom_field4 end |
#custom_field5 ⇒ Object
Custom field 5
37 38 39 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 37 def custom_field5 @custom_field5 end |
#custom_field6 ⇒ Object
Custom field 6
40 41 42 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 40 def custom_field6 @custom_field6 end |
#custom_field7 ⇒ Object
Custom field 7
43 44 45 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 43 def custom_field7 @custom_field7 end |
#free ⇒ Object
Set to true if this replacement shipment should be free for the customer.
46 47 48 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 46 def free @free end |
#immediate_charge ⇒ Object
Set to true if you want to immediately charge the payment on this order, otherwise it will go to Accounts Receivable.
49 50 51 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 49 def immediate_charge @immediate_charge end |
#items ⇒ Object
Items to include in the replacement order
52 53 54 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 52 def items @items end |
#original_order_id ⇒ Object
Original order id
55 56 57 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 55 def original_order_id @original_order_id end |
#shipping_method ⇒ Object
Shipping method to use. If not specified or invalid then least cost shipping will take place.
58 59 60 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 58 def shipping_method @shipping_method end |
#skip_payment ⇒ Object
Set to true if you want to skip the payment as if it was successful.
61 62 63 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 61 def skip_payment @skip_payment end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
85 86 87 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 85 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 64 def self.attribute_map { :'additional_merchant_notes_new_order' => :'additional_merchant_notes_new_order', :'additional_merchant_notes_original_order' => :'additional_merchant_notes_original_order', :'custom_field1' => :'custom_field1', :'custom_field2' => :'custom_field2', :'custom_field3' => :'custom_field3', :'custom_field4' => :'custom_field4', :'custom_field5' => :'custom_field5', :'custom_field6' => :'custom_field6', :'custom_field7' => :'custom_field7', :'free' => :'free', :'immediate_charge' => :'immediate_charge', :'items' => :'items', :'original_order_id' => :'original_order_id', :'shipping_method' => :'shipping_method', :'skip_payment' => :'skip_payment' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
349 350 351 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 349 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
111 112 113 114 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 111 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 90 def self.openapi_types { :'additional_merchant_notes_new_order' => :'String', :'additional_merchant_notes_original_order' => :'String', :'custom_field1' => :'String', :'custom_field2' => :'String', :'custom_field3' => :'String', :'custom_field4' => :'String', :'custom_field5' => :'String', :'custom_field6' => :'String', :'custom_field7' => :'String', :'free' => :'Boolean', :'immediate_charge' => :'Boolean', :'items' => :'Array<OrderReplacementItem>', :'original_order_id' => :'String', :'shipping_method' => :'String', :'skip_payment' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 314 def ==(o) return true if self.equal?(o) self.class == o.class && additional_merchant_notes_new_order == o.additional_merchant_notes_new_order && additional_merchant_notes_original_order == o.additional_merchant_notes_original_order && custom_field1 == o.custom_field1 && custom_field2 == o.custom_field2 && custom_field3 == o.custom_field3 && custom_field4 == o.custom_field4 && custom_field5 == o.custom_field5 && custom_field6 == o.custom_field6 && custom_field7 == o.custom_field7 && free == o.free && immediate_charge == o.immediate_charge && items == o.items && original_order_id == o.original_order_id && shipping_method == o.shipping_method && skip_payment == o.skip_payment end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 380 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = UltracartClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 451 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 356 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
336 337 338 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 336 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
342 343 344 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 342 def hash [additional_merchant_notes_new_order, additional_merchant_notes_original_order, custom_field1, custom_field2, custom_field3, custom_field4, custom_field5, custom_field6, custom_field7, free, immediate_charge, items, original_order_id, shipping_method, skip_payment].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
196 197 198 199 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 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 196 def list_invalid_properties invalid_properties = Array.new if !@custom_field1.nil? && @custom_field1.to_s.length > 50 invalid_properties.push('invalid value for "custom_field1", the character length must be smaller than or equal to 50.') end if !@custom_field2.nil? && @custom_field2.to_s.length > 50 invalid_properties.push('invalid value for "custom_field2", the character length must be smaller than or equal to 50.') end if !@custom_field3.nil? && @custom_field3.to_s.length > 50 invalid_properties.push('invalid value for "custom_field3", the character length must be smaller than or equal to 50.') end if !@custom_field4.nil? && @custom_field4.to_s.length > 50 invalid_properties.push('invalid value for "custom_field4", the character length must be smaller than or equal to 50.') end if !@custom_field5.nil? && @custom_field5.to_s.length > 75 invalid_properties.push('invalid value for "custom_field5", the character length must be smaller than or equal to 75.') end if !@custom_field6.nil? && @custom_field6.to_s.length > 50 invalid_properties.push('invalid value for "custom_field6", the character length must be smaller than or equal to 50.') end if !@custom_field7.nil? && @custom_field7.to_s.length > 50 invalid_properties.push('invalid value for "custom_field7", the character length must be smaller than or equal to 50.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
427 428 429 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 427 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 433 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 |
#to_s ⇒ String
Returns the string representation of the object
421 422 423 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 421 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
231 232 233 234 235 236 237 238 239 240 |
# File 'lib/ultracart_api/models/order_replacement.rb', line 231 def valid? return false if !@custom_field1.nil? && @custom_field1.to_s.length > 50 return false if !@custom_field2.nil? && @custom_field2.to_s.length > 50 return false if !@custom_field3.nil? && @custom_field3.to_s.length > 50 return false if !@custom_field4.nil? && @custom_field4.to_s.length > 50 return false if !@custom_field5.nil? && @custom_field5.to_s.length > 75 return false if !@custom_field6.nil? && @custom_field6.to_s.length > 50 return false if !@custom_field7.nil? && @custom_field7.to_s.length > 50 true end |