Class: UltracartClient::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/order.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Order

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
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
418
419
420
421
# File 'lib/ultracart_api/models/order.rb', line 239

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::Order` 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::Order`. 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?(:'affiliates')
    if (value = attributes[:'affiliates']).is_a?(Array)
      self.affiliates = value
    end
  end

  if attributes.key?(:'auto_order')
    self.auto_order = attributes[:'auto_order']
  end

  if attributes.key?(:'billing')
    self.billing = attributes[:'billing']
  end

  if attributes.key?(:'buysafe')
    self.buysafe = attributes[:'buysafe']
  end

  if attributes.key?(:'channel_partner')
    self.channel_partner = attributes[:'channel_partner']
  end

  if attributes.key?(:'checkout')
    self.checkout = attributes[:'checkout']
  end

  if attributes.key?(:'coupons')
    if (value = attributes[:'coupons']).is_a?(Array)
      self.coupons = value
    end
  end

  if attributes.key?(:'creation_dts')
    self.creation_dts = attributes[:'creation_dts']
  end

  if attributes.key?(:'currency_code')
    self.currency_code = attributes[:'currency_code']
  end

  if attributes.key?(:'current_stage')
    self.current_stage = attributes[:'current_stage']
  end

  if attributes.key?(:'current_stage_histories')
    if (value = attributes[:'current_stage_histories']).is_a?(Array)
      self.current_stage_histories = value
    end
  end

  if attributes.key?(:'customer_profile')
    self.customer_profile = attributes[:'customer_profile']
  end

  if attributes.key?(:'digital_order')
    self.digital_order = attributes[:'digital_order']
  end

  if attributes.key?(:'edi')
    self.edi = attributes[:'edi']
  end

  if attributes.key?(:'exchange_rate')
    self.exchange_rate = attributes[:'exchange_rate']
  end

  if attributes.key?(:'fraud_score')
    self.fraud_score = attributes[:'fraud_score']
  end

  if attributes.key?(:'gift')
    self.gift = attributes[:'gift']
  end

  if attributes.key?(:'gift_certificate')
    self.gift_certificate = attributes[:'gift_certificate']
  end

  if attributes.key?(:'internal')
    self.internal = attributes[:'internal']
  end

  if attributes.key?(:'items')
    if (value = attributes[:'items']).is_a?(Array)
      self.items = value
    end
  end

  if attributes.key?(:'language_iso_code')
    self.language_iso_code = attributes[:'language_iso_code']
  end

  if attributes.key?(:'linked_shipment')
    self.linked_shipment = attributes[:'linked_shipment']
  end

  if attributes.key?(:'marketing')
    self.marketing = attributes[:'marketing']
  end

  if attributes.key?(:'merchant_id')
    self.merchant_id = attributes[:'merchant_id']
  end

  if attributes.key?(:'order_id')
    self.order_id = attributes[:'order_id']
  end

  if attributes.key?(:'payment')
    self.payment = attributes[:'payment']
  end

  if attributes.key?(:'point_of_sale')
    self.point_of_sale = attributes[:'point_of_sale']
  end

  if attributes.key?(:'properties')
    if (value = attributes[:'properties']).is_a?(Array)
      self.properties = value
    end
  end

  if attributes.key?(:'quote')
    self.quote = attributes[:'quote']
  end

  if attributes.key?(:'refund_dts')
    self.refund_dts = attributes[:'refund_dts']
  end

  if attributes.key?(:'refund_reason')
    self.refund_reason = attributes[:'refund_reason']
  end

  if attributes.key?(:'reject_dts')
    self.reject_dts = attributes[:'reject_dts']
  end

  if attributes.key?(:'reject_reason')
    self.reject_reason = attributes[:'reject_reason']
  end

  if attributes.key?(:'salesforce')
    self.salesforce = attributes[:'salesforce']
  end

  if attributes.key?(:'shipping')
    self.shipping = attributes[:'shipping']
  end

  if attributes.key?(:'summary')
    self.summary = attributes[:'summary']
  end

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.key?(:'taxes')
    self.taxes = attributes[:'taxes']
  end

  if attributes.key?(:'utms')
    if (value = attributes[:'utms']).is_a?(Array)
      self.utms = value
    end
  end
end

Instance Attribute Details

#affiliatesObject

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.



19
20
21
# File 'lib/ultracart_api/models/order.rb', line 19

def affiliates
  @affiliates
end

#auto_orderObject

Returns the value of attribute auto_order.



21
22
23
# File 'lib/ultracart_api/models/order.rb', line 21

def auto_order
  @auto_order
end

#billingObject

Returns the value of attribute billing.



23
24
25
# File 'lib/ultracart_api/models/order.rb', line 23

def billing
  @billing
end

#buysafeObject

Returns the value of attribute buysafe.



25
26
27
# File 'lib/ultracart_api/models/order.rb', line 25

def buysafe
  @buysafe
end

#channel_partnerObject

Returns the value of attribute channel_partner.



27
28
29
# File 'lib/ultracart_api/models/order.rb', line 27

def channel_partner
  @channel_partner
end

#checkoutObject

Returns the value of attribute checkout.



29
30
31
# File 'lib/ultracart_api/models/order.rb', line 29

def checkout
  @checkout
end

#couponsObject

Coupons



32
33
34
# File 'lib/ultracart_api/models/order.rb', line 32

def coupons
  @coupons
end

#creation_dtsObject

Date/time that the order was created



35
36
37
# File 'lib/ultracart_api/models/order.rb', line 35

def creation_dts
  @creation_dts
end

#currency_codeObject

Currency code that the customer used if different than the merchant’s base currency code



38
39
40
# File 'lib/ultracart_api/models/order.rb', line 38

def currency_code
  @currency_code
end

#current_stageObject

Current stage that the order is in.



41
42
43
# File 'lib/ultracart_api/models/order.rb', line 41

def current_stage
  @current_stage
end

#current_stage_historiesObject

History of the changes to the current_stage field



44
45
46
# File 'lib/ultracart_api/models/order.rb', line 44

def current_stage_histories
  @current_stage_histories
end

#customer_profileObject

Returns the value of attribute customer_profile.



46
47
48
# File 'lib/ultracart_api/models/order.rb', line 46

def customer_profile
  @customer_profile
end

#digital_orderObject

Returns the value of attribute digital_order.



48
49
50
# File 'lib/ultracart_api/models/order.rb', line 48

def digital_order
  @digital_order
end

#ediObject

Returns the value of attribute edi.



50
51
52
# File 'lib/ultracart_api/models/order.rb', line 50

def edi
  @edi
end

#exchange_rateObject

Exchange rate at the time the order was placed if currency code is different than the base currency



53
54
55
# File 'lib/ultracart_api/models/order.rb', line 53

def exchange_rate
  @exchange_rate
end

#fraud_scoreObject

Returns the value of attribute fraud_score.



55
56
57
# File 'lib/ultracart_api/models/order.rb', line 55

def fraud_score
  @fraud_score
end

#giftObject

Returns the value of attribute gift.



57
58
59
# File 'lib/ultracart_api/models/order.rb', line 57

def gift
  @gift
end

#gift_certificateObject

Returns the value of attribute gift_certificate.



59
60
61
# File 'lib/ultracart_api/models/order.rb', line 59

def gift_certificate
  @gift_certificate
end

#internalObject

Returns the value of attribute internal.



61
62
63
# File 'lib/ultracart_api/models/order.rb', line 61

def internal
  @internal
end

#itemsObject

Items



64
65
66
# File 'lib/ultracart_api/models/order.rb', line 64

def items
  @items
end

#language_iso_codeObject

Three letter ISO-639 language code used by the customer during the checkout if different than the default language



67
68
69
# File 'lib/ultracart_api/models/order.rb', line 67

def language_iso_code
  @language_iso_code
end

#linked_shipmentObject

Returns the value of attribute linked_shipment.



69
70
71
# File 'lib/ultracart_api/models/order.rb', line 69

def linked_shipment
  @linked_shipment
end

#marketingObject

Returns the value of attribute marketing.



71
72
73
# File 'lib/ultracart_api/models/order.rb', line 71

def marketing
  @marketing
end

#merchant_idObject

UltraCart merchant ID owning this order



74
75
76
# File 'lib/ultracart_api/models/order.rb', line 74

def merchant_id
  @merchant_id
end

#order_idObject

Order ID



77
78
79
# File 'lib/ultracart_api/models/order.rb', line 77

def order_id
  @order_id
end

#paymentObject

Returns the value of attribute payment.



79
80
81
# File 'lib/ultracart_api/models/order.rb', line 79

def payment
  @payment
end

#point_of_saleObject

Returns the value of attribute point_of_sale.



81
82
83
# File 'lib/ultracart_api/models/order.rb', line 81

def point_of_sale
  @point_of_sale
end

#propertiesObject

Properties, available only through update, not through insert due to the nature of how properties are handled internally



84
85
86
# File 'lib/ultracart_api/models/order.rb', line 84

def properties
  @properties
end

#quoteObject

Returns the value of attribute quote.



86
87
88
# File 'lib/ultracart_api/models/order.rb', line 86

def quote
  @quote
end

#refund_dtsObject

If the order was refunded, the date/time that the last refund occurred



89
90
91
# File 'lib/ultracart_api/models/order.rb', line 89

def refund_dts
  @refund_dts
end

#refund_reasonObject

Refund reason code. This can only be written during a refund operation otherwise this field is read only.



92
93
94
# File 'lib/ultracart_api/models/order.rb', line 92

def refund_reason
  @refund_reason
end

#reject_dtsObject

If the order was rejected, the date/time that the rejection occurred



95
96
97
# File 'lib/ultracart_api/models/order.rb', line 95

def reject_dts
  @reject_dts
end

#reject_reasonObject

Reject reason code. This can only be written during a reject operation otherwise this field is read only.



98
99
100
# File 'lib/ultracart_api/models/order.rb', line 98

def reject_reason
  @reject_reason
end

#salesforceObject

Returns the value of attribute salesforce.



100
101
102
# File 'lib/ultracart_api/models/order.rb', line 100

def salesforce
  @salesforce
end

#shippingObject

Returns the value of attribute shipping.



102
103
104
# File 'lib/ultracart_api/models/order.rb', line 102

def shipping
  @shipping
end

#summaryObject

Returns the value of attribute summary.



104
105
106
# File 'lib/ultracart_api/models/order.rb', line 104

def summary
  @summary
end

#tagsObject

tags, available only through update, not through insert due to the nature of how tags are handled internally



107
108
109
# File 'lib/ultracart_api/models/order.rb', line 107

def tags
  @tags
end

#taxesObject

Returns the value of attribute taxes.



109
110
111
# File 'lib/ultracart_api/models/order.rb', line 109

def taxes
  @taxes
end

#utmsObject

UTM clicks. The zero index is the most recent (last) UTM click



112
113
114
# File 'lib/ultracart_api/models/order.rb', line 112

def utms
  @utms
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



182
183
184
# File 'lib/ultracart_api/models/order.rb', line 182

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/ultracart_api/models/order.rb', line 137

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',
    :'current_stage_histories' => :'current_stage_histories',
    :'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',
    :'point_of_sale' => :'point_of_sale',
    :'properties' => :'properties',
    :'quote' => :'quote',
    :'refund_dts' => :'refund_dts',
    :'refund_reason' => :'refund_reason',
    :'reject_dts' => :'reject_dts',
    :'reject_reason' => :'reject_reason',
    :'salesforce' => :'salesforce',
    :'shipping' => :'shipping',
    :'summary' => :'summary',
    :'tags' => :'Tags',
    :'taxes' => :'taxes',
    :'utms' => :'utms'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



539
540
541
# File 'lib/ultracart_api/models/order.rb', line 539

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



232
233
234
235
# File 'lib/ultracart_api/models/order.rb', line 232

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
220
221
222
223
224
225
226
227
228
229
# File 'lib/ultracart_api/models/order.rb', line 187

def self.openapi_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',
    :'current_stage_histories' => :'Array<OrderCurrentStageHistory>',
    :'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',
    :'point_of_sale' => :'OrderPointOfSale',
    :'properties' => :'Array<OrderProperty>',
    :'quote' => :'OrderQuote',
    :'refund_dts' => :'String',
    :'refund_reason' => :'String',
    :'reject_dts' => :'String',
    :'reject_reason' => :'String',
    :'salesforce' => :'OrderSalesforce',
    :'shipping' => :'OrderShipping',
    :'summary' => :'OrderSummary',
    :'tags' => :'Array<OrderTag>',
    :'taxes' => :'OrderTaxes',
    :'utms' => :'Array<OrderUtm>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



480
481
482
483
484
485
486
487
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
# File 'lib/ultracart_api/models/order.rb', line 480

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 &&
      current_stage_histories == o.current_stage_histories &&
      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 &&
      point_of_sale == o.point_of_sale &&
      properties == o.properties &&
      quote == o.quote &&
      refund_dts == o.refund_dts &&
      refund_reason == o.refund_reason &&
      reject_dts == o.reject_dts &&
      reject_reason == o.reject_reason &&
      salesforce == o.salesforce &&
      shipping == o.shipping &&
      summary == o.summary &&
      tags == o.tags &&
      taxes == o.taxes &&
      utms == o.utms
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/ultracart_api/models/order.rb', line 570

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



641
642
643
644
645
646
647
648
649
650
651
652
653
# File 'lib/ultracart_api/models/order.rb', line 641

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/ultracart_api/models/order.rb', line 546

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


526
527
528
# File 'lib/ultracart_api/models/order.rb', line 526

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



532
533
534
# File 'lib/ultracart_api/models/order.rb', line 532

def hash
  [affiliates, auto_order, billing, buysafe, channel_partner, checkout, coupons, creation_dts, currency_code, current_stage, current_stage_histories, 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, point_of_sale, properties, quote, refund_dts, refund_reason, reject_dts, reject_reason, salesforce, shipping, summary, tags, taxes, utms].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/ultracart_api/models/order.rb', line 425

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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



617
618
619
# File 'lib/ultracart_api/models/order.rb', line 617

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/ultracart_api/models/order.rb', line 623

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



611
612
613
# File 'lib/ultracart_api/models/order.rb', line 611

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



440
441
442
443
444
445
446
# File 'lib/ultracart_api/models/order.rb', line 440

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", "Advanced Order Routing", "Hold"])
  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