Class: UltracartClient::Coupon

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Coupon

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/ultracart_api/models/coupon.rb', line 352

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#affiliate_oidObject

Associates an order with an affiliate when this value is set.



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

def affiliate_oid
  @affiliate_oid
end

#allow_multiple_one_time_codesObject

True if multiple one time codes for this coupon can be used on a cart at the same time.



22
23
24
# File 'lib/ultracart_api/models/coupon.rb', line 22

def allow_multiple_one_time_codes
  @allow_multiple_one_time_codes
end

#amount_off_itemsObject

Returns the value of attribute amount_off_items.



24
25
26
# File 'lib/ultracart_api/models/coupon.rb', line 24

def amount_off_items
  @amount_off_items
end

#amount_off_shippingObject

Returns the value of attribute amount_off_shipping.



26
27
28
# File 'lib/ultracart_api/models/coupon.rb', line 26

def amount_off_shipping
  @amount_off_shipping
end

#amount_off_shipping_with_items_purchaseObject

Returns the value of attribute amount_off_shipping_with_items_purchase.



28
29
30
# File 'lib/ultracart_api/models/coupon.rb', line 28

def amount_off_shipping_with_items_purchase
  @amount_off_shipping_with_items_purchase
end

#amount_off_subtotalObject

Returns the value of attribute amount_off_subtotal.



30
31
32
# File 'lib/ultracart_api/models/coupon.rb', line 30

def amount_off_subtotal
  @amount_off_subtotal
end

#amount_off_subtotal_and_free_shippingObject

Returns the value of attribute amount_off_subtotal_and_free_shipping.



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

def amount_off_subtotal_and_free_shipping
  @amount_off_subtotal_and_free_shipping
end

#amount_off_subtotal_and_shippingObject

Returns the value of attribute amount_off_subtotal_and_shipping.



34
35
36
# File 'lib/ultracart_api/models/coupon.rb', line 34

def amount_off_subtotal_and_shipping
  @amount_off_subtotal_and_shipping
end

#amount_off_subtotal_with_block_purchaseObject

Returns the value of attribute amount_off_subtotal_with_block_purchase.



36
37
38
# File 'lib/ultracart_api/models/coupon.rb', line 36

def amount_off_subtotal_with_block_purchase
  @amount_off_subtotal_with_block_purchase
end

#amount_off_subtotal_with_items_purchaseObject

Returns the value of attribute amount_off_subtotal_with_items_purchase.



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

def amount_off_subtotal_with_items_purchase
  @amount_off_subtotal_with_items_purchase
end

#amount_off_subtotal_with_purchaseObject

Returns the value of attribute amount_off_subtotal_with_purchase.



40
41
42
# File 'lib/ultracart_api/models/coupon.rb', line 40

def amount_off_subtotal_with_purchase
  @amount_off_subtotal_with_purchase
end

#amount_shipping_with_subtotalObject

Returns the value of attribute amount_shipping_with_subtotal.



42
43
44
# File 'lib/ultracart_api/models/coupon.rb', line 42

def amount_shipping_with_subtotal
  @amount_shipping_with_subtotal
end

#automatically_apply_coupon_codesObject

Returns the value of attribute automatically_apply_coupon_codes.



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

def automatically_apply_coupon_codes
  @automatically_apply_coupon_codes
end

#buy_one_get_oneObject

Returns the value of attribute buy_one_get_one.



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

def buy_one_get_one
  @buy_one_get_one
end

#calculated_descriptionObject

Calculated description displayed to the customer if no description is specified.



49
50
51
# File 'lib/ultracart_api/models/coupon.rb', line 49

def calculated_description
  @calculated_description
end

#can_be_used_with_other_couponsObject

True if this coupon can be used with other coupons in a single order.



52
53
54
# File 'lib/ultracart_api/models/coupon.rb', line 52

def can_be_used_with_other_coupons
  @can_be_used_with_other_coupons
end

#coupon_oidObject

Coupon oid.



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

def coupon_oid
  @coupon_oid
end

#coupon_typeObject

Coupon type.



58
59
60
# File 'lib/ultracart_api/models/coupon.rb', line 58

def coupon_type
  @coupon_type
end

#descriptionObject

Description of the coupon up to 50 characters.



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

def description
  @description
end

#discount_item_with_item_purchaseObject

Returns the value of attribute discount_item_with_item_purchase.



63
64
65
# File 'lib/ultracart_api/models/coupon.rb', line 63

def discount_item_with_item_purchase
  @discount_item_with_item_purchase
end

#discount_itemsObject

Returns the value of attribute discount_items.



65
66
67
# File 'lib/ultracart_api/models/coupon.rb', line 65

def discount_items
  @discount_items
end

#expiration_dtsObject

Date/time when coupon expires



68
69
70
# File 'lib/ultracart_api/models/coupon.rb', line 68

def expiration_dts
  @expiration_dts
end

#free_item_and_shipping_with_subtotalObject

Returns the value of attribute free_item_and_shipping_with_subtotal.



70
71
72
# File 'lib/ultracart_api/models/coupon.rb', line 70

def free_item_and_shipping_with_subtotal
  @free_item_and_shipping_with_subtotal
end

#free_item_with_item_purchaseObject

Returns the value of attribute free_item_with_item_purchase.



72
73
74
# File 'lib/ultracart_api/models/coupon.rb', line 72

def free_item_with_item_purchase
  @free_item_with_item_purchase
end

#free_item_with_item_purchase_and_free_shippingObject

Returns the value of attribute free_item_with_item_purchase_and_free_shipping.



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

def free_item_with_item_purchase_and_free_shipping
  @free_item_with_item_purchase_and_free_shipping
end

#free_item_with_subtotalObject

Returns the value of attribute free_item_with_subtotal.



76
77
78
# File 'lib/ultracart_api/models/coupon.rb', line 76

def free_item_with_subtotal
  @free_item_with_subtotal
end

#free_items_with_item_purchaseObject

Returns the value of attribute free_items_with_item_purchase.



78
79
80
# File 'lib/ultracart_api/models/coupon.rb', line 78

def free_items_with_item_purchase
  @free_items_with_item_purchase
end

#free_items_with_mixmatch_purchaseObject

Returns the value of attribute free_items_with_mixmatch_purchase.



80
81
82
# File 'lib/ultracart_api/models/coupon.rb', line 80

def free_items_with_mixmatch_purchase
  @free_items_with_mixmatch_purchase
end

#free_shippingObject

Returns the value of attribute free_shipping.



82
83
84
# File 'lib/ultracart_api/models/coupon.rb', line 82

def free_shipping
  @free_shipping
end

#free_shipping_specific_itemsObject

Returns the value of attribute free_shipping_specific_items.



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

def free_shipping_specific_items
  @free_shipping_specific_items
end

#free_shipping_with_items_purchaseObject

Returns the value of attribute free_shipping_with_items_purchase.



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

def free_shipping_with_items_purchase
  @free_shipping_with_items_purchase
end

#free_shipping_with_subtotalObject

Returns the value of attribute free_shipping_with_subtotal.



88
89
90
# File 'lib/ultracart_api/models/coupon.rb', line 88

def free_shipping_with_subtotal
  @free_shipping_with_subtotal
end

#hide_from_customerObject

Hide coupon from customer during checkout. Often used when coupons are automatic discounting mechanisms.



91
92
93
# File 'lib/ultracart_api/models/coupon.rb', line 91

def hide_from_customer
  @hide_from_customer
end

#merchant_codeObject

Merchant code of coupon up to 20 characters.



94
95
96
# File 'lib/ultracart_api/models/coupon.rb', line 94

def merchant_code
  @merchant_code
end

#merchant_notesObject

Internal notes about this coupon. These are not visible to customer.



97
98
99
# File 'lib/ultracart_api/models/coupon.rb', line 97

def merchant_notes
  @merchant_notes
end

#more_loyalty_cashbackObject

Returns the value of attribute more_loyalty_cashback.



99
100
101
# File 'lib/ultracart_api/models/coupon.rb', line 99

def more_loyalty_cashback
  @more_loyalty_cashback
end

#more_loyalty_pointsObject

Returns the value of attribute more_loyalty_points.



101
102
103
# File 'lib/ultracart_api/models/coupon.rb', line 101

def more_loyalty_points
  @more_loyalty_points
end

#multiple_amounts_off_itemsObject

Returns the value of attribute multiple_amounts_off_items.



103
104
105
# File 'lib/ultracart_api/models/coupon.rb', line 103

def multiple_amounts_off_items
  @multiple_amounts_off_items
end

#no_discountObject

Returns the value of attribute no_discount.



105
106
107
# File 'lib/ultracart_api/models/coupon.rb', line 105

def no_discount
  @no_discount
end

#percent_more_loyalty_cashbackObject

Returns the value of attribute percent_more_loyalty_cashback.



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

def percent_more_loyalty_cashback
  @percent_more_loyalty_cashback
end

#percent_more_loyalty_pointsObject

Returns the value of attribute percent_more_loyalty_points.



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

def percent_more_loyalty_points
  @percent_more_loyalty_points
end

#percent_off_item_with_items_quantity_purchaseObject

Returns the value of attribute percent_off_item_with_items_quantity_purchase.



111
112
113
# File 'lib/ultracart_api/models/coupon.rb', line 111

def percent_off_item_with_items_quantity_purchase
  @percent_off_item_with_items_quantity_purchase
end

#percent_off_itemsObject

Returns the value of attribute percent_off_items.



113
114
115
# File 'lib/ultracart_api/models/coupon.rb', line 113

def percent_off_items
  @percent_off_items
end

#percent_off_items_and_free_shippingObject

Returns the value of attribute percent_off_items_and_free_shipping.



115
116
117
# File 'lib/ultracart_api/models/coupon.rb', line 115

def percent_off_items_and_free_shipping
  @percent_off_items_and_free_shipping
end

#percent_off_items_with_items_purchaseObject

Returns the value of attribute percent_off_items_with_items_purchase.



117
118
119
# File 'lib/ultracart_api/models/coupon.rb', line 117

def percent_off_items_with_items_purchase
  @percent_off_items_with_items_purchase
end

#percent_off_msrp_itemsObject

Returns the value of attribute percent_off_msrp_items.



119
120
121
# File 'lib/ultracart_api/models/coupon.rb', line 119

def percent_off_msrp_items
  @percent_off_msrp_items
end

#percent_off_retail_price_itemsObject

Returns the value of attribute percent_off_retail_price_items.



121
122
123
# File 'lib/ultracart_api/models/coupon.rb', line 121

def percent_off_retail_price_items
  @percent_off_retail_price_items
end

#percent_off_shippingObject

Returns the value of attribute percent_off_shipping.



123
124
125
# File 'lib/ultracart_api/models/coupon.rb', line 123

def percent_off_shipping
  @percent_off_shipping
end

#percent_off_subtotalObject

Returns the value of attribute percent_off_subtotal.



125
126
127
# File 'lib/ultracart_api/models/coupon.rb', line 125

def percent_off_subtotal
  @percent_off_subtotal
end

#percent_off_subtotal_and_free_shippingObject

Returns the value of attribute percent_off_subtotal_and_free_shipping.



127
128
129
# File 'lib/ultracart_api/models/coupon.rb', line 127

def percent_off_subtotal_and_free_shipping
  @percent_off_subtotal_and_free_shipping
end

#percent_off_subtotal_limitObject

Returns the value of attribute percent_off_subtotal_limit.



129
130
131
# File 'lib/ultracart_api/models/coupon.rb', line 129

def percent_off_subtotal_limit
  @percent_off_subtotal_limit
end

#percent_off_subtotal_with_items_purchaseObject

Returns the value of attribute percent_off_subtotal_with_items_purchase.



131
132
133
# File 'lib/ultracart_api/models/coupon.rb', line 131

def percent_off_subtotal_with_items_purchase
  @percent_off_subtotal_with_items_purchase
end

#percent_off_subtotal_with_subtotalObject

Returns the value of attribute percent_off_subtotal_with_subtotal.



133
134
135
# File 'lib/ultracart_api/models/coupon.rb', line 133

def percent_off_subtotal_with_subtotal
  @percent_off_subtotal_with_subtotal
end

#quickbooks_codeObject

Quickbooks accounting code.



136
137
138
# File 'lib/ultracart_api/models/coupon.rb', line 136

def quickbooks_code
  @quickbooks_code
end

#restrict_by_postal_codesObject

Optional list of postal codes which restrict a coupon to within these postal codes.



139
140
141
# File 'lib/ultracart_api/models/coupon.rb', line 139

def restrict_by_postal_codes
  @restrict_by_postal_codes
end

#restrict_by_screen_branding_theme_codesObject

Optional list of legacy screen branding theme codes to limit coupon use to only those themes.



142
143
144
# File 'lib/ultracart_api/models/coupon.rb', line 142

def restrict_by_screen_branding_theme_codes
  @restrict_by_screen_branding_theme_codes
end

#restrict_by_storefrontsObject

Optional list of storefronts to limit coupon use to only those storefronts.



145
146
147
# File 'lib/ultracart_api/models/coupon.rb', line 145

def restrict_by_storefronts
  @restrict_by_storefronts
end

#skip_on_rebillObject

Skip this coupon when it is on a rebill of an auto order.



148
149
150
# File 'lib/ultracart_api/models/coupon.rb', line 148

def skip_on_rebill
  @skip_on_rebill
end

#start_dtsObject

Date/time when coupon is valid



151
152
153
# File 'lib/ultracart_api/models/coupon.rb', line 151

def start_dts
  @start_dts
end

#super_couponObject

If true, this coupon can be used with ANY other coupon regardless of the other coupons configuration



154
155
156
# File 'lib/ultracart_api/models/coupon.rb', line 154

def super_coupon
  @super_coupon
end

#tiered_amount_off_itemsObject

Returns the value of attribute tiered_amount_off_items.



156
157
158
# File 'lib/ultracart_api/models/coupon.rb', line 156

def tiered_amount_off_items
  @tiered_amount_off_items
end

#tiered_amount_off_subtotalObject

Returns the value of attribute tiered_amount_off_subtotal.



158
159
160
# File 'lib/ultracart_api/models/coupon.rb', line 158

def tiered_amount_off_subtotal
  @tiered_amount_off_subtotal
end

#tiered_percent_off_itemsObject

Returns the value of attribute tiered_percent_off_items.



160
161
162
# File 'lib/ultracart_api/models/coupon.rb', line 160

def tiered_percent_off_items
  @tiered_percent_off_items
end

#tiered_percent_off_shippingObject

Returns the value of attribute tiered_percent_off_shipping.



162
163
164
# File 'lib/ultracart_api/models/coupon.rb', line 162

def tiered_percent_off_shipping
  @tiered_percent_off_shipping
end

#tiered_percent_off_subtotalObject

Returns the value of attribute tiered_percent_off_subtotal.



164
165
166
# File 'lib/ultracart_api/models/coupon.rb', line 164

def tiered_percent_off_subtotal
  @tiered_percent_off_subtotal
end

#tiered_percent_off_subtotal_based_on_msrpObject

Returns the value of attribute tiered_percent_off_subtotal_based_on_msrp.



166
167
168
# File 'lib/ultracart_api/models/coupon.rb', line 166

def tiered_percent_off_subtotal_based_on_msrp
  @tiered_percent_off_subtotal_based_on_msrp
end

#usable_byObject

Who may use this coupon.



169
170
171
# File 'lib/ultracart_api/models/coupon.rb', line 169

def usable_by
  @usable_by
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



267
268
269
# File 'lib/ultracart_api/models/coupon.rb', line 267

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'affiliate_oid' => :'affiliate_oid',
    :'allow_multiple_one_time_codes' => :'allow_multiple_one_time_codes',
    :'amount_off_items' => :'amount_off_items',
    :'amount_off_shipping' => :'amount_off_shipping',
    :'amount_off_shipping_with_items_purchase' => :'amount_off_shipping_with_items_purchase',
    :'amount_off_subtotal' => :'amount_off_subtotal',
    :'amount_off_subtotal_and_free_shipping' => :'amount_off_subtotal_and_free_shipping',
    :'amount_off_subtotal_and_shipping' => :'amount_off_subtotal_and_shipping',
    :'amount_off_subtotal_with_block_purchase' => :'amount_off_subtotal_with_block_purchase',
    :'amount_off_subtotal_with_items_purchase' => :'amount_off_subtotal_with_items_purchase',
    :'amount_off_subtotal_with_purchase' => :'amount_off_subtotal_with_purchase',
    :'amount_shipping_with_subtotal' => :'amount_shipping_with_subtotal',
    :'automatically_apply_coupon_codes' => :'automatically_apply_coupon_codes',
    :'buy_one_get_one' => :'buy_one_get_one',
    :'calculated_description' => :'calculated_description',
    :'can_be_used_with_other_coupons' => :'can_be_used_with_other_coupons',
    :'coupon_oid' => :'coupon_oid',
    :'coupon_type' => :'coupon_type',
    :'description' => :'description',
    :'discount_item_with_item_purchase' => :'discount_item_with_item_purchase',
    :'discount_items' => :'discount_items',
    :'expiration_dts' => :'expiration_dts',
    :'free_item_and_shipping_with_subtotal' => :'free_item_and_shipping_with_subtotal',
    :'free_item_with_item_purchase' => :'free_item_with_item_purchase',
    :'free_item_with_item_purchase_and_free_shipping' => :'free_item_with_item_purchase_and_free_shipping',
    :'free_item_with_subtotal' => :'free_item_with_subtotal',
    :'free_items_with_item_purchase' => :'free_items_with_item_purchase',
    :'free_items_with_mixmatch_purchase' => :'free_items_with_mixmatch_purchase',
    :'free_shipping' => :'free_shipping',
    :'free_shipping_specific_items' => :'free_shipping_specific_items',
    :'free_shipping_with_items_purchase' => :'free_shipping_with_items_purchase',
    :'free_shipping_with_subtotal' => :'free_shipping_with_subtotal',
    :'hide_from_customer' => :'hide_from_customer',
    :'merchant_code' => :'merchant_code',
    :'merchant_notes' => :'merchant_notes',
    :'more_loyalty_cashback' => :'more_loyalty_cashback',
    :'more_loyalty_points' => :'more_loyalty_points',
    :'multiple_amounts_off_items' => :'multiple_amounts_off_items',
    :'no_discount' => :'no_discount',
    :'percent_more_loyalty_cashback' => :'percent_more_loyalty_cashback',
    :'percent_more_loyalty_points' => :'percent_more_loyalty_points',
    :'percent_off_item_with_items_quantity_purchase' => :'percent_off_item_with_items_quantity_purchase',
    :'percent_off_items' => :'percent_off_items',
    :'percent_off_items_and_free_shipping' => :'percent_off_items_and_free_shipping',
    :'percent_off_items_with_items_purchase' => :'percent_off_items_with_items_purchase',
    :'percent_off_msrp_items' => :'percent_off_msrp_items',
    :'percent_off_retail_price_items' => :'percent_off_retail_price_items',
    :'percent_off_shipping' => :'percent_off_shipping',
    :'percent_off_subtotal' => :'percent_off_subtotal',
    :'percent_off_subtotal_and_free_shipping' => :'percent_off_subtotal_and_free_shipping',
    :'percent_off_subtotal_limit' => :'percent_off_subtotal_limit',
    :'percent_off_subtotal_with_items_purchase' => :'percent_off_subtotal_with_items_purchase',
    :'percent_off_subtotal_with_subtotal' => :'percent_off_subtotal_with_subtotal',
    :'quickbooks_code' => :'quickbooks_code',
    :'restrict_by_postal_codes' => :'restrict_by_postal_codes',
    :'restrict_by_screen_branding_theme_codes' => :'restrict_by_screen_branding_theme_codes',
    :'restrict_by_storefronts' => :'restrict_by_storefronts',
    :'skip_on_rebill' => :'skip_on_rebill',
    :'start_dts' => :'start_dts',
    :'super_coupon' => :'super_coupon',
    :'tiered_amount_off_items' => :'tiered_amount_off_items',
    :'tiered_amount_off_subtotal' => :'tiered_amount_off_subtotal',
    :'tiered_percent_off_items' => :'tiered_percent_off_items',
    :'tiered_percent_off_shipping' => :'tiered_percent_off_shipping',
    :'tiered_percent_off_subtotal' => :'tiered_percent_off_subtotal',
    :'tiered_percent_off_subtotal_based_on_msrp' => :'tiered_percent_off_subtotal_based_on_msrp',
    :'usable_by' => :'usable_by'
  }
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



834
835
836
# File 'lib/ultracart_api/models/coupon.rb', line 834

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

.openapi_nullableObject

List of attributes with nullable: true



345
346
347
348
# File 'lib/ultracart_api/models/coupon.rb', line 345

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'affiliate_oid' => :'Integer',
    :'allow_multiple_one_time_codes' => :'Boolean',
    :'amount_off_items' => :'CouponAmountOffItems',
    :'amount_off_shipping' => :'CouponAmountOffShipping',
    :'amount_off_shipping_with_items_purchase' => :'CouponAmountOffShippingWithItemsPurchase',
    :'amount_off_subtotal' => :'CouponAmountOffSubtotal',
    :'amount_off_subtotal_and_free_shipping' => :'CouponAmountOffSubtotalFreeShippingWithPurchase',
    :'amount_off_subtotal_and_shipping' => :'CouponAmountOffSubtotalAndShipping',
    :'amount_off_subtotal_with_block_purchase' => :'CouponAmountOffSubtotalWithBlockPurchase',
    :'amount_off_subtotal_with_items_purchase' => :'CouponAmountOffSubtotalWithItemsPurchase',
    :'amount_off_subtotal_with_purchase' => :'CouponAmountOffSubtotalWithPurchase',
    :'amount_shipping_with_subtotal' => :'CouponAmountShippingWithSubtotal',
    :'automatically_apply_coupon_codes' => :'CouponAutomaticallyApplyCouponCodes',
    :'buy_one_get_one' => :'CouponBuyOneGetOneLimit',
    :'calculated_description' => :'String',
    :'can_be_used_with_other_coupons' => :'Boolean',
    :'coupon_oid' => :'Integer',
    :'coupon_type' => :'String',
    :'description' => :'String',
    :'discount_item_with_item_purchase' => :'CouponDiscountItemWithItemPurchase',
    :'discount_items' => :'CouponDiscountItems',
    :'expiration_dts' => :'String',
    :'free_item_and_shipping_with_subtotal' => :'CouponFreeItemAndShippingWithSubtotal',
    :'free_item_with_item_purchase' => :'CouponFreeItemWithItemPurchase',
    :'free_item_with_item_purchase_and_free_shipping' => :'CouponFreeItemWithItemPurchaseAndFreeShipping',
    :'free_item_with_subtotal' => :'CouponFreeItemWithSubtotal',
    :'free_items_with_item_purchase' => :'CouponFreeItemsWithItemPurchase',
    :'free_items_with_mixmatch_purchase' => :'CouponFreeItemsWithMixMatchPurchase',
    :'free_shipping' => :'CouponFreeShipping',
    :'free_shipping_specific_items' => :'CouponFreeShippingSpecificItems',
    :'free_shipping_with_items_purchase' => :'CouponFreeShippingWithItemsPurchase',
    :'free_shipping_with_subtotal' => :'CouponFreeShippingWithSubtotal',
    :'hide_from_customer' => :'Boolean',
    :'merchant_code' => :'String',
    :'merchant_notes' => :'String',
    :'more_loyalty_cashback' => :'CouponMoreLoyaltyCashback',
    :'more_loyalty_points' => :'CouponMoreLoyaltyPoints',
    :'multiple_amounts_off_items' => :'CouponMultipleAmountsOffItems',
    :'no_discount' => :'CouponNoDiscount',
    :'percent_more_loyalty_cashback' => :'CouponPercentMoreLoyaltyCashback',
    :'percent_more_loyalty_points' => :'CouponPercentMoreLoyaltyPoints',
    :'percent_off_item_with_items_quantity_purchase' => :'CouponPercentOffItemWithItemsQuantityPurchase',
    :'percent_off_items' => :'CouponPercentOffItems',
    :'percent_off_items_and_free_shipping' => :'CouponPercentOffItemsAndFreeShipping',
    :'percent_off_items_with_items_purchase' => :'CouponPercentOffItemsWithItemsPurchase',
    :'percent_off_msrp_items' => :'CouponPercentOffMsrpItems',
    :'percent_off_retail_price_items' => :'CouponPercentOffRetailPriceItems',
    :'percent_off_shipping' => :'CouponPercentOffShipping',
    :'percent_off_subtotal' => :'CouponPercentOffSubtotal',
    :'percent_off_subtotal_and_free_shipping' => :'CouponPercentOffSubtotalAndFreeShipping',
    :'percent_off_subtotal_limit' => :'CouponPercentOffSubtotalLimit',
    :'percent_off_subtotal_with_items_purchase' => :'CouponPercentOffSubtotalWithItemsPurchase',
    :'percent_off_subtotal_with_subtotal' => :'CouponPercentOffSubtotalWithSubtotal',
    :'quickbooks_code' => :'String',
    :'restrict_by_postal_codes' => :'Array<String>',
    :'restrict_by_screen_branding_theme_codes' => :'Array<CouponRestriction>',
    :'restrict_by_storefronts' => :'Array<CouponRestriction>',
    :'skip_on_rebill' => :'Boolean',
    :'start_dts' => :'String',
    :'super_coupon' => :'Boolean',
    :'tiered_amount_off_items' => :'CouponTieredAmountOffItems',
    :'tiered_amount_off_subtotal' => :'CouponTieredAmountOffSubtotal',
    :'tiered_percent_off_items' => :'CouponTieredPercentOffItems',
    :'tiered_percent_off_shipping' => :'CouponTieredPercentOffShipping',
    :'tiered_percent_off_subtotal' => :'CouponTieredPercentOffSubtotal',
    :'tiered_percent_off_subtotal_based_on_msrp' => :'CouponTieredPercentOffSubtotalBasedOnMSRP',
    :'usable_by' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
# File 'lib/ultracart_api/models/coupon.rb', line 747

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      affiliate_oid == o.affiliate_oid &&
      allow_multiple_one_time_codes == o.allow_multiple_one_time_codes &&
      amount_off_items == o.amount_off_items &&
      amount_off_shipping == o.amount_off_shipping &&
      amount_off_shipping_with_items_purchase == o.amount_off_shipping_with_items_purchase &&
      amount_off_subtotal == o.amount_off_subtotal &&
      amount_off_subtotal_and_free_shipping == o.amount_off_subtotal_and_free_shipping &&
      amount_off_subtotal_and_shipping == o.amount_off_subtotal_and_shipping &&
      amount_off_subtotal_with_block_purchase == o.amount_off_subtotal_with_block_purchase &&
      amount_off_subtotal_with_items_purchase == o.amount_off_subtotal_with_items_purchase &&
      amount_off_subtotal_with_purchase == o.amount_off_subtotal_with_purchase &&
      amount_shipping_with_subtotal == o.amount_shipping_with_subtotal &&
      automatically_apply_coupon_codes == o.automatically_apply_coupon_codes &&
      buy_one_get_one == o.buy_one_get_one &&
      calculated_description == o.calculated_description &&
      can_be_used_with_other_coupons == o.can_be_used_with_other_coupons &&
      coupon_oid == o.coupon_oid &&
      coupon_type == o.coupon_type &&
      description == o.description &&
      discount_item_with_item_purchase == o.discount_item_with_item_purchase &&
      discount_items == o.discount_items &&
      expiration_dts == o.expiration_dts &&
      free_item_and_shipping_with_subtotal == o.free_item_and_shipping_with_subtotal &&
      free_item_with_item_purchase == o.free_item_with_item_purchase &&
      free_item_with_item_purchase_and_free_shipping == o.free_item_with_item_purchase_and_free_shipping &&
      free_item_with_subtotal == o.free_item_with_subtotal &&
      free_items_with_item_purchase == o.free_items_with_item_purchase &&
      free_items_with_mixmatch_purchase == o.free_items_with_mixmatch_purchase &&
      free_shipping == o.free_shipping &&
      free_shipping_specific_items == o.free_shipping_specific_items &&
      free_shipping_with_items_purchase == o.free_shipping_with_items_purchase &&
      free_shipping_with_subtotal == o.free_shipping_with_subtotal &&
      hide_from_customer == o.hide_from_customer &&
      merchant_code == o.merchant_code &&
      merchant_notes == o.merchant_notes &&
      more_loyalty_cashback == o.more_loyalty_cashback &&
      more_loyalty_points == o.more_loyalty_points &&
      multiple_amounts_off_items == o.multiple_amounts_off_items &&
      no_discount == o.no_discount &&
      percent_more_loyalty_cashback == o.percent_more_loyalty_cashback &&
      percent_more_loyalty_points == o.percent_more_loyalty_points &&
      percent_off_item_with_items_quantity_purchase == o.percent_off_item_with_items_quantity_purchase &&
      percent_off_items == o.percent_off_items &&
      percent_off_items_and_free_shipping == o.percent_off_items_and_free_shipping &&
      percent_off_items_with_items_purchase == o.percent_off_items_with_items_purchase &&
      percent_off_msrp_items == o.percent_off_msrp_items &&
      percent_off_retail_price_items == o.percent_off_retail_price_items &&
      percent_off_shipping == o.percent_off_shipping &&
      percent_off_subtotal == o.percent_off_subtotal &&
      percent_off_subtotal_and_free_shipping == o.percent_off_subtotal_and_free_shipping &&
      percent_off_subtotal_limit == o.percent_off_subtotal_limit &&
      percent_off_subtotal_with_items_purchase == o.percent_off_subtotal_with_items_purchase &&
      percent_off_subtotal_with_subtotal == o.percent_off_subtotal_with_subtotal &&
      quickbooks_code == o.quickbooks_code &&
      restrict_by_postal_codes == o.restrict_by_postal_codes &&
      restrict_by_screen_branding_theme_codes == o.restrict_by_screen_branding_theme_codes &&
      restrict_by_storefronts == o.restrict_by_storefronts &&
      skip_on_rebill == o.skip_on_rebill &&
      start_dts == o.start_dts &&
      super_coupon == o.super_coupon &&
      tiered_amount_off_items == o.tiered_amount_off_items &&
      tiered_amount_off_subtotal == o.tiered_amount_off_subtotal &&
      tiered_percent_off_items == o.tiered_percent_off_items &&
      tiered_percent_off_shipping == o.tiered_percent_off_shipping &&
      tiered_percent_off_subtotal == o.tiered_percent_off_subtotal &&
      tiered_percent_off_subtotal_based_on_msrp == o.tiered_percent_off_subtotal_based_on_msrp &&
      usable_by == o.usable_by
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



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/ultracart_api/models/coupon.rb', line 865

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



936
937
938
939
940
941
942
943
944
945
946
947
948
# File 'lib/ultracart_api/models/coupon.rb', line 936

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



841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
# File 'lib/ultracart_api/models/coupon.rb', line 841

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


821
822
823
# File 'lib/ultracart_api/models/coupon.rb', line 821

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



827
828
829
# File 'lib/ultracart_api/models/coupon.rb', line 827

def hash
  [affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_shipping, amount_off_shipping_with_items_purchase, amount_off_subtotal, amount_off_subtotal_and_free_shipping, amount_off_subtotal_and_shipping, amount_off_subtotal_with_block_purchase, amount_off_subtotal_with_items_purchase, amount_off_subtotal_with_purchase, amount_shipping_with_subtotal, automatically_apply_coupon_codes, buy_one_get_one, calculated_description, can_be_used_with_other_coupons, coupon_oid, coupon_type, description, discount_item_with_item_purchase, discount_items, expiration_dts, free_item_and_shipping_with_subtotal, free_item_with_item_purchase, free_item_with_item_purchase_and_free_shipping, free_item_with_subtotal, free_items_with_item_purchase, free_items_with_mixmatch_purchase, free_shipping, free_shipping_specific_items, free_shipping_with_items_purchase, free_shipping_with_subtotal, hide_from_customer, merchant_code, merchant_notes, more_loyalty_cashback, more_loyalty_points, multiple_amounts_off_items, no_discount, percent_more_loyalty_cashback, percent_more_loyalty_points, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_msrp_items, percent_off_retail_price_items, percent_off_shipping, percent_off_subtotal, percent_off_subtotal_and_free_shipping, percent_off_subtotal_limit, percent_off_subtotal_with_items_purchase, percent_off_subtotal_with_subtotal, quickbooks_code, restrict_by_postal_codes, restrict_by_screen_branding_theme_codes, restrict_by_storefronts, skip_on_rebill, start_dts, super_coupon, tiered_amount_off_items, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, tiered_percent_off_subtotal_based_on_msrp, usable_by].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/ultracart_api/models/coupon.rb', line 642

def list_invalid_properties
  invalid_properties = Array.new
  if !@coupon_type.nil? && @coupon_type.to_s.length > 65
    invalid_properties.push('invalid value for "coupon_type", the character length must be smaller than or equal to 65.')
  end

  if !@description.nil? && @description.to_s.length > 50
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 50.')
  end

  if !@merchant_code.nil? && @merchant_code.to_s.length > 20
    invalid_properties.push('invalid value for "merchant_code", the character length must be smaller than or equal to 20.')
  end

  if !@merchant_notes.nil? && @merchant_notes.to_s.length > 250
    invalid_properties.push('invalid value for "merchant_notes", the character length must be smaller than or equal to 250.')
  end

  if !@quickbooks_code.nil? && @quickbooks_code.to_s.length > 20
    invalid_properties.push('invalid value for "quickbooks_code", the character length must be smaller than or equal to 20.')
  end

  if !@usable_by.nil? && @usable_by.to_s.length > 50
    invalid_properties.push('invalid value for "usable_by", the character length must be smaller than or equal to 50.')
  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



912
913
914
# File 'lib/ultracart_api/models/coupon.rb', line 912

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



918
919
920
921
922
923
924
925
926
927
928
929
930
# File 'lib/ultracart_api/models/coupon.rb', line 918

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



906
907
908
# File 'lib/ultracart_api/models/coupon.rb', line 906

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



673
674
675
676
677
678
679
680
681
682
683
# File 'lib/ultracart_api/models/coupon.rb', line 673

def valid?
  return false if !@coupon_type.nil? && @coupon_type.to_s.length > 65
  return false if !@description.nil? && @description.to_s.length > 50
  return false if !@merchant_code.nil? && @merchant_code.to_s.length > 20
  return false if !@merchant_notes.nil? && @merchant_notes.to_s.length > 250
  return false if !@quickbooks_code.nil? && @quickbooks_code.to_s.length > 20
  usable_by_validator = EnumAttributeValidator.new('String', ["Anyone", "UniqueCode", "OncePerCustomer", "OncePerNewCustomer", "OncePerNewCustomerForItem"])
  return false unless usable_by_validator.valid?(@usable_by)
  return false if !@usable_by.nil? && @usable_by.to_s.length > 50
  true
end