Class: UltracartClient::Order
- Inherits:
-
Object
- Object
- UltracartClient::Order
- Defined in:
- lib/ultracart_api/models/order.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#affiliates ⇒ Object
Affiliates if any were associated with the order.
-
#auto_order ⇒ Object
Returns the value of attribute auto_order.
-
#billing ⇒ Object
Returns the value of attribute billing.
-
#buysafe ⇒ Object
Returns the value of attribute buysafe.
-
#channel_partner ⇒ Object
Returns the value of attribute channel_partner.
-
#checkout ⇒ Object
Returns the value of attribute checkout.
-
#coupons ⇒ Object
Coupons.
-
#creation_dts ⇒ Object
Date/time that the order was created.
-
#currency_code ⇒ Object
Currency code that the customer used if different than the merchant’s base currency code.
-
#current_stage ⇒ Object
Current stage that the order is in.
-
#customer_profile ⇒ Object
Returns the value of attribute customer_profile.
-
#digital_order ⇒ Object
Returns the value of attribute digital_order.
-
#edi ⇒ Object
Returns the value of attribute edi.
-
#exchange_rate ⇒ Object
Exchange rate at the time the order was placed if currency code is different than the base currency.
-
#fraud_score ⇒ Object
Returns the value of attribute fraud_score.
-
#gift ⇒ Object
Returns the value of attribute gift.
-
#gift_certificate ⇒ Object
Returns the value of attribute gift_certificate.
-
#internal ⇒ Object
Returns the value of attribute internal.
-
#items ⇒ Object
Items.
-
#language_iso_code ⇒ Object
Three letter ISO-639 language code used by the customer during the checkout if different than the default language.
-
#linked_shipment ⇒ Object
Returns the value of attribute linked_shipment.
-
#marketing ⇒ Object
Returns the value of attribute marketing.
-
#merchant_id ⇒ Object
UltraCart merchant ID owning this order.
-
#order_id ⇒ Object
Order ID.
-
#payment ⇒ Object
Returns the value of attribute payment.
-
#properties ⇒ Object
Properties, available only through update, not through insert due to the nature of how properties are handled internally.
-
#quote ⇒ Object
Returns the value of attribute quote.
-
#refund_dts ⇒ Object
If the order was refunded, the date/time that the last refund occurred.
-
#reject_dts ⇒ Object
If the order was rejected, the date/time that the rejection occurred.
-
#salesforce ⇒ Object
Returns the value of attribute salesforce.
-
#shipping ⇒ Object
Returns the value of attribute shipping.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#tags ⇒ Object
tags, available only through update, not through insert due to the nature of how tags are handled internally.
-
#taxes ⇒ Object
Returns the value of attribute taxes.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_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 ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Order
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 = {}) ⇒ Order
Initializes the object
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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/ultracart_api/models/order.rb', line 203 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'affiliates') if (value = attributes[:'affiliates']).is_a?(Array) self.affiliates = value end end if attributes.has_key?(:'auto_order') self.auto_order = attributes[:'auto_order'] end if attributes.has_key?(:'billing') self.billing = attributes[:'billing'] end if attributes.has_key?(:'buysafe') self.buysafe = attributes[:'buysafe'] end if attributes.has_key?(:'channel_partner') self.channel_partner = attributes[:'channel_partner'] end if attributes.has_key?(:'checkout') self.checkout = attributes[:'checkout'] end if attributes.has_key?(:'coupons') if (value = attributes[:'coupons']).is_a?(Array) self.coupons = value end end if attributes.has_key?(:'creation_dts') self.creation_dts = attributes[:'creation_dts'] end if attributes.has_key?(:'currency_code') self.currency_code = attributes[:'currency_code'] end if attributes.has_key?(:'current_stage') self.current_stage = attributes[:'current_stage'] end if attributes.has_key?(:'customer_profile') self.customer_profile = attributes[:'customer_profile'] end if attributes.has_key?(:'digital_order') self.digital_order = attributes[:'digital_order'] end if attributes.has_key?(:'edi') self.edi = attributes[:'edi'] end if attributes.has_key?(:'exchange_rate') self.exchange_rate = attributes[:'exchange_rate'] end if attributes.has_key?(:'fraud_score') self.fraud_score = attributes[:'fraud_score'] end if attributes.has_key?(:'gift') self.gift = attributes[:'gift'] end if attributes.has_key?(:'gift_certificate') self.gift_certificate = attributes[:'gift_certificate'] end if attributes.has_key?(:'internal') self.internal = attributes[:'internal'] end if attributes.has_key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end if attributes.has_key?(:'language_iso_code') self.language_iso_code = attributes[:'language_iso_code'] end if attributes.has_key?(:'linked_shipment') self.linked_shipment = attributes[:'linked_shipment'] end if attributes.has_key?(:'marketing') self.marketing = attributes[:'marketing'] end if attributes.has_key?(:'merchant_id') self.merchant_id = attributes[:'merchant_id'] end if attributes.has_key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.has_key?(:'payment') self.payment = attributes[:'payment'] end if attributes.has_key?(:'properties') if (value = attributes[:'properties']).is_a?(Array) self.properties = value end end if attributes.has_key?(:'quote') self.quote = attributes[:'quote'] end if attributes.has_key?(:'refund_dts') self.refund_dts = attributes[:'refund_dts'] end if attributes.has_key?(:'reject_dts') self.reject_dts = attributes[:'reject_dts'] end if attributes.has_key?(:'salesforce') self.salesforce = attributes[:'salesforce'] end if attributes.has_key?(:'shipping') self.shipping = attributes[:'shipping'] end if attributes.has_key?(:'summary') self.summary = attributes[:'summary'] end if attributes.has_key?(:'Tags') if (value = attributes[:'Tags']).is_a?(Array) self. = value end end if attributes.has_key?(:'taxes') self.taxes = attributes[:'taxes'] end end |
Instance Attribute Details
#affiliates ⇒ Object
Affiliates if any were associated with the order. The first one in the array sent the order and each subsequent affiliate is the recruiter that earns a downline commission.
18 19 20 |
# File 'lib/ultracart_api/models/order.rb', line 18 def affiliates @affiliates end |
#auto_order ⇒ Object
Returns the value of attribute auto_order.
20 21 22 |
# File 'lib/ultracart_api/models/order.rb', line 20 def auto_order @auto_order end |
#billing ⇒ Object
Returns the value of attribute billing.
22 23 24 |
# File 'lib/ultracart_api/models/order.rb', line 22 def billing @billing end |
#buysafe ⇒ Object
Returns the value of attribute buysafe.
24 25 26 |
# File 'lib/ultracart_api/models/order.rb', line 24 def buysafe @buysafe end |
#channel_partner ⇒ Object
Returns the value of attribute channel_partner.
26 27 28 |
# File 'lib/ultracart_api/models/order.rb', line 26 def channel_partner @channel_partner end |
#checkout ⇒ Object
Returns the value of attribute checkout.
28 29 30 |
# File 'lib/ultracart_api/models/order.rb', line 28 def checkout @checkout end |
#coupons ⇒ Object
Coupons
31 32 33 |
# File 'lib/ultracart_api/models/order.rb', line 31 def coupons @coupons end |
#creation_dts ⇒ Object
Date/time that the order was created
34 35 36 |
# File 'lib/ultracart_api/models/order.rb', line 34 def creation_dts @creation_dts end |
#currency_code ⇒ Object
Currency code that the customer used if different than the merchant’s base currency code
37 38 39 |
# File 'lib/ultracart_api/models/order.rb', line 37 def currency_code @currency_code end |
#current_stage ⇒ Object
Current stage that the order is in.
40 41 42 |
# File 'lib/ultracart_api/models/order.rb', line 40 def current_stage @current_stage end |
#customer_profile ⇒ Object
Returns the value of attribute customer_profile.
42 43 44 |
# File 'lib/ultracart_api/models/order.rb', line 42 def customer_profile @customer_profile end |
#digital_order ⇒ Object
Returns the value of attribute digital_order.
44 45 46 |
# File 'lib/ultracart_api/models/order.rb', line 44 def digital_order @digital_order end |
#edi ⇒ Object
Returns the value of attribute edi.
46 47 48 |
# File 'lib/ultracart_api/models/order.rb', line 46 def edi @edi end |
#exchange_rate ⇒ Object
Exchange rate at the time the order was placed if currency code is different than the base currency
49 50 51 |
# File 'lib/ultracart_api/models/order.rb', line 49 def exchange_rate @exchange_rate end |
#fraud_score ⇒ Object
Returns the value of attribute fraud_score.
51 52 53 |
# File 'lib/ultracart_api/models/order.rb', line 51 def fraud_score @fraud_score end |
#gift ⇒ Object
Returns the value of attribute gift.
53 54 55 |
# File 'lib/ultracart_api/models/order.rb', line 53 def gift @gift end |
#gift_certificate ⇒ Object
Returns the value of attribute gift_certificate.
55 56 57 |
# File 'lib/ultracart_api/models/order.rb', line 55 def gift_certificate @gift_certificate end |
#internal ⇒ Object
Returns the value of attribute internal.
57 58 59 |
# File 'lib/ultracart_api/models/order.rb', line 57 def internal @internal end |
#items ⇒ Object
Items
60 61 62 |
# File 'lib/ultracart_api/models/order.rb', line 60 def items @items end |
#language_iso_code ⇒ Object
Three letter ISO-639 language code used by the customer during the checkout if different than the default language
63 64 65 |
# File 'lib/ultracart_api/models/order.rb', line 63 def language_iso_code @language_iso_code end |
#linked_shipment ⇒ Object
Returns the value of attribute linked_shipment.
65 66 67 |
# File 'lib/ultracart_api/models/order.rb', line 65 def linked_shipment @linked_shipment end |
#marketing ⇒ Object
Returns the value of attribute marketing.
67 68 69 |
# File 'lib/ultracart_api/models/order.rb', line 67 def marketing @marketing end |
#merchant_id ⇒ Object
UltraCart merchant ID owning this order
70 71 72 |
# File 'lib/ultracart_api/models/order.rb', line 70 def merchant_id @merchant_id end |
#order_id ⇒ Object
Order ID
73 74 75 |
# File 'lib/ultracart_api/models/order.rb', line 73 def order_id @order_id end |
#payment ⇒ Object
Returns the value of attribute payment.
75 76 77 |
# File 'lib/ultracart_api/models/order.rb', line 75 def payment @payment end |
#properties ⇒ Object
Properties, available only through update, not through insert due to the nature of how properties are handled internally
78 79 80 |
# File 'lib/ultracart_api/models/order.rb', line 78 def properties @properties end |
#quote ⇒ Object
Returns the value of attribute quote.
80 81 82 |
# File 'lib/ultracart_api/models/order.rb', line 80 def quote @quote end |
#refund_dts ⇒ Object
If the order was refunded, the date/time that the last refund occurred
83 84 85 |
# File 'lib/ultracart_api/models/order.rb', line 83 def refund_dts @refund_dts end |
#reject_dts ⇒ Object
If the order was rejected, the date/time that the rejection occurred
86 87 88 |
# File 'lib/ultracart_api/models/order.rb', line 86 def reject_dts @reject_dts end |
#salesforce ⇒ Object
Returns the value of attribute salesforce.
88 89 90 |
# File 'lib/ultracart_api/models/order.rb', line 88 def salesforce @salesforce end |
#shipping ⇒ Object
Returns the value of attribute shipping.
90 91 92 |
# File 'lib/ultracart_api/models/order.rb', line 90 def shipping @shipping end |
#summary ⇒ Object
Returns the value of attribute summary.
92 93 94 |
# File 'lib/ultracart_api/models/order.rb', line 92 def summary @summary end |
#tags ⇒ Object
tags, available only through update, not through insert due to the nature of how tags are handled internally
95 96 97 |
# File 'lib/ultracart_api/models/order.rb', line 95 def @tags end |
#taxes ⇒ Object
Returns the value of attribute taxes.
97 98 99 |
# File 'lib/ultracart_api/models/order.rb', line 97 def taxes @taxes end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/ultracart_api/models/order.rb', line 122 def self.attribute_map { :'affiliates' => :'affiliates', :'auto_order' => :'auto_order', :'billing' => :'billing', :'buysafe' => :'buysafe', :'channel_partner' => :'channel_partner', :'checkout' => :'checkout', :'coupons' => :'coupons', :'creation_dts' => :'creation_dts', :'currency_code' => :'currency_code', :'current_stage' => :'current_stage', :'customer_profile' => :'customer_profile', :'digital_order' => :'digital_order', :'edi' => :'edi', :'exchange_rate' => :'exchange_rate', :'fraud_score' => :'fraud_score', :'gift' => :'gift', :'gift_certificate' => :'gift_certificate', :'internal' => :'internal', :'items' => :'items', :'language_iso_code' => :'language_iso_code', :'linked_shipment' => :'linked_shipment', :'marketing' => :'marketing', :'merchant_id' => :'merchant_id', :'order_id' => :'order_id', :'payment' => :'payment', :'properties' => :'properties', :'quote' => :'quote', :'refund_dts' => :'refund_dts', :'reject_dts' => :'reject_dts', :'salesforce' => :'salesforce', :'shipping' => :'shipping', :'summary' => :'summary', :'tags' => :'Tags', :'taxes' => :'taxes' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 197 198 199 |
# File 'lib/ultracart_api/models/order.rb', line 162 def self.swagger_types { :'affiliates' => :'Array<OrderAffiliate>', :'auto_order' => :'OrderAutoOrder', :'billing' => :'OrderBilling', :'buysafe' => :'OrderBuysafe', :'channel_partner' => :'OrderChannelPartner', :'checkout' => :'OrderCheckout', :'coupons' => :'Array<OrderCoupon>', :'creation_dts' => :'String', :'currency_code' => :'String', :'current_stage' => :'String', :'customer_profile' => :'Customer', :'digital_order' => :'OrderDigitalOrder', :'edi' => :'OrderEdi', :'exchange_rate' => :'Float', :'fraud_score' => :'OrderFraudScore', :'gift' => :'OrderGift', :'gift_certificate' => :'OrderGiftCertificate', :'internal' => :'OrderInternal', :'items' => :'Array<OrderItem>', :'language_iso_code' => :'String', :'linked_shipment' => :'OrderLinkedShipment', :'marketing' => :'OrderMarketing', :'merchant_id' => :'String', :'order_id' => :'String', :'payment' => :'OrderPayment', :'properties' => :'Array<OrderProperty>', :'quote' => :'OrderQuote', :'refund_dts' => :'String', :'reject_dts' => :'String', :'salesforce' => :'OrderSalesforce', :'shipping' => :'OrderShipping', :'summary' => :'OrderSummary', :'tags' => :'Array<OrderTag>', :'taxes' => :'OrderTaxes' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/ultracart_api/models/order.rb', line 413 def ==(o) return true if self.equal?(o) self.class == o.class && affiliates == o.affiliates && auto_order == o.auto_order && billing == o.billing && buysafe == o.buysafe && channel_partner == o.channel_partner && checkout == o.checkout && coupons == o.coupons && creation_dts == o.creation_dts && currency_code == o.currency_code && current_stage == o.current_stage && customer_profile == o.customer_profile && digital_order == o.digital_order && edi == o.edi && exchange_rate == o.exchange_rate && fraud_score == o.fraud_score && gift == o.gift && gift_certificate == o.gift_certificate && internal == o.internal && items == o.items && language_iso_code == o.language_iso_code && linked_shipment == o.linked_shipment && marketing == o.marketing && merchant_id == o.merchant_id && order_id == o.order_id && payment == o.payment && properties == o.properties && quote == o.quote && refund_dts == o.refund_dts && reject_dts == o.reject_dts && salesforce == o.salesforce && shipping == o.shipping && summary == o.summary && == o. && taxes == o.taxes end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/ultracart_api/models/order.rb', line 488 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 temp_model = UltracartClient.const_get(type).new temp_model.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
554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/ultracart_api/models/order.rb', line 554 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
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/ultracart_api/models/order.rb', line 467 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if 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 # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
454 455 456 |
# File 'lib/ultracart_api/models/order.rb', line 454 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
460 461 462 |
# File 'lib/ultracart_api/models/order.rb', line 460 def hash [affiliates, auto_order, billing, buysafe, channel_partner, checkout, coupons, creation_dts, currency_code, current_stage, customer_profile, digital_order, edi, exchange_rate, fraud_score, gift, gift_certificate, internal, items, language_iso_code, linked_shipment, marketing, merchant_id, order_id, payment, properties, quote, refund_dts, reject_dts, salesforce, shipping, summary, , taxes].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/ultracart_api/models/order.rb', line 358 def list_invalid_properties invalid_properties = Array.new if !@currency_code.nil? && @currency_code.to_s.length > 3 invalid_properties.push('invalid value for "currency_code", the character length must be smaller than or equal to 3.') end if !@language_iso_code.nil? && @language_iso_code.to_s.length > 3 invalid_properties.push('invalid value for "language_iso_code", the character length must be smaller than or equal to 3.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
534 535 536 |
# File 'lib/ultracart_api/models/order.rb', line 534 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
540 541 542 543 544 545 546 547 548 |
# File 'lib/ultracart_api/models/order.rb', line 540 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
528 529 530 |
# File 'lib/ultracart_api/models/order.rb', line 528 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
373 374 375 376 377 378 379 |
# File 'lib/ultracart_api/models/order.rb', line 373 def valid? return false if !@currency_code.nil? && @currency_code.to_s.length > 3 current_stage_validator = EnumAttributeValidator.new('String', ['Accounts Receivable', 'Pending Clearance', 'Fraud Review', 'Rejected', 'Shipping Department', 'Completed Order', 'Quote Request', 'Quote Sent', 'Least Cost Routing', 'Unknown', 'Pre-ordered']) return false unless current_stage_validator.valid?(@current_stage) return false if !@language_iso_code.nil? && @language_iso_code.to_s.length > 3 true end |