ultracart_api 4.1.12 → 4.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/docs/AffiliateApi.md +123 -167
- data/docs/AutoOrderApi.md +1250 -903
- data/docs/ChannelPartnerApi.md +1678 -1121
- data/docs/ChargebackApi.md +297 -405
- data/docs/CheckoutApi.md +1622 -1424
- data/docs/Conversation.md +4 -0
- data/docs/ConversationApi.md +4820 -6315
- data/docs/CouponApi.md +1522 -1443
- data/docs/CustomerApi.md +2570 -1845
- data/docs/DatawarehouseApi.md +555 -723
- data/docs/FulfillmentApi.md +567 -441
- data/docs/GiftCertificateApi.md +617 -598
- data/docs/IntegrationLogApi.md +290 -385
- data/docs/ItemApi.md +2174 -1746
- data/docs/ItemRestriction.md +2 -0
- data/docs/OauthApi.md +203 -163
- data/docs/OrderApi.md +2774 -2177
- data/docs/SsoApi.md +223 -288
- data/docs/StorefrontApi.md +9692 -12967
- data/docs/TaxApi.md +1541 -2017
- data/docs/UserApi.md +606 -790
- data/docs/WebhookApi.md +787 -628
- data/docs/WorkflowApi.md +666 -879
- data/lib/ultracart_api/models/conversation.rb +21 -1
- data/lib/ultracart_api/models/item_restriction.rb +11 -1
- data/lib/ultracart_api/version.rb +1 -1
- metadata +2 -2
data/docs/CouponApi.md
CHANGED
@@ -1,1443 +1,1522 @@
|
|
1
|
-
# UltracartClient::CouponApi
|
2
|
-
|
3
|
-
All URIs are relative to *https://secure.ultracart.com/rest/v2*
|
4
|
-
|
5
|
-
| Method | HTTP request | Description |
|
6
|
-
| ------ | ------------ | ----------- |
|
7
|
-
| [**delete_coupon**](CouponApi.md#delete_coupon) | **DELETE** /coupon/coupons/{coupon_oid} | Delete a coupon |
|
8
|
-
| [**delete_coupons_by_code**](CouponApi.md#delete_coupons_by_code) | **DELETE** /coupon/coupons/by_code | Deletes multiple coupons |
|
9
|
-
| [**delete_coupons_by_oid**](CouponApi.md#delete_coupons_by_oid) | **DELETE** /coupon/coupons/by_oid | Deletes multiple coupons |
|
10
|
-
| [**does_coupon_code_exist**](CouponApi.md#does_coupon_code_exist) | **GET** /coupon/coupons/merchant_code/{merchant_code}/exists | Determines if a coupon merchant code already exists |
|
11
|
-
| [**generate_coupon_codes**](CouponApi.md#generate_coupon_codes) | **POST** /coupon/coupons/{coupon_oid}/generate_codes | Generates one time codes for a coupon |
|
12
|
-
| [**generate_one_time_codes_by_merchant_code**](CouponApi.md#generate_one_time_codes_by_merchant_code) | **POST** /coupon/coupons/merchant_code/{merchant_code}/generate_codes | Generates one time codes by merchant code |
|
13
|
-
| [**get_auto_apply**](CouponApi.md#get_auto_apply) | **GET** /coupon/auto_apply | Retrieve auto apply rules and conditions |
|
14
|
-
| [**get_coupon**](CouponApi.md#get_coupon) | **GET** /coupon/coupons/{coupon_oid} | Retrieve a coupon |
|
15
|
-
| [**get_coupon_by_merchant_code**](CouponApi.md#get_coupon_by_merchant_code) | **GET** /coupon/coupons/merchant_code/{merchant_code} | Retrieve a coupon by merchant code |
|
16
|
-
| [**get_coupons**](CouponApi.md#get_coupons) | **GET** /coupon/coupons | Retrieve coupons |
|
17
|
-
| [**get_coupons_by_query**](CouponApi.md#get_coupons_by_query) | **POST** /coupon/coupons/query | Retrieve coupons by query |
|
18
|
-
| [**get_editor_values**](CouponApi.md#get_editor_values) | **GET** /coupon/editor_values | Retrieve values needed for a coupon editor |
|
19
|
-
| [**insert_coupon**](CouponApi.md#insert_coupon) | **POST** /coupon/coupons | Insert a coupon |
|
20
|
-
| [**insert_coupons**](CouponApi.md#insert_coupons) | **POST** /coupon/coupons/batch | Insert multiple coupons |
|
21
|
-
| [**search_items**](CouponApi.md#search_items) | **GET** /coupon/searchItems | Searches for items to display within a coupon editor and assign to coupons |
|
22
|
-
| [**update_auto_apply**](CouponApi.md#update_auto_apply) | **POST** /coupon/auto_apply | Update auto apply rules and conditions |
|
23
|
-
| [**update_coupon**](CouponApi.md#update_coupon) | **PUT** /coupon/coupons/{coupon_oid} | Update a coupon |
|
24
|
-
| [**update_coupons**](CouponApi.md#update_coupons) | **PUT** /coupon/coupons/batch | Update multiple coupons |
|
25
|
-
| [**upload_coupon_codes**](CouponApi.md#upload_coupon_codes) | **POST** /coupon/coupons/{coupon_oid}/upload_codes | Upload one-time codes for a coupon |
|
26
|
-
|
27
|
-
|
28
|
-
## delete_coupon
|
29
|
-
|
30
|
-
> delete_coupon(coupon_oid)
|
31
|
-
|
32
|
-
Delete a coupon
|
33
|
-
|
34
|
-
Delete a coupon on the UltraCart account.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
require '
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
```
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
###
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
#
|
124
|
-
|
125
|
-
rescue UltracartClient::ApiError => e
|
126
|
-
puts "Error when calling CouponApi->
|
127
|
-
end
|
128
|
-
```
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
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
|
-
|
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
|
-
Generates one time codes for a coupon
|
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
|
-
|
422
|
-
```ruby
|
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
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
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
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
p
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
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
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
[
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
begin
|
875
|
-
# Retrieve
|
876
|
-
|
877
|
-
p
|
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
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
#
|
1012
|
-
#
|
1013
|
-
#
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
```
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
###
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
```
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
p
|
1190
|
-
p
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
Update
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
require '
|
1231
|
-
require_relative '../constants'
|
1232
|
-
|
1233
|
-
#
|
1234
|
-
#
|
1235
|
-
#
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
###
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
#### Using the
|
1332
|
-
|
1333
|
-
This returns an Array which contains the response data, status code and headers.
|
1334
|
-
|
1335
|
-
> <Array(<
|
1336
|
-
|
1337
|
-
```ruby
|
1338
|
-
begin
|
1339
|
-
# Update
|
1340
|
-
data, status_code, headers = api_instance.
|
1341
|
-
p status_code # => 2xx
|
1342
|
-
p headers # => { ... }
|
1343
|
-
p data # => <
|
1344
|
-
rescue UltracartClient::ApiError => e
|
1345
|
-
puts "Error when calling CouponApi->
|
1346
|
-
end
|
1347
|
-
```
|
1348
|
-
|
1349
|
-
### Parameters
|
1350
|
-
|
1351
|
-
| Name | Type | Description | Notes |
|
1352
|
-
| ---- | ---- | ----------- | ----- |
|
1353
|
-
| **
|
1354
|
-
| **
|
1355
|
-
| **
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
- **
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
### Examples
|
1381
|
-
|
1382
|
-
```ruby
|
1383
|
-
require '
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
#
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
```
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
p
|
1418
|
-
p
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
| **
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1
|
+
# UltracartClient::CouponApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://secure.ultracart.com/rest/v2*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**delete_coupon**](CouponApi.md#delete_coupon) | **DELETE** /coupon/coupons/{coupon_oid} | Delete a coupon |
|
8
|
+
| [**delete_coupons_by_code**](CouponApi.md#delete_coupons_by_code) | **DELETE** /coupon/coupons/by_code | Deletes multiple coupons |
|
9
|
+
| [**delete_coupons_by_oid**](CouponApi.md#delete_coupons_by_oid) | **DELETE** /coupon/coupons/by_oid | Deletes multiple coupons |
|
10
|
+
| [**does_coupon_code_exist**](CouponApi.md#does_coupon_code_exist) | **GET** /coupon/coupons/merchant_code/{merchant_code}/exists | Determines if a coupon merchant code already exists |
|
11
|
+
| [**generate_coupon_codes**](CouponApi.md#generate_coupon_codes) | **POST** /coupon/coupons/{coupon_oid}/generate_codes | Generates one time codes for a coupon |
|
12
|
+
| [**generate_one_time_codes_by_merchant_code**](CouponApi.md#generate_one_time_codes_by_merchant_code) | **POST** /coupon/coupons/merchant_code/{merchant_code}/generate_codes | Generates one time codes by merchant code |
|
13
|
+
| [**get_auto_apply**](CouponApi.md#get_auto_apply) | **GET** /coupon/auto_apply | Retrieve auto apply rules and conditions |
|
14
|
+
| [**get_coupon**](CouponApi.md#get_coupon) | **GET** /coupon/coupons/{coupon_oid} | Retrieve a coupon |
|
15
|
+
| [**get_coupon_by_merchant_code**](CouponApi.md#get_coupon_by_merchant_code) | **GET** /coupon/coupons/merchant_code/{merchant_code} | Retrieve a coupon by merchant code |
|
16
|
+
| [**get_coupons**](CouponApi.md#get_coupons) | **GET** /coupon/coupons | Retrieve coupons |
|
17
|
+
| [**get_coupons_by_query**](CouponApi.md#get_coupons_by_query) | **POST** /coupon/coupons/query | Retrieve coupons by query |
|
18
|
+
| [**get_editor_values**](CouponApi.md#get_editor_values) | **GET** /coupon/editor_values | Retrieve values needed for a coupon editor |
|
19
|
+
| [**insert_coupon**](CouponApi.md#insert_coupon) | **POST** /coupon/coupons | Insert a coupon |
|
20
|
+
| [**insert_coupons**](CouponApi.md#insert_coupons) | **POST** /coupon/coupons/batch | Insert multiple coupons |
|
21
|
+
| [**search_items**](CouponApi.md#search_items) | **GET** /coupon/searchItems | Searches for items to display within a coupon editor and assign to coupons |
|
22
|
+
| [**update_auto_apply**](CouponApi.md#update_auto_apply) | **POST** /coupon/auto_apply | Update auto apply rules and conditions |
|
23
|
+
| [**update_coupon**](CouponApi.md#update_coupon) | **PUT** /coupon/coupons/{coupon_oid} | Update a coupon |
|
24
|
+
| [**update_coupons**](CouponApi.md#update_coupons) | **PUT** /coupon/coupons/batch | Update multiple coupons |
|
25
|
+
| [**upload_coupon_codes**](CouponApi.md#upload_coupon_codes) | **POST** /coupon/coupons/{coupon_oid}/upload_codes | Upload one-time codes for a coupon |
|
26
|
+
|
27
|
+
|
28
|
+
## delete_coupon
|
29
|
+
|
30
|
+
> delete_coupon(coupon_oid)
|
31
|
+
|
32
|
+
Delete a coupon
|
33
|
+
|
34
|
+
Delete a coupon on the UltraCart account.
|
35
|
+
|
36
|
+
|
37
|
+
### Examples
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require_relative '../constants'
|
41
|
+
require 'ultracart_api'
|
42
|
+
|
43
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
44
|
+
coupon_oid = 123456789
|
45
|
+
|
46
|
+
coupon_api.delete_coupon(coupon_oid)
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
#### Using the delete_coupon_with_http_info variant
|
51
|
+
|
52
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
53
|
+
|
54
|
+
> <Array(nil, Integer, Hash)> delete_coupon_with_http_info(coupon_oid)
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
begin
|
58
|
+
# Delete a coupon
|
59
|
+
data, status_code, headers = api_instance.delete_coupon_with_http_info(coupon_oid)
|
60
|
+
p status_code # => 2xx
|
61
|
+
p headers # => { ... }
|
62
|
+
p data # => nil
|
63
|
+
rescue UltracartClient::ApiError => e
|
64
|
+
puts "Error when calling CouponApi->delete_coupon_with_http_info: #{e}"
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
### Parameters
|
69
|
+
|
70
|
+
| Name | Type | Description | Notes |
|
71
|
+
| ---- | ---- | ----------- | ----- |
|
72
|
+
| **coupon_oid** | **Integer** | The coupon_oid to delete. | |
|
73
|
+
|
74
|
+
### Return type
|
75
|
+
|
76
|
+
nil (empty response body)
|
77
|
+
|
78
|
+
### Authorization
|
79
|
+
|
80
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
81
|
+
|
82
|
+
### HTTP request headers
|
83
|
+
|
84
|
+
- **Content-Type**: Not defined
|
85
|
+
- **Accept**: application/json
|
86
|
+
|
87
|
+
|
88
|
+
## delete_coupons_by_code
|
89
|
+
|
90
|
+
> delete_coupons_by_code(coupon_delete_request)
|
91
|
+
|
92
|
+
Deletes multiple coupons
|
93
|
+
|
94
|
+
Delete coupons on the UltraCart account.
|
95
|
+
|
96
|
+
|
97
|
+
### Examples
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
require_relative '../constants'
|
101
|
+
require 'ultracart_api'
|
102
|
+
|
103
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
104
|
+
merchant_code = '10OFF'
|
105
|
+
delete_request = UltracartClient::CouponDeletesRequest.new
|
106
|
+
delete_request.coupon_codes = [merchant_code]
|
107
|
+
|
108
|
+
coupon_api.delete_coupons_by_code(delete_request)
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
#### Using the delete_coupons_by_code_with_http_info variant
|
113
|
+
|
114
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
115
|
+
|
116
|
+
> <Array(nil, Integer, Hash)> delete_coupons_by_code_with_http_info(coupon_delete_request)
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
begin
|
120
|
+
# Deletes multiple coupons
|
121
|
+
data, status_code, headers = api_instance.delete_coupons_by_code_with_http_info(coupon_delete_request)
|
122
|
+
p status_code # => 2xx
|
123
|
+
p headers # => { ... }
|
124
|
+
p data # => nil
|
125
|
+
rescue UltracartClient::ApiError => e
|
126
|
+
puts "Error when calling CouponApi->delete_coupons_by_code_with_http_info: #{e}"
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
### Parameters
|
131
|
+
|
132
|
+
| Name | Type | Description | Notes |
|
133
|
+
| ---- | ---- | ----------- | ----- |
|
134
|
+
| **coupon_delete_request** | [**CouponDeletesRequest**](CouponDeletesRequest.md) | Coupon oids to delete | |
|
135
|
+
|
136
|
+
### Return type
|
137
|
+
|
138
|
+
nil (empty response body)
|
139
|
+
|
140
|
+
### Authorization
|
141
|
+
|
142
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
143
|
+
|
144
|
+
### HTTP request headers
|
145
|
+
|
146
|
+
- **Content-Type**: application/json
|
147
|
+
- **Accept**: application/json
|
148
|
+
|
149
|
+
|
150
|
+
## delete_coupons_by_oid
|
151
|
+
|
152
|
+
> delete_coupons_by_oid(coupon_delete_request)
|
153
|
+
|
154
|
+
Deletes multiple coupons
|
155
|
+
|
156
|
+
Delete coupons on the UltraCart account.
|
157
|
+
|
158
|
+
|
159
|
+
### Examples
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
require_relative '../constants'
|
163
|
+
require 'ultracart_api'
|
164
|
+
|
165
|
+
# This method is useful if you have the coupons stored in your own system along with their coupon_oids. If not,
|
166
|
+
# just use delete_coupons_by_code()
|
167
|
+
|
168
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
169
|
+
delete_request = UltracartClient::CouponDeletesRequest.new
|
170
|
+
delete_request.coupon_oids = [1234567, 2345678, 3456789]
|
171
|
+
|
172
|
+
coupon_api.delete_coupons_by_oid(delete_request)
|
173
|
+
```
|
174
|
+
|
175
|
+
|
176
|
+
#### Using the delete_coupons_by_oid_with_http_info variant
|
177
|
+
|
178
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
179
|
+
|
180
|
+
> <Array(nil, Integer, Hash)> delete_coupons_by_oid_with_http_info(coupon_delete_request)
|
181
|
+
|
182
|
+
```ruby
|
183
|
+
begin
|
184
|
+
# Deletes multiple coupons
|
185
|
+
data, status_code, headers = api_instance.delete_coupons_by_oid_with_http_info(coupon_delete_request)
|
186
|
+
p status_code # => 2xx
|
187
|
+
p headers # => { ... }
|
188
|
+
p data # => nil
|
189
|
+
rescue UltracartClient::ApiError => e
|
190
|
+
puts "Error when calling CouponApi->delete_coupons_by_oid_with_http_info: #{e}"
|
191
|
+
end
|
192
|
+
```
|
193
|
+
|
194
|
+
### Parameters
|
195
|
+
|
196
|
+
| Name | Type | Description | Notes |
|
197
|
+
| ---- | ---- | ----------- | ----- |
|
198
|
+
| **coupon_delete_request** | [**CouponDeletesRequest**](CouponDeletesRequest.md) | Coupon oids to delete | |
|
199
|
+
|
200
|
+
### Return type
|
201
|
+
|
202
|
+
nil (empty response body)
|
203
|
+
|
204
|
+
### Authorization
|
205
|
+
|
206
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
207
|
+
|
208
|
+
### HTTP request headers
|
209
|
+
|
210
|
+
- **Content-Type**: application/json
|
211
|
+
- **Accept**: application/json
|
212
|
+
|
213
|
+
|
214
|
+
## does_coupon_code_exist
|
215
|
+
|
216
|
+
> <CouponExistsResponse> does_coupon_code_exist(merchant_code)
|
217
|
+
|
218
|
+
Determines if a coupon merchant code already exists
|
219
|
+
|
220
|
+
Determines if a coupon merchant code already exists.
|
221
|
+
|
222
|
+
|
223
|
+
### Examples
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
require_relative '../constants'
|
227
|
+
require 'ultracart_api'
|
228
|
+
|
229
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
230
|
+
merchant_code = '10OFF'
|
231
|
+
|
232
|
+
api_response = coupon_api.does_coupon_code_exist(merchant_code)
|
233
|
+
coupon_exists = api_response.exists
|
234
|
+
|
235
|
+
puts api_response.inspect
|
236
|
+
```
|
237
|
+
|
238
|
+
|
239
|
+
#### Using the does_coupon_code_exist_with_http_info variant
|
240
|
+
|
241
|
+
This returns an Array which contains the response data, status code and headers.
|
242
|
+
|
243
|
+
> <Array(<CouponExistsResponse>, Integer, Hash)> does_coupon_code_exist_with_http_info(merchant_code)
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
begin
|
247
|
+
# Determines if a coupon merchant code already exists
|
248
|
+
data, status_code, headers = api_instance.does_coupon_code_exist_with_http_info(merchant_code)
|
249
|
+
p status_code # => 2xx
|
250
|
+
p headers # => { ... }
|
251
|
+
p data # => <CouponExistsResponse>
|
252
|
+
rescue UltracartClient::ApiError => e
|
253
|
+
puts "Error when calling CouponApi->does_coupon_code_exist_with_http_info: #{e}"
|
254
|
+
end
|
255
|
+
```
|
256
|
+
|
257
|
+
### Parameters
|
258
|
+
|
259
|
+
| Name | Type | Description | Notes |
|
260
|
+
| ---- | ---- | ----------- | ----- |
|
261
|
+
| **merchant_code** | **String** | The coupon merchant code to examine. | |
|
262
|
+
|
263
|
+
### Return type
|
264
|
+
|
265
|
+
[**CouponExistsResponse**](CouponExistsResponse.md)
|
266
|
+
|
267
|
+
### Authorization
|
268
|
+
|
269
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
270
|
+
|
271
|
+
### HTTP request headers
|
272
|
+
|
273
|
+
- **Content-Type**: Not defined
|
274
|
+
- **Accept**: application/json
|
275
|
+
|
276
|
+
|
277
|
+
## generate_coupon_codes
|
278
|
+
|
279
|
+
> <CouponCodesResponse> generate_coupon_codes(coupon_oid, coupon_codes_request)
|
280
|
+
|
281
|
+
Generates one time codes for a coupon
|
282
|
+
|
283
|
+
Generate one time codes for a coupon
|
284
|
+
|
285
|
+
|
286
|
+
### Examples
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
require_relative '../constants'
|
290
|
+
require 'ultracart_api'
|
291
|
+
|
292
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
293
|
+
coupon_oid = 12345678 # if you don't know your coupon_oid, use generate_one_time_codes_by_merchant_code. same results
|
294
|
+
|
295
|
+
codes_request = UltracartClient::CouponCodesRequest.new
|
296
|
+
codes_request.quantity = 100 # give me 100 codes.
|
297
|
+
codes_request.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:00' # do you want the codes to expire?
|
298
|
+
# codes_request.expiration_seconds # also an option for short-lived coupons
|
299
|
+
|
300
|
+
api_response = coupon_api.generate_coupon_codes(coupon_oid, codes_request)
|
301
|
+
coupon_codes = api_response.coupon_codes
|
302
|
+
```
|
303
|
+
|
304
|
+
|
305
|
+
#### Using the generate_coupon_codes_with_http_info variant
|
306
|
+
|
307
|
+
This returns an Array which contains the response data, status code and headers.
|
308
|
+
|
309
|
+
> <Array(<CouponCodesResponse>, Integer, Hash)> generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request)
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
begin
|
313
|
+
# Generates one time codes for a coupon
|
314
|
+
data, status_code, headers = api_instance.generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request)
|
315
|
+
p status_code # => 2xx
|
316
|
+
p headers # => { ... }
|
317
|
+
p data # => <CouponCodesResponse>
|
318
|
+
rescue UltracartClient::ApiError => e
|
319
|
+
puts "Error when calling CouponApi->generate_coupon_codes_with_http_info: #{e}"
|
320
|
+
end
|
321
|
+
```
|
322
|
+
|
323
|
+
### Parameters
|
324
|
+
|
325
|
+
| Name | Type | Description | Notes |
|
326
|
+
| ---- | ---- | ----------- | ----- |
|
327
|
+
| **coupon_oid** | **Integer** | The coupon oid to generate codes. | |
|
328
|
+
| **coupon_codes_request** | [**CouponCodesRequest**](CouponCodesRequest.md) | Coupon code generation parameters | |
|
329
|
+
|
330
|
+
### Return type
|
331
|
+
|
332
|
+
[**CouponCodesResponse**](CouponCodesResponse.md)
|
333
|
+
|
334
|
+
### Authorization
|
335
|
+
|
336
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
337
|
+
|
338
|
+
### HTTP request headers
|
339
|
+
|
340
|
+
- **Content-Type**: application/json; charset=UTF-8
|
341
|
+
- **Accept**: application/json
|
342
|
+
|
343
|
+
|
344
|
+
## generate_one_time_codes_by_merchant_code
|
345
|
+
|
346
|
+
> <CouponCodesResponse> generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request)
|
347
|
+
|
348
|
+
Generates one time codes by merchant code
|
349
|
+
|
350
|
+
Generate one time codes by merchant code
|
351
|
+
|
352
|
+
|
353
|
+
### Examples
|
354
|
+
|
355
|
+
```ruby
|
356
|
+
require_relative '../constants'
|
357
|
+
require 'ultracart_api'
|
358
|
+
|
359
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
360
|
+
coupon_oid = 12345678 # if you don't know your coupon_oid, use generate_one_time_codes_by_merchant_code. same results
|
361
|
+
|
362
|
+
codes_request = UltracartClient::CouponCodesRequest.new
|
363
|
+
codes_request.quantity = 100 # give me 100 codes.
|
364
|
+
codes_request.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:00' # do you want the codes to expire?
|
365
|
+
# codes_request.expiration_seconds # also an option for short-lived coupons
|
366
|
+
|
367
|
+
api_response = coupon_api.generate_coupon_codes(coupon_oid, codes_request)
|
368
|
+
coupon_codes = api_response.coupon_codes
|
369
|
+
```
|
370
|
+
|
371
|
+
|
372
|
+
#### Using the generate_one_time_codes_by_merchant_code_with_http_info variant
|
373
|
+
|
374
|
+
This returns an Array which contains the response data, status code and headers.
|
375
|
+
|
376
|
+
> <Array(<CouponCodesResponse>, Integer, Hash)> generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request)
|
377
|
+
|
378
|
+
```ruby
|
379
|
+
begin
|
380
|
+
# Generates one time codes by merchant code
|
381
|
+
data, status_code, headers = api_instance.generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request)
|
382
|
+
p status_code # => 2xx
|
383
|
+
p headers # => { ... }
|
384
|
+
p data # => <CouponCodesResponse>
|
385
|
+
rescue UltracartClient::ApiError => e
|
386
|
+
puts "Error when calling CouponApi->generate_one_time_codes_by_merchant_code_with_http_info: #{e}"
|
387
|
+
end
|
388
|
+
```
|
389
|
+
|
390
|
+
### Parameters
|
391
|
+
|
392
|
+
| Name | Type | Description | Notes |
|
393
|
+
| ---- | ---- | ----------- | ----- |
|
394
|
+
| **merchant_code** | **String** | The merchant code to generate one time codes. | |
|
395
|
+
| **coupon_codes_request** | [**CouponCodesRequest**](CouponCodesRequest.md) | Coupon code generation parameters | |
|
396
|
+
|
397
|
+
### Return type
|
398
|
+
|
399
|
+
[**CouponCodesResponse**](CouponCodesResponse.md)
|
400
|
+
|
401
|
+
### Authorization
|
402
|
+
|
403
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
404
|
+
|
405
|
+
### HTTP request headers
|
406
|
+
|
407
|
+
- **Content-Type**: application/json; charset=UTF-8
|
408
|
+
- **Accept**: application/json
|
409
|
+
|
410
|
+
|
411
|
+
## get_auto_apply
|
412
|
+
|
413
|
+
> <CouponAutoApplyConditions> get_auto_apply
|
414
|
+
|
415
|
+
Retrieve auto apply rules and conditions
|
416
|
+
|
417
|
+
Retrieve auto apply rules and conditions
|
418
|
+
|
419
|
+
|
420
|
+
### Examples
|
421
|
+
|
422
|
+
```ruby
|
423
|
+
require_relative '../constants'
|
424
|
+
require 'ultracart_api'
|
425
|
+
|
426
|
+
=begin
|
427
|
+
getAutoApply returns back the items and subtotals that trigger "auto coupons", i.e. coupons that are automatically
|
428
|
+
added to a shopping cart. The manual configuration of auto coupons is at the bottom of the main coupons screen.
|
429
|
+
See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1376525/Coupons#Coupons-Navigation
|
430
|
+
=end
|
431
|
+
|
432
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
433
|
+
api_response = coupon_api.get_auto_apply
|
434
|
+
|
435
|
+
puts 'These are the subtotal levels:'
|
436
|
+
api_response.subtotal_levels.each do |subtotal_level|
|
437
|
+
puts subtotal_level.inspect
|
438
|
+
end
|
439
|
+
|
440
|
+
puts "\nThese are the item triggers:"
|
441
|
+
api_response.required_items.each do |required_item|
|
442
|
+
puts required_item.inspect
|
443
|
+
end
|
444
|
+
```
|
445
|
+
|
446
|
+
|
447
|
+
#### Using the get_auto_apply_with_http_info variant
|
448
|
+
|
449
|
+
This returns an Array which contains the response data, status code and headers.
|
450
|
+
|
451
|
+
> <Array(<CouponAutoApplyConditions>, Integer, Hash)> get_auto_apply_with_http_info
|
452
|
+
|
453
|
+
```ruby
|
454
|
+
begin
|
455
|
+
# Retrieve auto apply rules and conditions
|
456
|
+
data, status_code, headers = api_instance.get_auto_apply_with_http_info
|
457
|
+
p status_code # => 2xx
|
458
|
+
p headers # => { ... }
|
459
|
+
p data # => <CouponAutoApplyConditions>
|
460
|
+
rescue UltracartClient::ApiError => e
|
461
|
+
puts "Error when calling CouponApi->get_auto_apply_with_http_info: #{e}"
|
462
|
+
end
|
463
|
+
```
|
464
|
+
|
465
|
+
### Parameters
|
466
|
+
|
467
|
+
This endpoint does not need any parameter.
|
468
|
+
|
469
|
+
### Return type
|
470
|
+
|
471
|
+
[**CouponAutoApplyConditions**](CouponAutoApplyConditions.md)
|
472
|
+
|
473
|
+
### Authorization
|
474
|
+
|
475
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
476
|
+
|
477
|
+
### HTTP request headers
|
478
|
+
|
479
|
+
- **Content-Type**: Not defined
|
480
|
+
- **Accept**: application/json
|
481
|
+
|
482
|
+
|
483
|
+
## get_coupon
|
484
|
+
|
485
|
+
> <CouponResponse> get_coupon(coupon_oid, opts)
|
486
|
+
|
487
|
+
Retrieve a coupon
|
488
|
+
|
489
|
+
Retrieves a single coupon using the specified coupon profile oid.
|
490
|
+
|
491
|
+
|
492
|
+
### Examples
|
493
|
+
|
494
|
+
```ruby
|
495
|
+
require_relative '../constants'
|
496
|
+
require 'ultracart_api'
|
497
|
+
|
498
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
499
|
+
coupon_oid = 123456789
|
500
|
+
|
501
|
+
# coupons do not have expansions
|
502
|
+
api_response = coupon_api.get_coupon(coupon_oid, { _expand: nil })
|
503
|
+
|
504
|
+
puts api_response.inspect
|
505
|
+
```
|
506
|
+
|
507
|
+
|
508
|
+
#### Using the get_coupon_with_http_info variant
|
509
|
+
|
510
|
+
This returns an Array which contains the response data, status code and headers.
|
511
|
+
|
512
|
+
> <Array(<CouponResponse>, Integer, Hash)> get_coupon_with_http_info(coupon_oid, opts)
|
513
|
+
|
514
|
+
```ruby
|
515
|
+
begin
|
516
|
+
# Retrieve a coupon
|
517
|
+
data, status_code, headers = api_instance.get_coupon_with_http_info(coupon_oid, opts)
|
518
|
+
p status_code # => 2xx
|
519
|
+
p headers # => { ... }
|
520
|
+
p data # => <CouponResponse>
|
521
|
+
rescue UltracartClient::ApiError => e
|
522
|
+
puts "Error when calling CouponApi->get_coupon_with_http_info: #{e}"
|
523
|
+
end
|
524
|
+
```
|
525
|
+
|
526
|
+
### Parameters
|
527
|
+
|
528
|
+
| Name | Type | Description | Notes |
|
529
|
+
| ---- | ---- | ----------- | ----- |
|
530
|
+
| **coupon_oid** | **Integer** | The coupon oid to retrieve. | |
|
531
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
532
|
+
|
533
|
+
### Return type
|
534
|
+
|
535
|
+
[**CouponResponse**](CouponResponse.md)
|
536
|
+
|
537
|
+
### Authorization
|
538
|
+
|
539
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
540
|
+
|
541
|
+
### HTTP request headers
|
542
|
+
|
543
|
+
- **Content-Type**: Not defined
|
544
|
+
- **Accept**: application/json
|
545
|
+
|
546
|
+
|
547
|
+
## get_coupon_by_merchant_code
|
548
|
+
|
549
|
+
> <CouponResponse> get_coupon_by_merchant_code(merchant_code, opts)
|
550
|
+
|
551
|
+
Retrieve a coupon by merchant code
|
552
|
+
|
553
|
+
Retrieves a single coupon using the specified merchant code.
|
554
|
+
|
555
|
+
|
556
|
+
### Examples
|
557
|
+
|
558
|
+
```ruby
|
559
|
+
require_relative '../constants'
|
560
|
+
require 'ultracart_api'
|
561
|
+
|
562
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
563
|
+
api_response = coupon_api.get_coupon_by_merchant_code('10OFF')
|
564
|
+
|
565
|
+
puts api_response.inspect
|
566
|
+
```
|
567
|
+
|
568
|
+
|
569
|
+
#### Using the get_coupon_by_merchant_code_with_http_info variant
|
570
|
+
|
571
|
+
This returns an Array which contains the response data, status code and headers.
|
572
|
+
|
573
|
+
> <Array(<CouponResponse>, Integer, Hash)> get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
|
574
|
+
|
575
|
+
```ruby
|
576
|
+
begin
|
577
|
+
# Retrieve a coupon by merchant code
|
578
|
+
data, status_code, headers = api_instance.get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
|
579
|
+
p status_code # => 2xx
|
580
|
+
p headers # => { ... }
|
581
|
+
p data # => <CouponResponse>
|
582
|
+
rescue UltracartClient::ApiError => e
|
583
|
+
puts "Error when calling CouponApi->get_coupon_by_merchant_code_with_http_info: #{e}"
|
584
|
+
end
|
585
|
+
```
|
586
|
+
|
587
|
+
### Parameters
|
588
|
+
|
589
|
+
| Name | Type | Description | Notes |
|
590
|
+
| ---- | ---- | ----------- | ----- |
|
591
|
+
| **merchant_code** | **String** | The coupon merchant code to retrieve. | |
|
592
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
593
|
+
|
594
|
+
### Return type
|
595
|
+
|
596
|
+
[**CouponResponse**](CouponResponse.md)
|
597
|
+
|
598
|
+
### Authorization
|
599
|
+
|
600
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
601
|
+
|
602
|
+
### HTTP request headers
|
603
|
+
|
604
|
+
- **Content-Type**: Not defined
|
605
|
+
- **Accept**: application/json
|
606
|
+
|
607
|
+
|
608
|
+
## get_coupons
|
609
|
+
|
610
|
+
> <CouponsResponse> get_coupons(opts)
|
611
|
+
|
612
|
+
Retrieve coupons
|
613
|
+
|
614
|
+
Retrieves coupons for this account. If no parameters are specified, all coupons will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
|
615
|
+
|
616
|
+
|
617
|
+
### Examples
|
618
|
+
|
619
|
+
```ruby
|
620
|
+
require_relative '../constants'
|
621
|
+
require 'ultracart_api'
|
622
|
+
|
623
|
+
# Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
|
624
|
+
# Error help: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/39077885/Troubleshooting+API+Errors
|
625
|
+
# Additional Docs: https://www.ultracart.com/api/#introduction.html
|
626
|
+
|
627
|
+
# This is an old example. Please see get_coupons_by_query as they do essentially the same thing, but
|
628
|
+
# get_coupons_by_query is easier to use.
|
629
|
+
|
630
|
+
# returns a block of customers
|
631
|
+
# @param coupon_api [UltracartClient::CouponApi]
|
632
|
+
# @param offset [Integer] pagination variable
|
633
|
+
# @param limit [Integer] pagination variable. max server will allow is 200
|
634
|
+
# @return [Array<UltracartClient::Coupon>]
|
635
|
+
def get_coupons_chunk(coupon_api, offset = 0, limit = 200)
|
636
|
+
# TODO: consider using get_coupons_by_query() as it does not require all search parameters
|
637
|
+
merchant_code = nil
|
638
|
+
description = nil
|
639
|
+
coupon_type = nil
|
640
|
+
start_date_begin = nil
|
641
|
+
start_date_end = nil
|
642
|
+
expiration_date_begin = nil
|
643
|
+
expiration_date_end = nil
|
644
|
+
affiliate_oid = nil
|
645
|
+
exclude_expired = nil
|
646
|
+
|
647
|
+
# getCoupons doesn't have any expansions. full record is always returned.
|
648
|
+
opts = {
|
649
|
+
merchant_code: merchant_code,
|
650
|
+
description: description,
|
651
|
+
coupon_type: coupon_type,
|
652
|
+
start_date_begin: start_date_begin,
|
653
|
+
start_date_end: start_date_end,
|
654
|
+
expiration_date_begin: expiration_date_begin,
|
655
|
+
expiration_date_end: expiration_date_end,
|
656
|
+
affiliate_oid: affiliate_oid,
|
657
|
+
exclude_expired: exclude_expired,
|
658
|
+
_limit: limit,
|
659
|
+
_offset: offset,
|
660
|
+
_sort: nil,
|
661
|
+
_expand: nil
|
662
|
+
}
|
663
|
+
|
664
|
+
get_response = coupon_api.get_coupons(opts)
|
665
|
+
|
666
|
+
return get_response.coupons if get_response.success
|
667
|
+
|
668
|
+
[]
|
669
|
+
end
|
670
|
+
|
671
|
+
begin
|
672
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
673
|
+
coupons = []
|
674
|
+
|
675
|
+
iteration = 1
|
676
|
+
offset = 0
|
677
|
+
limit = 200
|
678
|
+
need_more_records = true
|
679
|
+
|
680
|
+
while need_more_records
|
681
|
+
puts "executing iteration ##{iteration}"
|
682
|
+
iteration += 1
|
683
|
+
|
684
|
+
block_of_customers = get_coupons_chunk(coupon_api, offset, limit)
|
685
|
+
coupons.concat(block_of_customers)
|
686
|
+
|
687
|
+
offset += limit
|
688
|
+
need_more_records = block_of_customers.length == limit
|
689
|
+
# sleep(1) # I'm testing rate limiter headers. this should probably be uncommented. maybe.
|
690
|
+
end
|
691
|
+
|
692
|
+
puts coupons.inspect
|
693
|
+
|
694
|
+
rescue UltracartClient::ApiError => e
|
695
|
+
puts "API Exception when calling CouponApi->get_coupons: #{e.message}"
|
696
|
+
puts e.response_body.inspect
|
697
|
+
rescue StandardError => e
|
698
|
+
puts "Exception when calling CouponApi->get_coupons: #{e.message}"
|
699
|
+
end
|
700
|
+
```
|
701
|
+
|
702
|
+
|
703
|
+
#### Using the get_coupons_with_http_info variant
|
704
|
+
|
705
|
+
This returns an Array which contains the response data, status code and headers.
|
706
|
+
|
707
|
+
> <Array(<CouponsResponse>, Integer, Hash)> get_coupons_with_http_info(opts)
|
708
|
+
|
709
|
+
```ruby
|
710
|
+
begin
|
711
|
+
# Retrieve coupons
|
712
|
+
data, status_code, headers = api_instance.get_coupons_with_http_info(opts)
|
713
|
+
p status_code # => 2xx
|
714
|
+
p headers # => { ... }
|
715
|
+
p data # => <CouponsResponse>
|
716
|
+
rescue UltracartClient::ApiError => e
|
717
|
+
puts "Error when calling CouponApi->get_coupons_with_http_info: #{e}"
|
718
|
+
end
|
719
|
+
```
|
720
|
+
|
721
|
+
### Parameters
|
722
|
+
|
723
|
+
| Name | Type | Description | Notes |
|
724
|
+
| ---- | ---- | ----------- | ----- |
|
725
|
+
| **merchant_code** | **String** | Merchant code | [optional] |
|
726
|
+
| **description** | **String** | Description | [optional] |
|
727
|
+
| **coupon_type** | **String** | Coupon type | [optional] |
|
728
|
+
| **start_date_begin** | **String** | Start date begin | [optional] |
|
729
|
+
| **start_date_end** | **String** | Start date end | [optional] |
|
730
|
+
| **expiration_date_begin** | **String** | Expiration date begin | [optional] |
|
731
|
+
| **expiration_date_end** | **String** | Expiration date end | [optional] |
|
732
|
+
| **affiliate_oid** | **Integer** | Affiliate oid | [optional] |
|
733
|
+
| **exclude_expired** | **Boolean** | Exclude expired | [optional] |
|
734
|
+
| **_limit** | **Integer** | The maximum number of records to return on this one API call. (Max 200) | [optional][default to 100] |
|
735
|
+
| **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
|
736
|
+
| **_sort** | **String** | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
|
737
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
738
|
+
|
739
|
+
### Return type
|
740
|
+
|
741
|
+
[**CouponsResponse**](CouponsResponse.md)
|
742
|
+
|
743
|
+
### Authorization
|
744
|
+
|
745
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
746
|
+
|
747
|
+
### HTTP request headers
|
748
|
+
|
749
|
+
- **Content-Type**: Not defined
|
750
|
+
- **Accept**: application/json
|
751
|
+
|
752
|
+
|
753
|
+
## get_coupons_by_query
|
754
|
+
|
755
|
+
> <CouponsResponse> get_coupons_by_query(coupon_query, opts)
|
756
|
+
|
757
|
+
Retrieve coupons by query
|
758
|
+
|
759
|
+
Retrieves coupons from the account. If no parameters are specified, all coupons will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
|
760
|
+
|
761
|
+
|
762
|
+
### Examples
|
763
|
+
|
764
|
+
```ruby
|
765
|
+
require_relative '../constants'
|
766
|
+
require 'ultracart_api'
|
767
|
+
|
768
|
+
=begin
|
769
|
+
retrieves coupons by query. Can filter on specific coupons or return back all coupons. Support pagination.
|
770
|
+
A note about the coupon type below. Those are string literals representing coupons. This method is used UltraCart's
|
771
|
+
backend, and it uses a dropdown box for that value showing friendly descriptions of them.
|
772
|
+
|
773
|
+
It's not anticipated a merchant would need to query by coupon type, but in the event you do, here's the list of constants:
|
774
|
+
"BOGO limit L"
|
775
|
+
"Free shipping method Y"
|
776
|
+
"Free shipping method Y with purchase of items Z"
|
777
|
+
"Free shipping method Y with subtotal Z"
|
778
|
+
"Free shipping on item Z"
|
779
|
+
"Free X with purchase of Y dollars limit L"
|
780
|
+
"Free X with purchase of Y dollars limit L and shipping Z"
|
781
|
+
"Free X with purchase of Y limit L"
|
782
|
+
"Free X with purchase of Y limit L and free shipping"
|
783
|
+
"I Free X with every J purchase of Y limit L"
|
784
|
+
"I Free X with every J purchase of Y mix and match group limit L"
|
785
|
+
"Item X for Y with purchase of Z limit L"
|
786
|
+
"multiple X $ off item Z limit L"
|
787
|
+
"No discount"
|
788
|
+
"Tiered Dollar Off Subtotal"
|
789
|
+
"Tiered % off items Z limit L"
|
790
|
+
"Tiered $ off item Z limit L"
|
791
|
+
"Tiered Percent off shipping methods Y with subtotal Z"
|
792
|
+
"Tiered Percent Off Subtotal"
|
793
|
+
"X dollars off shipping method Y with purchase of items Z"
|
794
|
+
"X dollars off subtotal with purchase Y items"
|
795
|
+
"X $ for item Z limit L"
|
796
|
+
"X more loyalty cashback"
|
797
|
+
"X more loyalty points"
|
798
|
+
"X % off item Z and free shipping"
|
799
|
+
"X $ off item Z limit L"
|
800
|
+
"X % off item Z limit L"
|
801
|
+
"X % off msrp item Z limit L"
|
802
|
+
"X % off retail item Z limit L"
|
803
|
+
"X $ off shipping method Y"
|
804
|
+
"X % off shipping method Y"
|
805
|
+
"X $ off subtotal"
|
806
|
+
"X % off subtotal"
|
807
|
+
"X $ off subtotal and shipping"
|
808
|
+
"X % off subtotal free shipping method Y"
|
809
|
+
"X % off subtotal limit L"
|
810
|
+
"X off subtotal with purchase block of L item Y"
|
811
|
+
"X % off subtotal with purchase of item Y"
|
812
|
+
"X % off subtotal with purchase of Y"
|
813
|
+
"X $ off subtotal with Y $ purchase"
|
814
|
+
"X $ off subtotal with Y $ purchase and free shipping"
|
815
|
+
"X % off Y with purchase Z limit L"
|
816
|
+
"X % off Y with T purchase Z limit L"
|
817
|
+
"X percent more loyalty points"
|
818
|
+
"X $ shipping method Y with subtotal Z"
|
819
|
+
"X ? subtotal"
|
820
|
+
=end
|
821
|
+
|
822
|
+
def get_coupon_chunk(coupon_api, offset, limit)
|
823
|
+
query = UltracartClient::CouponQuery.new
|
824
|
+
query.merchant_code = '10OFF' # supports partial matching
|
825
|
+
query.description = 'Saturday' # supports partial matching
|
826
|
+
# query.coupon_type = nil # see the note at the top of this sample.
|
827
|
+
# query.start_dts_begin = (Date.today - 2000).strftime('%Y-%m-%d') + 'T00:00:00+00:00' # yes, that 2,000 days.
|
828
|
+
# query.start_dts_end = Date.today.strftime('%Y-%m-%d') + 'T00:00:00+00:00'
|
829
|
+
# query.expiration_dts_begin = nil
|
830
|
+
# query.expiration_dts_end = nil
|
831
|
+
# query.affiliate_oid = 0 # this requires an affiliate_oid. If you need help finding an affiliate's oid, contact support.
|
832
|
+
query.exclude_expired = true
|
833
|
+
|
834
|
+
# coupons do not have expansions
|
835
|
+
# Possible sorts: "coupon_type", "merchant_code", "description", "start_dts", "expiration_dts", "quickbooks_code"
|
836
|
+
opts = {
|
837
|
+
_expand: nil,
|
838
|
+
_sort: 'merchant_code'
|
839
|
+
}
|
840
|
+
|
841
|
+
api_response = coupon_api.get_coupons_by_query(query, limit, offset, opts)
|
842
|
+
return api_response.coupons if api_response.coupons
|
843
|
+
[]
|
844
|
+
end
|
845
|
+
|
846
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
847
|
+
coupons = []
|
848
|
+
|
849
|
+
iteration = 1
|
850
|
+
offset = 0
|
851
|
+
limit = 200
|
852
|
+
more_records_to_fetch = true
|
853
|
+
|
854
|
+
while more_records_to_fetch
|
855
|
+
puts "executing iteration #{iteration}"
|
856
|
+
chunk_of_coupons = get_coupon_chunk(coupon_api, offset, limit)
|
857
|
+
coupons.concat(chunk_of_coupons)
|
858
|
+
offset += limit
|
859
|
+
more_records_to_fetch = chunk_of_coupons.length == limit
|
860
|
+
iteration += 1
|
861
|
+
end
|
862
|
+
|
863
|
+
puts coupons.inspect
|
864
|
+
```
|
865
|
+
|
866
|
+
|
867
|
+
#### Using the get_coupons_by_query_with_http_info variant
|
868
|
+
|
869
|
+
This returns an Array which contains the response data, status code and headers.
|
870
|
+
|
871
|
+
> <Array(<CouponsResponse>, Integer, Hash)> get_coupons_by_query_with_http_info(coupon_query, opts)
|
872
|
+
|
873
|
+
```ruby
|
874
|
+
begin
|
875
|
+
# Retrieve coupons by query
|
876
|
+
data, status_code, headers = api_instance.get_coupons_by_query_with_http_info(coupon_query, opts)
|
877
|
+
p status_code # => 2xx
|
878
|
+
p headers # => { ... }
|
879
|
+
p data # => <CouponsResponse>
|
880
|
+
rescue UltracartClient::ApiError => e
|
881
|
+
puts "Error when calling CouponApi->get_coupons_by_query_with_http_info: #{e}"
|
882
|
+
end
|
883
|
+
```
|
884
|
+
|
885
|
+
### Parameters
|
886
|
+
|
887
|
+
| Name | Type | Description | Notes |
|
888
|
+
| ---- | ---- | ----------- | ----- |
|
889
|
+
| **coupon_query** | [**CouponQuery**](CouponQuery.md) | Coupon query | |
|
890
|
+
| **_limit** | **Integer** | The maximum number of records to return on this one API call. (Max 200) | [optional][default to 100] |
|
891
|
+
| **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
|
892
|
+
| **_sort** | **String** | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
|
893
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
894
|
+
|
895
|
+
### Return type
|
896
|
+
|
897
|
+
[**CouponsResponse**](CouponsResponse.md)
|
898
|
+
|
899
|
+
### Authorization
|
900
|
+
|
901
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
902
|
+
|
903
|
+
### HTTP request headers
|
904
|
+
|
905
|
+
- **Content-Type**: application/json
|
906
|
+
- **Accept**: application/json
|
907
|
+
|
908
|
+
|
909
|
+
## get_editor_values
|
910
|
+
|
911
|
+
> <CouponEditorValues> get_editor_values
|
912
|
+
|
913
|
+
Retrieve values needed for a coupon editor
|
914
|
+
|
915
|
+
Retrieve values needed for a coupon editor
|
916
|
+
|
917
|
+
|
918
|
+
### Examples
|
919
|
+
|
920
|
+
```ruby
|
921
|
+
# This is an internal method used by our Coupon management screen. It returns back all the static data needed
|
922
|
+
# for our dropdown lists, such as coupon constants. You can call it if you like, but the data won't be
|
923
|
+
# of much use.
|
924
|
+
```
|
925
|
+
|
926
|
+
|
927
|
+
#### Using the get_editor_values_with_http_info variant
|
928
|
+
|
929
|
+
This returns an Array which contains the response data, status code and headers.
|
930
|
+
|
931
|
+
> <Array(<CouponEditorValues>, Integer, Hash)> get_editor_values_with_http_info
|
932
|
+
|
933
|
+
```ruby
|
934
|
+
begin
|
935
|
+
# Retrieve values needed for a coupon editor
|
936
|
+
data, status_code, headers = api_instance.get_editor_values_with_http_info
|
937
|
+
p status_code # => 2xx
|
938
|
+
p headers # => { ... }
|
939
|
+
p data # => <CouponEditorValues>
|
940
|
+
rescue UltracartClient::ApiError => e
|
941
|
+
puts "Error when calling CouponApi->get_editor_values_with_http_info: #{e}"
|
942
|
+
end
|
943
|
+
```
|
944
|
+
|
945
|
+
### Parameters
|
946
|
+
|
947
|
+
This endpoint does not need any parameter.
|
948
|
+
|
949
|
+
### Return type
|
950
|
+
|
951
|
+
[**CouponEditorValues**](CouponEditorValues.md)
|
952
|
+
|
953
|
+
### Authorization
|
954
|
+
|
955
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
956
|
+
|
957
|
+
### HTTP request headers
|
958
|
+
|
959
|
+
- **Content-Type**: Not defined
|
960
|
+
- **Accept**: application/json
|
961
|
+
|
962
|
+
|
963
|
+
## insert_coupon
|
964
|
+
|
965
|
+
> <CouponResponse> insert_coupon(coupon, opts)
|
966
|
+
|
967
|
+
Insert a coupon
|
968
|
+
|
969
|
+
Insert a coupon on the UltraCart account.
|
970
|
+
|
971
|
+
|
972
|
+
### Examples
|
973
|
+
|
974
|
+
```ruby
|
975
|
+
require 'ultracart_api'
|
976
|
+
require_relative '../constants'
|
977
|
+
|
978
|
+
# Initialize the coupon API
|
979
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
980
|
+
|
981
|
+
# Create a new coupon
|
982
|
+
coupon = UltracartClient::Coupon.new
|
983
|
+
coupon.merchant_code = '11OFF'
|
984
|
+
coupon.description = 'Eleven dollars off subtotal'
|
985
|
+
|
986
|
+
# each coupon must have a 'type' defined by creating a child object directly beneath the main Coupon object.
|
987
|
+
# this is complex and there are a LOT of coupon types. See the backend (secure.ultracart.com) coupon screens
|
988
|
+
# to get an idea of what functionality each coupon possesses. If you're not sure, contact UltraCart support.
|
989
|
+
coupon.amount_off_subtotal = UltracartClient::CouponAmountOffSubtotal.new
|
990
|
+
coupon.amount_off_subtotal.discount_amount = 11
|
991
|
+
|
992
|
+
# Here are the different coupon types, but beware that new coupons are added frequently.
|
993
|
+
#CouponAmountOffItems
|
994
|
+
#CouponAmountOffShipping
|
995
|
+
#CouponAmountOffShippingWithItemsPurchase
|
996
|
+
#CouponAmountOffSubtotal
|
997
|
+
#CouponAmountOffSubtotalAndShipping
|
998
|
+
#CouponAmountOffSubtotalFreeShippingWithPurchase
|
999
|
+
#CouponAmountOffSubtotalWithBlockPurchase
|
1000
|
+
#CouponAmountOffSubtotalWithItemsPurchase
|
1001
|
+
#CouponAmountOffSubtotalWithPurchase
|
1002
|
+
#CouponAmountShippingWithSubtotal
|
1003
|
+
#CouponDiscountItems
|
1004
|
+
#CouponDiscountItemWithItemPurchase
|
1005
|
+
#CouponFreeItemAndShippingWithSubtotal
|
1006
|
+
#CouponFreeItemsWithItemPurchase
|
1007
|
+
#CouponFreeItemsWithMixMatchPurchase
|
1008
|
+
#CouponFreeItemWithItemPurchase
|
1009
|
+
#CouponFreeItemWithItemPurchaseAndFreeShipping
|
1010
|
+
#CouponFreeItemWithSubtotal
|
1011
|
+
#CouponFreeShipping
|
1012
|
+
#CouponFreeShippingSpecificItems
|
1013
|
+
#CouponFreeShippingWithItemsPurchase
|
1014
|
+
#CouponFreeShippingWithSubtotal
|
1015
|
+
#CouponMoreLoyaltyCashback
|
1016
|
+
#CouponMoreLoyaltyPoints
|
1017
|
+
#CouponMultipleAmountsOffItems
|
1018
|
+
#CouponNoDiscount
|
1019
|
+
#CouponPercentMoreLoyaltyCashback
|
1020
|
+
#CouponPercentMoreLoyaltyPoints
|
1021
|
+
#CouponPercentOffItems
|
1022
|
+
#CouponPercentOffItemsAndFreeShipping
|
1023
|
+
#CouponPercentOffItemsWithItemsPurchase
|
1024
|
+
#CouponPercentOffItemWithItemsQuantityPurchase
|
1025
|
+
#CouponPercentOffMsrpItems
|
1026
|
+
#CouponPercentOffRetailPriceItems
|
1027
|
+
#CouponPercentOffShipping
|
1028
|
+
#CouponPercentOffSubtotal
|
1029
|
+
#CouponPercentOffSubtotalAndFreeShipping
|
1030
|
+
#CouponPercentOffSubtotalLimit
|
1031
|
+
#CouponPercentOffSubtotalWithItemsPurchase
|
1032
|
+
#CouponPercentOffSubtotalWithSubtotal
|
1033
|
+
#CouponTieredAmountOffItems
|
1034
|
+
#CouponTieredAmountOffSubtotal
|
1035
|
+
#CouponTieredPercentOffItems
|
1036
|
+
#CouponTieredPercentOffShipping
|
1037
|
+
#CouponTieredPercentOffSubtotal
|
1038
|
+
#CouponTieredPercentOffSubtotalBasedOnMSRP
|
1039
|
+
#CouponTierItemDiscount
|
1040
|
+
#CouponTierPercent
|
1041
|
+
#CouponTierQuantityAmount
|
1042
|
+
#CouponTierQuantityPercent
|
1043
|
+
|
1044
|
+
# coupons do not have expansions
|
1045
|
+
api_response = coupon_api.insert_coupon(coupon, {_expand: nil})
|
1046
|
+
puts api_response
|
1047
|
+
```
|
1048
|
+
|
1049
|
+
|
1050
|
+
#### Using the insert_coupon_with_http_info variant
|
1051
|
+
|
1052
|
+
This returns an Array which contains the response data, status code and headers.
|
1053
|
+
|
1054
|
+
> <Array(<CouponResponse>, Integer, Hash)> insert_coupon_with_http_info(coupon, opts)
|
1055
|
+
|
1056
|
+
```ruby
|
1057
|
+
begin
|
1058
|
+
# Insert a coupon
|
1059
|
+
data, status_code, headers = api_instance.insert_coupon_with_http_info(coupon, opts)
|
1060
|
+
p status_code # => 2xx
|
1061
|
+
p headers # => { ... }
|
1062
|
+
p data # => <CouponResponse>
|
1063
|
+
rescue UltracartClient::ApiError => e
|
1064
|
+
puts "Error when calling CouponApi->insert_coupon_with_http_info: #{e}"
|
1065
|
+
end
|
1066
|
+
```
|
1067
|
+
|
1068
|
+
### Parameters
|
1069
|
+
|
1070
|
+
| Name | Type | Description | Notes |
|
1071
|
+
| ---- | ---- | ----------- | ----- |
|
1072
|
+
| **coupon** | [**Coupon**](Coupon.md) | Coupon to insert | |
|
1073
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1074
|
+
|
1075
|
+
### Return type
|
1076
|
+
|
1077
|
+
[**CouponResponse**](CouponResponse.md)
|
1078
|
+
|
1079
|
+
### Authorization
|
1080
|
+
|
1081
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1082
|
+
|
1083
|
+
### HTTP request headers
|
1084
|
+
|
1085
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1086
|
+
- **Accept**: application/json
|
1087
|
+
|
1088
|
+
|
1089
|
+
## insert_coupons
|
1090
|
+
|
1091
|
+
> <CouponsResponse> insert_coupons(coupons_request, opts)
|
1092
|
+
|
1093
|
+
Insert multiple coupons
|
1094
|
+
|
1095
|
+
Insert multiple coupon on the UltraCart account.
|
1096
|
+
|
1097
|
+
|
1098
|
+
### Examples
|
1099
|
+
|
1100
|
+
```ruby
|
1101
|
+
require 'ultracart_api'
|
1102
|
+
require_relative '../constants'
|
1103
|
+
|
1104
|
+
# Similar to insertCoupon except this method takes a request object containing up to 50 coupons. Please see
|
1105
|
+
# insertCoupon for a detailed example on creating a coupon. It is not repeated here.
|
1106
|
+
|
1107
|
+
# Initialize the coupon API
|
1108
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
1109
|
+
|
1110
|
+
coupons_request = UltracartClient::CouponsRequest.new
|
1111
|
+
coupons = []
|
1112
|
+
# TODO: add Coupons() to this array (see insertCoupon sample for help)
|
1113
|
+
coupons_request.coupons = coupons
|
1114
|
+
|
1115
|
+
# coupons do not have expansions or placeholders
|
1116
|
+
api_response = coupon_api.insert_coupons(coupons_request, {_expand: nil, _placeholders: nil})
|
1117
|
+
puts api_response
|
1118
|
+
```
|
1119
|
+
|
1120
|
+
|
1121
|
+
#### Using the insert_coupons_with_http_info variant
|
1122
|
+
|
1123
|
+
This returns an Array which contains the response data, status code and headers.
|
1124
|
+
|
1125
|
+
> <Array(<CouponsResponse>, Integer, Hash)> insert_coupons_with_http_info(coupons_request, opts)
|
1126
|
+
|
1127
|
+
```ruby
|
1128
|
+
begin
|
1129
|
+
# Insert multiple coupons
|
1130
|
+
data, status_code, headers = api_instance.insert_coupons_with_http_info(coupons_request, opts)
|
1131
|
+
p status_code # => 2xx
|
1132
|
+
p headers # => { ... }
|
1133
|
+
p data # => <CouponsResponse>
|
1134
|
+
rescue UltracartClient::ApiError => e
|
1135
|
+
puts "Error when calling CouponApi->insert_coupons_with_http_info: #{e}"
|
1136
|
+
end
|
1137
|
+
```
|
1138
|
+
|
1139
|
+
### Parameters
|
1140
|
+
|
1141
|
+
| Name | Type | Description | Notes |
|
1142
|
+
| ---- | ---- | ----------- | ----- |
|
1143
|
+
| **coupons_request** | [**CouponsRequest**](CouponsRequest.md) | Coupons to insert (maximum 50) | |
|
1144
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1145
|
+
| **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
|
1146
|
+
|
1147
|
+
### Return type
|
1148
|
+
|
1149
|
+
[**CouponsResponse**](CouponsResponse.md)
|
1150
|
+
|
1151
|
+
### Authorization
|
1152
|
+
|
1153
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1154
|
+
|
1155
|
+
### HTTP request headers
|
1156
|
+
|
1157
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1158
|
+
- **Accept**: application/json
|
1159
|
+
|
1160
|
+
|
1161
|
+
## search_items
|
1162
|
+
|
1163
|
+
> <CouponItemSearchResultsResponse> search_items(opts)
|
1164
|
+
|
1165
|
+
Searches for items to display within a coupon editor and assign to coupons
|
1166
|
+
|
1167
|
+
Searches for items to display within a coupon editor and assign to coupons
|
1168
|
+
|
1169
|
+
|
1170
|
+
### Examples
|
1171
|
+
|
1172
|
+
```ruby
|
1173
|
+
# This is an internal method used by our Coupon management screen. It searches merchant items to display in
|
1174
|
+
# some of the coupon editor dropdowns. See ItemApi.getItemsByQuery if you need to search items. This method
|
1175
|
+
# is inflexible and geared toward our UI.
|
1176
|
+
```
|
1177
|
+
|
1178
|
+
|
1179
|
+
#### Using the search_items_with_http_info variant
|
1180
|
+
|
1181
|
+
This returns an Array which contains the response data, status code and headers.
|
1182
|
+
|
1183
|
+
> <Array(<CouponItemSearchResultsResponse>, Integer, Hash)> search_items_with_http_info(opts)
|
1184
|
+
|
1185
|
+
```ruby
|
1186
|
+
begin
|
1187
|
+
# Searches for items to display within a coupon editor and assign to coupons
|
1188
|
+
data, status_code, headers = api_instance.search_items_with_http_info(opts)
|
1189
|
+
p status_code # => 2xx
|
1190
|
+
p headers # => { ... }
|
1191
|
+
p data # => <CouponItemSearchResultsResponse>
|
1192
|
+
rescue UltracartClient::ApiError => e
|
1193
|
+
puts "Error when calling CouponApi->search_items_with_http_info: #{e}"
|
1194
|
+
end
|
1195
|
+
```
|
1196
|
+
|
1197
|
+
### Parameters
|
1198
|
+
|
1199
|
+
| Name | Type | Description | Notes |
|
1200
|
+
| ---- | ---- | ----------- | ----- |
|
1201
|
+
| **s** | **String** | | [optional] |
|
1202
|
+
| **m** | **Integer** | | [optional] |
|
1203
|
+
|
1204
|
+
### Return type
|
1205
|
+
|
1206
|
+
[**CouponItemSearchResultsResponse**](CouponItemSearchResultsResponse.md)
|
1207
|
+
|
1208
|
+
### Authorization
|
1209
|
+
|
1210
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1211
|
+
|
1212
|
+
### HTTP request headers
|
1213
|
+
|
1214
|
+
- **Content-Type**: Not defined
|
1215
|
+
- **Accept**: application/json
|
1216
|
+
|
1217
|
+
|
1218
|
+
## update_auto_apply
|
1219
|
+
|
1220
|
+
> update_auto_apply(conditions)
|
1221
|
+
|
1222
|
+
Update auto apply rules and conditions
|
1223
|
+
|
1224
|
+
Update auto apply rules and conditions
|
1225
|
+
|
1226
|
+
|
1227
|
+
### Examples
|
1228
|
+
|
1229
|
+
```ruby
|
1230
|
+
require 'ultracart_api'
|
1231
|
+
require_relative '../constants'
|
1232
|
+
|
1233
|
+
# updateAutoApply updates the items and subtotals conditions that trigger "auto coupons", i.e. coupons that are automatically
|
1234
|
+
# added to a shopping cart. The manual configuration of auto coupons is at the bottom of the main coupons screen.
|
1235
|
+
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1376525/Coupons#Coupons-Navigation
|
1236
|
+
|
1237
|
+
# Success is 200 (There is no content. Yes, this should return a 204, but it returns a 200 with no content)
|
1238
|
+
|
1239
|
+
# Initialize the coupon API
|
1240
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
1241
|
+
|
1242
|
+
auto_apply = UltracartClient::CouponAutoApplyConditions.new
|
1243
|
+
|
1244
|
+
item_condition = UltracartClient::CouponAutoApplyCondition.new
|
1245
|
+
item_condition.required_item_id = 'ITEM_ABC'
|
1246
|
+
item_condition.coupon_code = '10OFF'
|
1247
|
+
item_conditions = [item_condition]
|
1248
|
+
|
1249
|
+
subtotal_condition = UltracartClient::CouponAutoApplyCondition.new
|
1250
|
+
subtotal_condition.minimum_subtotal = 50 # must spend fifty dollars
|
1251
|
+
item_condition.coupon_code = '5OFF'
|
1252
|
+
subtotal_conditions = [subtotal_condition]
|
1253
|
+
|
1254
|
+
auto_apply.required_items = item_conditions
|
1255
|
+
auto_apply.subtotal_levels = subtotal_conditions
|
1256
|
+
|
1257
|
+
coupon_api.update_auto_apply(auto_apply)
|
1258
|
+
```
|
1259
|
+
|
1260
|
+
|
1261
|
+
#### Using the update_auto_apply_with_http_info variant
|
1262
|
+
|
1263
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
1264
|
+
|
1265
|
+
> <Array(nil, Integer, Hash)> update_auto_apply_with_http_info(conditions)
|
1266
|
+
|
1267
|
+
```ruby
|
1268
|
+
begin
|
1269
|
+
# Update auto apply rules and conditions
|
1270
|
+
data, status_code, headers = api_instance.update_auto_apply_with_http_info(conditions)
|
1271
|
+
p status_code # => 2xx
|
1272
|
+
p headers # => { ... }
|
1273
|
+
p data # => nil
|
1274
|
+
rescue UltracartClient::ApiError => e
|
1275
|
+
puts "Error when calling CouponApi->update_auto_apply_with_http_info: #{e}"
|
1276
|
+
end
|
1277
|
+
```
|
1278
|
+
|
1279
|
+
### Parameters
|
1280
|
+
|
1281
|
+
| Name | Type | Description | Notes |
|
1282
|
+
| ---- | ---- | ----------- | ----- |
|
1283
|
+
| **conditions** | [**CouponAutoApplyConditions**](CouponAutoApplyConditions.md) | Conditions | |
|
1284
|
+
|
1285
|
+
### Return type
|
1286
|
+
|
1287
|
+
nil (empty response body)
|
1288
|
+
|
1289
|
+
### Authorization
|
1290
|
+
|
1291
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1292
|
+
|
1293
|
+
### HTTP request headers
|
1294
|
+
|
1295
|
+
- **Content-Type**: application/json
|
1296
|
+
- **Accept**: application/json
|
1297
|
+
|
1298
|
+
|
1299
|
+
## update_coupon
|
1300
|
+
|
1301
|
+
> <CouponResponse> update_coupon(coupon_oid, coupon, opts)
|
1302
|
+
|
1303
|
+
Update a coupon
|
1304
|
+
|
1305
|
+
Update a coupon on the UltraCart account.
|
1306
|
+
|
1307
|
+
|
1308
|
+
### Examples
|
1309
|
+
|
1310
|
+
```ruby
|
1311
|
+
require 'ultracart_api'
|
1312
|
+
require_relative '../constants'
|
1313
|
+
|
1314
|
+
# Initialize the coupon API
|
1315
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
1316
|
+
coupon_oid = 123456789
|
1317
|
+
|
1318
|
+
# coupons do not have expansions
|
1319
|
+
api_response = coupon_api.get_coupon(coupon_oid, {_expand: nil})
|
1320
|
+
coupon = api_response.coupon
|
1321
|
+
|
1322
|
+
# update the coupon. this can be difficult given the complexity of coupons. see insertCoupon sample for details.
|
1323
|
+
coupon.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:00'
|
1324
|
+
|
1325
|
+
api_response = coupon_api.update_coupon(coupon_oid, coupon, {_expand: nil})
|
1326
|
+
updated_coupon = api_response.coupon
|
1327
|
+
puts updated_coupon
|
1328
|
+
```
|
1329
|
+
|
1330
|
+
|
1331
|
+
#### Using the update_coupon_with_http_info variant
|
1332
|
+
|
1333
|
+
This returns an Array which contains the response data, status code and headers.
|
1334
|
+
|
1335
|
+
> <Array(<CouponResponse>, Integer, Hash)> update_coupon_with_http_info(coupon_oid, coupon, opts)
|
1336
|
+
|
1337
|
+
```ruby
|
1338
|
+
begin
|
1339
|
+
# Update a coupon
|
1340
|
+
data, status_code, headers = api_instance.update_coupon_with_http_info(coupon_oid, coupon, opts)
|
1341
|
+
p status_code # => 2xx
|
1342
|
+
p headers # => { ... }
|
1343
|
+
p data # => <CouponResponse>
|
1344
|
+
rescue UltracartClient::ApiError => e
|
1345
|
+
puts "Error when calling CouponApi->update_coupon_with_http_info: #{e}"
|
1346
|
+
end
|
1347
|
+
```
|
1348
|
+
|
1349
|
+
### Parameters
|
1350
|
+
|
1351
|
+
| Name | Type | Description | Notes |
|
1352
|
+
| ---- | ---- | ----------- | ----- |
|
1353
|
+
| **coupon_oid** | **Integer** | The coupon_oid to update. | |
|
1354
|
+
| **coupon** | [**Coupon**](Coupon.md) | Coupon to update | |
|
1355
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1356
|
+
|
1357
|
+
### Return type
|
1358
|
+
|
1359
|
+
[**CouponResponse**](CouponResponse.md)
|
1360
|
+
|
1361
|
+
### Authorization
|
1362
|
+
|
1363
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1364
|
+
|
1365
|
+
### HTTP request headers
|
1366
|
+
|
1367
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1368
|
+
- **Accept**: application/json
|
1369
|
+
|
1370
|
+
|
1371
|
+
## update_coupons
|
1372
|
+
|
1373
|
+
> <CouponsResponse> update_coupons(coupons_request, opts)
|
1374
|
+
|
1375
|
+
Update multiple coupons
|
1376
|
+
|
1377
|
+
Update multiple coupon on the UltraCart account.
|
1378
|
+
|
1379
|
+
|
1380
|
+
### Examples
|
1381
|
+
|
1382
|
+
```ruby
|
1383
|
+
require 'ultracart_api'
|
1384
|
+
require_relative '../constants'
|
1385
|
+
|
1386
|
+
# Initialize the coupon API
|
1387
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
1388
|
+
coupon_oid = 123456789
|
1389
|
+
|
1390
|
+
# coupons do not have expansions or placeholders
|
1391
|
+
api_response = coupon_api.get_coupon(coupon_oid, {_expand: nil})
|
1392
|
+
coupon = api_response.coupon
|
1393
|
+
|
1394
|
+
# update the coupon. this can be difficult given the complexity of coupons. see insertCoupon sample for details.
|
1395
|
+
coupon.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:00'
|
1396
|
+
|
1397
|
+
# This example only has one coupon. But it's a trivial matter to add more coupons
|
1398
|
+
coupons_request = UltracartClient::CouponsRequest.new
|
1399
|
+
coupons_request.coupons = [coupon]
|
1400
|
+
|
1401
|
+
api_response = coupon_api.update_coupons(coupons_request, {_expand: nil, _placeholders: nil})
|
1402
|
+
updated_coupons = api_response.coupons
|
1403
|
+
puts updated_coupons
|
1404
|
+
```
|
1405
|
+
|
1406
|
+
|
1407
|
+
#### Using the update_coupons_with_http_info variant
|
1408
|
+
|
1409
|
+
This returns an Array which contains the response data, status code and headers.
|
1410
|
+
|
1411
|
+
> <Array(<CouponsResponse>, Integer, Hash)> update_coupons_with_http_info(coupons_request, opts)
|
1412
|
+
|
1413
|
+
```ruby
|
1414
|
+
begin
|
1415
|
+
# Update multiple coupons
|
1416
|
+
data, status_code, headers = api_instance.update_coupons_with_http_info(coupons_request, opts)
|
1417
|
+
p status_code # => 2xx
|
1418
|
+
p headers # => { ... }
|
1419
|
+
p data # => <CouponsResponse>
|
1420
|
+
rescue UltracartClient::ApiError => e
|
1421
|
+
puts "Error when calling CouponApi->update_coupons_with_http_info: #{e}"
|
1422
|
+
end
|
1423
|
+
```
|
1424
|
+
|
1425
|
+
### Parameters
|
1426
|
+
|
1427
|
+
| Name | Type | Description | Notes |
|
1428
|
+
| ---- | ---- | ----------- | ----- |
|
1429
|
+
| **coupons_request** | [**CouponsRequest**](CouponsRequest.md) | Coupons to update (synchronous maximum 50 / asynchronous maximum 100) | |
|
1430
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1431
|
+
| **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
|
1432
|
+
| **_async** | **Boolean** | True if the operation should be run async. No result returned | [optional] |
|
1433
|
+
|
1434
|
+
### Return type
|
1435
|
+
|
1436
|
+
[**CouponsResponse**](CouponsResponse.md)
|
1437
|
+
|
1438
|
+
### Authorization
|
1439
|
+
|
1440
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1441
|
+
|
1442
|
+
### HTTP request headers
|
1443
|
+
|
1444
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1445
|
+
- **Accept**: application/json
|
1446
|
+
|
1447
|
+
|
1448
|
+
## upload_coupon_codes
|
1449
|
+
|
1450
|
+
> <UploadCouponCodesResponse> upload_coupon_codes(coupon_oid, upload_coupon_codes_request)
|
1451
|
+
|
1452
|
+
Upload one-time codes for a coupon
|
1453
|
+
|
1454
|
+
Upload one-time codes for a coupon
|
1455
|
+
|
1456
|
+
|
1457
|
+
### Examples
|
1458
|
+
|
1459
|
+
```ruby
|
1460
|
+
require 'ultracart_api'
|
1461
|
+
require_relative '../constants'
|
1462
|
+
|
1463
|
+
# uploadCouponCodes allows a merchant to upload one-time use codes and associate them with a merchant code (i.e. a coupon).
|
1464
|
+
# UltraCart has methods for generating one-time codes, and they work well, but this method exists when the merchant generates
|
1465
|
+
# them themselves. This frequently occurs when a merchant sends out a mailer with unique coupon codes on the mailer. The
|
1466
|
+
# merchant can then upload those codes with this method.
|
1467
|
+
|
1468
|
+
# Initialize the coupon API
|
1469
|
+
coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
1470
|
+
coupon_oid = 12345678 # if you don't know your coupon_oid, use generateOneTimeCodesByMerchantCode. same results
|
1471
|
+
|
1472
|
+
codes_request = UltracartClient::UploadCouponCodesRequest.new
|
1473
|
+
codes_request.coupon_codes = ['code1', 'code2', 'code3']
|
1474
|
+
|
1475
|
+
api_response = coupon_api.upload_coupon_codes(coupon_oid, codes_request)
|
1476
|
+
puts 'Uploaded codes:'
|
1477
|
+
puts api_response.uploaded_codes
|
1478
|
+
puts 'Duplicated codes:'
|
1479
|
+
puts api_response.duplicate_codes
|
1480
|
+
puts 'Rejected codes:'
|
1481
|
+
puts api_response.rejected_codes
|
1482
|
+
```
|
1483
|
+
|
1484
|
+
|
1485
|
+
#### Using the upload_coupon_codes_with_http_info variant
|
1486
|
+
|
1487
|
+
This returns an Array which contains the response data, status code and headers.
|
1488
|
+
|
1489
|
+
> <Array(<UploadCouponCodesResponse>, Integer, Hash)> upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request)
|
1490
|
+
|
1491
|
+
```ruby
|
1492
|
+
begin
|
1493
|
+
# Upload one-time codes for a coupon
|
1494
|
+
data, status_code, headers = api_instance.upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request)
|
1495
|
+
p status_code # => 2xx
|
1496
|
+
p headers # => { ... }
|
1497
|
+
p data # => <UploadCouponCodesResponse>
|
1498
|
+
rescue UltracartClient::ApiError => e
|
1499
|
+
puts "Error when calling CouponApi->upload_coupon_codes_with_http_info: #{e}"
|
1500
|
+
end
|
1501
|
+
```
|
1502
|
+
|
1503
|
+
### Parameters
|
1504
|
+
|
1505
|
+
| Name | Type | Description | Notes |
|
1506
|
+
| ---- | ---- | ----------- | ----- |
|
1507
|
+
| **coupon_oid** | **Integer** | The coupon oid to associate with the provided one-time codes. | |
|
1508
|
+
| **upload_coupon_codes_request** | [**UploadCouponCodesRequest**](UploadCouponCodesRequest.md) | One-time coupon codes | |
|
1509
|
+
|
1510
|
+
### Return type
|
1511
|
+
|
1512
|
+
[**UploadCouponCodesResponse**](UploadCouponCodesResponse.md)
|
1513
|
+
|
1514
|
+
### Authorization
|
1515
|
+
|
1516
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1517
|
+
|
1518
|
+
### HTTP request headers
|
1519
|
+
|
1520
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1521
|
+
- **Accept**: application/json
|
1522
|
+
|