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.
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
- ### Examples
37
-
38
- ```ruby
39
- require 'time'
40
- require 'ultracart_api'
41
- require 'json'
42
- require 'yaml'
43
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
44
-
45
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
46
- # As such, this might not be the best way to use this object.
47
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
48
-
49
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
50
- coupon_oid = 56 # Integer | The coupon_oid to delete.
51
-
52
- begin
53
- # Delete a coupon
54
- api_instance.delete_coupon(coupon_oid)
55
- rescue UltracartClient::ApiError => e
56
- puts "Error when calling CouponApi->delete_coupon: #{e}"
57
- end
58
- ```
59
-
60
- #### Using the delete_coupon_with_http_info variant
61
-
62
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
63
-
64
- > <Array(nil, Integer, Hash)> delete_coupon_with_http_info(coupon_oid)
65
-
66
- ```ruby
67
- begin
68
- # Delete a coupon
69
- data, status_code, headers = api_instance.delete_coupon_with_http_info(coupon_oid)
70
- p status_code # => 2xx
71
- p headers # => { ... }
72
- p data # => nil
73
- rescue UltracartClient::ApiError => e
74
- puts "Error when calling CouponApi->delete_coupon_with_http_info: #{e}"
75
- end
76
- ```
77
-
78
- ### Parameters
79
-
80
- | Name | Type | Description | Notes |
81
- | ---- | ---- | ----------- | ----- |
82
- | **coupon_oid** | **Integer** | The coupon_oid to delete. | |
83
-
84
- ### Return type
85
-
86
- nil (empty response body)
87
-
88
- ### Authorization
89
-
90
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
91
-
92
- ### HTTP request headers
93
-
94
- - **Content-Type**: Not defined
95
- - **Accept**: application/json
96
-
97
-
98
- ## delete_coupons_by_code
99
-
100
- > delete_coupons_by_code(coupon_delete_request)
101
-
102
- Deletes multiple coupons
103
-
104
- Delete coupons on the UltraCart account.
105
-
106
- ### Examples
107
-
108
- ```ruby
109
- require 'time'
110
- require 'ultracart_api'
111
- require 'json'
112
- require 'yaml'
113
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
114
-
115
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
116
- # As such, this might not be the best way to use this object.
117
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
118
-
119
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
120
- coupon_delete_request = UltracartClient::CouponDeletesRequest.new # CouponDeletesRequest | Coupon oids to delete
121
-
122
- begin
123
- # Deletes multiple coupons
124
- api_instance.delete_coupons_by_code(coupon_delete_request)
125
- rescue UltracartClient::ApiError => e
126
- puts "Error when calling CouponApi->delete_coupons_by_code: #{e}"
127
- end
128
- ```
129
-
130
- #### Using the delete_coupons_by_code_with_http_info variant
131
-
132
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
133
-
134
- > <Array(nil, Integer, Hash)> delete_coupons_by_code_with_http_info(coupon_delete_request)
135
-
136
- ```ruby
137
- begin
138
- # Deletes multiple coupons
139
- data, status_code, headers = api_instance.delete_coupons_by_code_with_http_info(coupon_delete_request)
140
- p status_code # => 2xx
141
- p headers # => { ... }
142
- p data # => nil
143
- rescue UltracartClient::ApiError => e
144
- puts "Error when calling CouponApi->delete_coupons_by_code_with_http_info: #{e}"
145
- end
146
- ```
147
-
148
- ### Parameters
149
-
150
- | Name | Type | Description | Notes |
151
- | ---- | ---- | ----------- | ----- |
152
- | **coupon_delete_request** | [**CouponDeletesRequest**](CouponDeletesRequest.md) | Coupon oids to delete | |
153
-
154
- ### Return type
155
-
156
- nil (empty response body)
157
-
158
- ### Authorization
159
-
160
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
161
-
162
- ### HTTP request headers
163
-
164
- - **Content-Type**: application/json
165
- - **Accept**: application/json
166
-
167
-
168
- ## delete_coupons_by_oid
169
-
170
- > delete_coupons_by_oid(coupon_delete_request)
171
-
172
- Deletes multiple coupons
173
-
174
- Delete coupons on the UltraCart account.
175
-
176
- ### Examples
177
-
178
- ```ruby
179
- require 'time'
180
- require 'ultracart_api'
181
- require 'json'
182
- require 'yaml'
183
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
184
-
185
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
186
- # As such, this might not be the best way to use this object.
187
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
188
-
189
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
190
- coupon_delete_request = UltracartClient::CouponDeletesRequest.new # CouponDeletesRequest | Coupon oids to delete
191
-
192
- begin
193
- # Deletes multiple coupons
194
- api_instance.delete_coupons_by_oid(coupon_delete_request)
195
- rescue UltracartClient::ApiError => e
196
- puts "Error when calling CouponApi->delete_coupons_by_oid: #{e}"
197
- end
198
- ```
199
-
200
- #### Using the delete_coupons_by_oid_with_http_info variant
201
-
202
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
203
-
204
- > <Array(nil, Integer, Hash)> delete_coupons_by_oid_with_http_info(coupon_delete_request)
205
-
206
- ```ruby
207
- begin
208
- # Deletes multiple coupons
209
- data, status_code, headers = api_instance.delete_coupons_by_oid_with_http_info(coupon_delete_request)
210
- p status_code # => 2xx
211
- p headers # => { ... }
212
- p data # => nil
213
- rescue UltracartClient::ApiError => e
214
- puts "Error when calling CouponApi->delete_coupons_by_oid_with_http_info: #{e}"
215
- end
216
- ```
217
-
218
- ### Parameters
219
-
220
- | Name | Type | Description | Notes |
221
- | ---- | ---- | ----------- | ----- |
222
- | **coupon_delete_request** | [**CouponDeletesRequest**](CouponDeletesRequest.md) | Coupon oids to delete | |
223
-
224
- ### Return type
225
-
226
- nil (empty response body)
227
-
228
- ### Authorization
229
-
230
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
231
-
232
- ### HTTP request headers
233
-
234
- - **Content-Type**: application/json
235
- - **Accept**: application/json
236
-
237
-
238
- ## does_coupon_code_exist
239
-
240
- > <CouponExistsResponse> does_coupon_code_exist(merchant_code)
241
-
242
- Determines if a coupon merchant code already exists
243
-
244
- Determines if a coupon merchant code already exists.
245
-
246
- ### Examples
247
-
248
- ```ruby
249
- require 'time'
250
- require 'ultracart_api'
251
- require 'json'
252
- require 'yaml'
253
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
254
-
255
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
256
- # As such, this might not be the best way to use this object.
257
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
258
-
259
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
260
- merchant_code = 'merchant_code_example' # String | The coupon merchant code to examine.
261
-
262
- begin
263
- # Determines if a coupon merchant code already exists
264
- result = api_instance.does_coupon_code_exist(merchant_code)
265
- p result
266
- rescue UltracartClient::ApiError => e
267
- puts "Error when calling CouponApi->does_coupon_code_exist: #{e}"
268
- end
269
- ```
270
-
271
- #### Using the does_coupon_code_exist_with_http_info variant
272
-
273
- This returns an Array which contains the response data, status code and headers.
274
-
275
- > <Array(<CouponExistsResponse>, Integer, Hash)> does_coupon_code_exist_with_http_info(merchant_code)
276
-
277
- ```ruby
278
- begin
279
- # Determines if a coupon merchant code already exists
280
- data, status_code, headers = api_instance.does_coupon_code_exist_with_http_info(merchant_code)
281
- p status_code # => 2xx
282
- p headers # => { ... }
283
- p data # => <CouponExistsResponse>
284
- rescue UltracartClient::ApiError => e
285
- puts "Error when calling CouponApi->does_coupon_code_exist_with_http_info: #{e}"
286
- end
287
- ```
288
-
289
- ### Parameters
290
-
291
- | Name | Type | Description | Notes |
292
- | ---- | ---- | ----------- | ----- |
293
- | **merchant_code** | **String** | The coupon merchant code to examine. | |
294
-
295
- ### Return type
296
-
297
- [**CouponExistsResponse**](CouponExistsResponse.md)
298
-
299
- ### Authorization
300
-
301
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
302
-
303
- ### HTTP request headers
304
-
305
- - **Content-Type**: Not defined
306
- - **Accept**: application/json
307
-
308
-
309
- ## generate_coupon_codes
310
-
311
- > <CouponCodesResponse> generate_coupon_codes(coupon_oid, coupon_codes_request)
312
-
313
- Generates one time codes for a coupon
314
-
315
- Generate one time codes for a coupon
316
-
317
- ### Examples
318
-
319
- ```ruby
320
- require 'time'
321
- require 'ultracart_api'
322
- require 'json'
323
- require 'yaml'
324
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
325
-
326
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
327
- # As such, this might not be the best way to use this object.
328
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
329
-
330
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
331
- coupon_oid = 56 # Integer | The coupon oid to generate codes.
332
- coupon_codes_request = UltracartClient::CouponCodesRequest.new # CouponCodesRequest | Coupon code generation parameters
333
-
334
- begin
335
- # Generates one time codes for a coupon
336
- result = api_instance.generate_coupon_codes(coupon_oid, coupon_codes_request)
337
- p result
338
- rescue UltracartClient::ApiError => e
339
- puts "Error when calling CouponApi->generate_coupon_codes: #{e}"
340
- end
341
- ```
342
-
343
- #### Using the generate_coupon_codes_with_http_info variant
344
-
345
- This returns an Array which contains the response data, status code and headers.
346
-
347
- > <Array(<CouponCodesResponse>, Integer, Hash)> generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request)
348
-
349
- ```ruby
350
- begin
351
- # Generates one time codes for a coupon
352
- data, status_code, headers = api_instance.generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request)
353
- p status_code # => 2xx
354
- p headers # => { ... }
355
- p data # => <CouponCodesResponse>
356
- rescue UltracartClient::ApiError => e
357
- puts "Error when calling CouponApi->generate_coupon_codes_with_http_info: #{e}"
358
- end
359
- ```
360
-
361
- ### Parameters
362
-
363
- | Name | Type | Description | Notes |
364
- | ---- | ---- | ----------- | ----- |
365
- | **coupon_oid** | **Integer** | The coupon oid to generate codes. | |
366
- | **coupon_codes_request** | [**CouponCodesRequest**](CouponCodesRequest.md) | Coupon code generation parameters | |
367
-
368
- ### Return type
369
-
370
- [**CouponCodesResponse**](CouponCodesResponse.md)
371
-
372
- ### Authorization
373
-
374
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
375
-
376
- ### HTTP request headers
377
-
378
- - **Content-Type**: application/json; charset=UTF-8
379
- - **Accept**: application/json
380
-
381
-
382
- ## generate_one_time_codes_by_merchant_code
383
-
384
- > <CouponCodesResponse> generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request)
385
-
386
- Generates one time codes by merchant code
387
-
388
- Generate one time codes by merchant code
389
-
390
- ### Examples
391
-
392
- ```ruby
393
- require 'time'
394
- require 'ultracart_api'
395
- require 'json'
396
- require 'yaml'
397
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
398
-
399
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
400
- # As such, this might not be the best way to use this object.
401
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
402
-
403
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
404
- merchant_code = 'merchant_code_example' # String | The merchant code to generate one time codes.
405
- coupon_codes_request = UltracartClient::CouponCodesRequest.new # CouponCodesRequest | Coupon code generation parameters
406
-
407
- begin
408
- # Generates one time codes by merchant code
409
- result = api_instance.generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request)
410
- p result
411
- rescue UltracartClient::ApiError => e
412
- puts "Error when calling CouponApi->generate_one_time_codes_by_merchant_code: #{e}"
413
- end
414
- ```
415
-
416
- #### Using the generate_one_time_codes_by_merchant_code_with_http_info variant
417
-
418
- This returns an Array which contains the response data, status code and headers.
419
-
420
- > <Array(<CouponCodesResponse>, Integer, Hash)> generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request)
421
-
422
- ```ruby
423
- begin
424
- # Generates one time codes by merchant code
425
- data, status_code, headers = api_instance.generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request)
426
- p status_code # => 2xx
427
- p headers # => { ... }
428
- p data # => <CouponCodesResponse>
429
- rescue UltracartClient::ApiError => e
430
- puts "Error when calling CouponApi->generate_one_time_codes_by_merchant_code_with_http_info: #{e}"
431
- end
432
- ```
433
-
434
- ### Parameters
435
-
436
- | Name | Type | Description | Notes |
437
- | ---- | ---- | ----------- | ----- |
438
- | **merchant_code** | **String** | The merchant code to generate one time codes. | |
439
- | **coupon_codes_request** | [**CouponCodesRequest**](CouponCodesRequest.md) | Coupon code generation parameters | |
440
-
441
- ### Return type
442
-
443
- [**CouponCodesResponse**](CouponCodesResponse.md)
444
-
445
- ### Authorization
446
-
447
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
448
-
449
- ### HTTP request headers
450
-
451
- - **Content-Type**: application/json; charset=UTF-8
452
- - **Accept**: application/json
453
-
454
-
455
- ## get_auto_apply
456
-
457
- > <CouponAutoApplyConditions> get_auto_apply
458
-
459
- Retrieve auto apply rules and conditions
460
-
461
- Retrieve auto apply rules and conditions
462
-
463
- ### Examples
464
-
465
- ```ruby
466
- require 'time'
467
- require 'ultracart_api'
468
- require 'json'
469
- require 'yaml'
470
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
471
-
472
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
473
- # As such, this might not be the best way to use this object.
474
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
475
-
476
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
477
-
478
- begin
479
- # Retrieve auto apply rules and conditions
480
- result = api_instance.get_auto_apply
481
- p result
482
- rescue UltracartClient::ApiError => e
483
- puts "Error when calling CouponApi->get_auto_apply: #{e}"
484
- end
485
- ```
486
-
487
- #### Using the get_auto_apply_with_http_info variant
488
-
489
- This returns an Array which contains the response data, status code and headers.
490
-
491
- > <Array(<CouponAutoApplyConditions>, Integer, Hash)> get_auto_apply_with_http_info
492
-
493
- ```ruby
494
- begin
495
- # Retrieve auto apply rules and conditions
496
- data, status_code, headers = api_instance.get_auto_apply_with_http_info
497
- p status_code # => 2xx
498
- p headers # => { ... }
499
- p data # => <CouponAutoApplyConditions>
500
- rescue UltracartClient::ApiError => e
501
- puts "Error when calling CouponApi->get_auto_apply_with_http_info: #{e}"
502
- end
503
- ```
504
-
505
- ### Parameters
506
-
507
- This endpoint does not need any parameter.
508
-
509
- ### Return type
510
-
511
- [**CouponAutoApplyConditions**](CouponAutoApplyConditions.md)
512
-
513
- ### Authorization
514
-
515
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
516
-
517
- ### HTTP request headers
518
-
519
- - **Content-Type**: Not defined
520
- - **Accept**: application/json
521
-
522
-
523
- ## get_coupon
524
-
525
- > <CouponResponse> get_coupon(coupon_oid, opts)
526
-
527
- Retrieve a coupon
528
-
529
- Retrieves a single coupon using the specified coupon profile oid.
530
-
531
- ### Examples
532
-
533
- ```ruby
534
- require 'time'
535
- require 'ultracart_api'
536
- require 'json'
537
- require 'yaml'
538
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
539
-
540
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
541
- # As such, this might not be the best way to use this object.
542
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
543
-
544
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
545
- coupon_oid = 56 # Integer | The coupon oid to retrieve.
546
- opts = {
547
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
548
- }
549
-
550
- begin
551
- # Retrieve a coupon
552
- result = api_instance.get_coupon(coupon_oid, opts)
553
- p result
554
- rescue UltracartClient::ApiError => e
555
- puts "Error when calling CouponApi->get_coupon: #{e}"
556
- end
557
- ```
558
-
559
- #### Using the get_coupon_with_http_info variant
560
-
561
- This returns an Array which contains the response data, status code and headers.
562
-
563
- > <Array(<CouponResponse>, Integer, Hash)> get_coupon_with_http_info(coupon_oid, opts)
564
-
565
- ```ruby
566
- begin
567
- # Retrieve a coupon
568
- data, status_code, headers = api_instance.get_coupon_with_http_info(coupon_oid, opts)
569
- p status_code # => 2xx
570
- p headers # => { ... }
571
- p data # => <CouponResponse>
572
- rescue UltracartClient::ApiError => e
573
- puts "Error when calling CouponApi->get_coupon_with_http_info: #{e}"
574
- end
575
- ```
576
-
577
- ### Parameters
578
-
579
- | Name | Type | Description | Notes |
580
- | ---- | ---- | ----------- | ----- |
581
- | **coupon_oid** | **Integer** | The coupon oid to retrieve. | |
582
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
583
-
584
- ### Return type
585
-
586
- [**CouponResponse**](CouponResponse.md)
587
-
588
- ### Authorization
589
-
590
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
591
-
592
- ### HTTP request headers
593
-
594
- - **Content-Type**: Not defined
595
- - **Accept**: application/json
596
-
597
-
598
- ## get_coupon_by_merchant_code
599
-
600
- > <CouponResponse> get_coupon_by_merchant_code(merchant_code, opts)
601
-
602
- Retrieve a coupon by merchant code
603
-
604
- Retrieves a single coupon using the specified merchant code.
605
-
606
- ### Examples
607
-
608
- ```ruby
609
- require 'time'
610
- require 'ultracart_api'
611
- require 'json'
612
- require 'yaml'
613
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
614
-
615
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
616
- # As such, this might not be the best way to use this object.
617
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
618
-
619
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
620
- merchant_code = 'merchant_code_example' # String | The coupon merchant code to retrieve.
621
- opts = {
622
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
623
- }
624
-
625
- begin
626
- # Retrieve a coupon by merchant code
627
- result = api_instance.get_coupon_by_merchant_code(merchant_code, opts)
628
- p result
629
- rescue UltracartClient::ApiError => e
630
- puts "Error when calling CouponApi->get_coupon_by_merchant_code: #{e}"
631
- end
632
- ```
633
-
634
- #### Using the get_coupon_by_merchant_code_with_http_info variant
635
-
636
- This returns an Array which contains the response data, status code and headers.
637
-
638
- > <Array(<CouponResponse>, Integer, Hash)> get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
639
-
640
- ```ruby
641
- begin
642
- # Retrieve a coupon by merchant code
643
- data, status_code, headers = api_instance.get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
644
- p status_code # => 2xx
645
- p headers # => { ... }
646
- p data # => <CouponResponse>
647
- rescue UltracartClient::ApiError => e
648
- puts "Error when calling CouponApi->get_coupon_by_merchant_code_with_http_info: #{e}"
649
- end
650
- ```
651
-
652
- ### Parameters
653
-
654
- | Name | Type | Description | Notes |
655
- | ---- | ---- | ----------- | ----- |
656
- | **merchant_code** | **String** | The coupon merchant code to retrieve. | |
657
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
658
-
659
- ### Return type
660
-
661
- [**CouponResponse**](CouponResponse.md)
662
-
663
- ### Authorization
664
-
665
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
666
-
667
- ### HTTP request headers
668
-
669
- - **Content-Type**: Not defined
670
- - **Accept**: application/json
671
-
672
-
673
- ## get_coupons
674
-
675
- > <CouponsResponse> get_coupons(opts)
676
-
677
- Retrieve coupons
678
-
679
- 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.
680
-
681
- ### Examples
682
-
683
- ```ruby
684
- require 'time'
685
- require 'ultracart_api'
686
- require 'json'
687
- require 'yaml'
688
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
689
-
690
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
691
- # As such, this might not be the best way to use this object.
692
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
693
-
694
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
695
- opts = {
696
- merchant_code: 'merchant_code_example', # String | Merchant code
697
- description: 'description_example', # String | Description
698
- coupon_type: 'coupon_type_example', # String | Coupon type
699
- start_date_begin: 'start_date_begin_example', # String | Start date begin
700
- start_date_end: 'start_date_end_example', # String | Start date end
701
- expiration_date_begin: 'expiration_date_begin_example', # String | Expiration date begin
702
- expiration_date_end: 'expiration_date_end_example', # String | Expiration date end
703
- affiliate_oid: 56, # Integer | Affiliate oid
704
- exclude_expired: true, # Boolean | Exclude expired
705
- _limit: 56, # Integer | The maximum number of records to return on this one API call. (Max 200)
706
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
707
- _sort: '_sort_example', # String | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
708
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
709
- }
710
-
711
- begin
712
- # Retrieve coupons
713
- result = api_instance.get_coupons(opts)
714
- p result
715
- rescue UltracartClient::ApiError => e
716
- puts "Error when calling CouponApi->get_coupons: #{e}"
717
- end
718
- ```
719
-
720
- #### Using the get_coupons_with_http_info variant
721
-
722
- This returns an Array which contains the response data, status code and headers.
723
-
724
- > <Array(<CouponsResponse>, Integer, Hash)> get_coupons_with_http_info(opts)
725
-
726
- ```ruby
727
- begin
728
- # Retrieve coupons
729
- data, status_code, headers = api_instance.get_coupons_with_http_info(opts)
730
- p status_code # => 2xx
731
- p headers # => { ... }
732
- p data # => <CouponsResponse>
733
- rescue UltracartClient::ApiError => e
734
- puts "Error when calling CouponApi->get_coupons_with_http_info: #{e}"
735
- end
736
- ```
737
-
738
- ### Parameters
739
-
740
- | Name | Type | Description | Notes |
741
- | ---- | ---- | ----------- | ----- |
742
- | **merchant_code** | **String** | Merchant code | [optional] |
743
- | **description** | **String** | Description | [optional] |
744
- | **coupon_type** | **String** | Coupon type | [optional] |
745
- | **start_date_begin** | **String** | Start date begin | [optional] |
746
- | **start_date_end** | **String** | Start date end | [optional] |
747
- | **expiration_date_begin** | **String** | Expiration date begin | [optional] |
748
- | **expiration_date_end** | **String** | Expiration date end | [optional] |
749
- | **affiliate_oid** | **Integer** | Affiliate oid | [optional] |
750
- | **exclude_expired** | **Boolean** | Exclude expired | [optional] |
751
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. (Max 200) | [optional][default to 100] |
752
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
753
- | **_sort** | **String** | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
754
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
755
-
756
- ### Return type
757
-
758
- [**CouponsResponse**](CouponsResponse.md)
759
-
760
- ### Authorization
761
-
762
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
763
-
764
- ### HTTP request headers
765
-
766
- - **Content-Type**: Not defined
767
- - **Accept**: application/json
768
-
769
-
770
- ## get_coupons_by_query
771
-
772
- > <CouponsResponse> get_coupons_by_query(coupon_query, opts)
773
-
774
- Retrieve coupons by query
775
-
776
- 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.
777
-
778
- ### Examples
779
-
780
- ```ruby
781
- require 'time'
782
- require 'ultracart_api'
783
- require 'json'
784
- require 'yaml'
785
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
786
-
787
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
788
- # As such, this might not be the best way to use this object.
789
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
790
-
791
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
792
- coupon_query = UltracartClient::CouponQuery.new # CouponQuery | Coupon query
793
- opts = {
794
- _limit: 56, # Integer | The maximum number of records to return on this one API call. (Max 200)
795
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
796
- _sort: '_sort_example', # String | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
797
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
798
- }
799
-
800
- begin
801
- # Retrieve coupons by query
802
- result = api_instance.get_coupons_by_query(coupon_query, opts)
803
- p result
804
- rescue UltracartClient::ApiError => e
805
- puts "Error when calling CouponApi->get_coupons_by_query: #{e}"
806
- end
807
- ```
808
-
809
- #### Using the get_coupons_by_query_with_http_info variant
810
-
811
- This returns an Array which contains the response data, status code and headers.
812
-
813
- > <Array(<CouponsResponse>, Integer, Hash)> get_coupons_by_query_with_http_info(coupon_query, opts)
814
-
815
- ```ruby
816
- begin
817
- # Retrieve coupons by query
818
- data, status_code, headers = api_instance.get_coupons_by_query_with_http_info(coupon_query, opts)
819
- p status_code # => 2xx
820
- p headers # => { ... }
821
- p data # => <CouponsResponse>
822
- rescue UltracartClient::ApiError => e
823
- puts "Error when calling CouponApi->get_coupons_by_query_with_http_info: #{e}"
824
- end
825
- ```
826
-
827
- ### Parameters
828
-
829
- | Name | Type | Description | Notes |
830
- | ---- | ---- | ----------- | ----- |
831
- | **coupon_query** | [**CouponQuery**](CouponQuery.md) | Coupon query | |
832
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. (Max 200) | [optional][default to 100] |
833
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
834
- | **_sort** | **String** | The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
835
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
836
-
837
- ### Return type
838
-
839
- [**CouponsResponse**](CouponsResponse.md)
840
-
841
- ### Authorization
842
-
843
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
844
-
845
- ### HTTP request headers
846
-
847
- - **Content-Type**: application/json
848
- - **Accept**: application/json
849
-
850
-
851
- ## get_editor_values
852
-
853
- > <CouponEditorValues> get_editor_values
854
-
855
- Retrieve values needed for a coupon editor
856
-
857
- Retrieve values needed for a coupon editor
858
-
859
- ### Examples
860
-
861
- ```ruby
862
- require 'time'
863
- require 'ultracart_api'
864
- require 'json'
865
- require 'yaml'
866
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
867
-
868
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
869
- # As such, this might not be the best way to use this object.
870
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
871
-
872
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
873
-
874
- begin
875
- # Retrieve values needed for a coupon editor
876
- result = api_instance.get_editor_values
877
- p result
878
- rescue UltracartClient::ApiError => e
879
- puts "Error when calling CouponApi->get_editor_values: #{e}"
880
- end
881
- ```
882
-
883
- #### Using the get_editor_values_with_http_info variant
884
-
885
- This returns an Array which contains the response data, status code and headers.
886
-
887
- > <Array(<CouponEditorValues>, Integer, Hash)> get_editor_values_with_http_info
888
-
889
- ```ruby
890
- begin
891
- # Retrieve values needed for a coupon editor
892
- data, status_code, headers = api_instance.get_editor_values_with_http_info
893
- p status_code # => 2xx
894
- p headers # => { ... }
895
- p data # => <CouponEditorValues>
896
- rescue UltracartClient::ApiError => e
897
- puts "Error when calling CouponApi->get_editor_values_with_http_info: #{e}"
898
- end
899
- ```
900
-
901
- ### Parameters
902
-
903
- This endpoint does not need any parameter.
904
-
905
- ### Return type
906
-
907
- [**CouponEditorValues**](CouponEditorValues.md)
908
-
909
- ### Authorization
910
-
911
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
912
-
913
- ### HTTP request headers
914
-
915
- - **Content-Type**: Not defined
916
- - **Accept**: application/json
917
-
918
-
919
- ## insert_coupon
920
-
921
- > <CouponResponse> insert_coupon(coupon, opts)
922
-
923
- Insert a coupon
924
-
925
- Insert a coupon on the UltraCart account.
926
-
927
- ### Examples
928
-
929
- ```ruby
930
- require 'time'
931
- require 'ultracart_api'
932
- require 'json'
933
- require 'yaml'
934
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
935
-
936
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
937
- # As such, this might not be the best way to use this object.
938
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
939
-
940
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
941
- coupon = UltracartClient::Coupon.new # Coupon | Coupon to insert
942
- opts = {
943
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
944
- }
945
-
946
- begin
947
- # Insert a coupon
948
- result = api_instance.insert_coupon(coupon, opts)
949
- p result
950
- rescue UltracartClient::ApiError => e
951
- puts "Error when calling CouponApi->insert_coupon: #{e}"
952
- end
953
- ```
954
-
955
- #### Using the insert_coupon_with_http_info variant
956
-
957
- This returns an Array which contains the response data, status code and headers.
958
-
959
- > <Array(<CouponResponse>, Integer, Hash)> insert_coupon_with_http_info(coupon, opts)
960
-
961
- ```ruby
962
- begin
963
- # Insert a coupon
964
- data, status_code, headers = api_instance.insert_coupon_with_http_info(coupon, opts)
965
- p status_code # => 2xx
966
- p headers # => { ... }
967
- p data # => <CouponResponse>
968
- rescue UltracartClient::ApiError => e
969
- puts "Error when calling CouponApi->insert_coupon_with_http_info: #{e}"
970
- end
971
- ```
972
-
973
- ### Parameters
974
-
975
- | Name | Type | Description | Notes |
976
- | ---- | ---- | ----------- | ----- |
977
- | **coupon** | [**Coupon**](Coupon.md) | Coupon to insert | |
978
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
979
-
980
- ### Return type
981
-
982
- [**CouponResponse**](CouponResponse.md)
983
-
984
- ### Authorization
985
-
986
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
987
-
988
- ### HTTP request headers
989
-
990
- - **Content-Type**: application/json; charset=UTF-8
991
- - **Accept**: application/json
992
-
993
-
994
- ## insert_coupons
995
-
996
- > <CouponsResponse> insert_coupons(coupons_request, opts)
997
-
998
- Insert multiple coupons
999
-
1000
- Insert multiple coupon on the UltraCart account.
1001
-
1002
- ### Examples
1003
-
1004
- ```ruby
1005
- require 'time'
1006
- require 'ultracart_api'
1007
- require 'json'
1008
- require 'yaml'
1009
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1010
-
1011
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1012
- # As such, this might not be the best way to use this object.
1013
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1014
-
1015
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1016
- coupons_request = UltracartClient::CouponsRequest.new # CouponsRequest | Coupons to insert (maximum 50)
1017
- opts = {
1018
- _expand: '_expand_example', # String | The object expansion to perform on the result. See documentation for examples
1019
- _placeholders: true # Boolean | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.
1020
- }
1021
-
1022
- begin
1023
- # Insert multiple coupons
1024
- result = api_instance.insert_coupons(coupons_request, opts)
1025
- p result
1026
- rescue UltracartClient::ApiError => e
1027
- puts "Error when calling CouponApi->insert_coupons: #{e}"
1028
- end
1029
- ```
1030
-
1031
- #### Using the insert_coupons_with_http_info variant
1032
-
1033
- This returns an Array which contains the response data, status code and headers.
1034
-
1035
- > <Array(<CouponsResponse>, Integer, Hash)> insert_coupons_with_http_info(coupons_request, opts)
1036
-
1037
- ```ruby
1038
- begin
1039
- # Insert multiple coupons
1040
- data, status_code, headers = api_instance.insert_coupons_with_http_info(coupons_request, opts)
1041
- p status_code # => 2xx
1042
- p headers # => { ... }
1043
- p data # => <CouponsResponse>
1044
- rescue UltracartClient::ApiError => e
1045
- puts "Error when calling CouponApi->insert_coupons_with_http_info: #{e}"
1046
- end
1047
- ```
1048
-
1049
- ### Parameters
1050
-
1051
- | Name | Type | Description | Notes |
1052
- | ---- | ---- | ----------- | ----- |
1053
- | **coupons_request** | [**CouponsRequest**](CouponsRequest.md) | Coupons to insert (maximum 50) | |
1054
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1055
- | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
1056
-
1057
- ### Return type
1058
-
1059
- [**CouponsResponse**](CouponsResponse.md)
1060
-
1061
- ### Authorization
1062
-
1063
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1064
-
1065
- ### HTTP request headers
1066
-
1067
- - **Content-Type**: application/json; charset=UTF-8
1068
- - **Accept**: application/json
1069
-
1070
-
1071
- ## search_items
1072
-
1073
- > <CouponItemSearchResultsResponse> search_items(opts)
1074
-
1075
- Searches for items to display within a coupon editor and assign to coupons
1076
-
1077
- Searches for items to display within a coupon editor and assign to coupons
1078
-
1079
- ### Examples
1080
-
1081
- ```ruby
1082
- require 'time'
1083
- require 'ultracart_api'
1084
- require 'json'
1085
- require 'yaml'
1086
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1087
-
1088
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1089
- # As such, this might not be the best way to use this object.
1090
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1091
-
1092
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1093
- opts = {
1094
- s: 's_example', # String |
1095
- m: 56 # Integer |
1096
- }
1097
-
1098
- begin
1099
- # Searches for items to display within a coupon editor and assign to coupons
1100
- result = api_instance.search_items(opts)
1101
- p result
1102
- rescue UltracartClient::ApiError => e
1103
- puts "Error when calling CouponApi->search_items: #{e}"
1104
- end
1105
- ```
1106
-
1107
- #### Using the search_items_with_http_info variant
1108
-
1109
- This returns an Array which contains the response data, status code and headers.
1110
-
1111
- > <Array(<CouponItemSearchResultsResponse>, Integer, Hash)> search_items_with_http_info(opts)
1112
-
1113
- ```ruby
1114
- begin
1115
- # Searches for items to display within a coupon editor and assign to coupons
1116
- data, status_code, headers = api_instance.search_items_with_http_info(opts)
1117
- p status_code # => 2xx
1118
- p headers # => { ... }
1119
- p data # => <CouponItemSearchResultsResponse>
1120
- rescue UltracartClient::ApiError => e
1121
- puts "Error when calling CouponApi->search_items_with_http_info: #{e}"
1122
- end
1123
- ```
1124
-
1125
- ### Parameters
1126
-
1127
- | Name | Type | Description | Notes |
1128
- | ---- | ---- | ----------- | ----- |
1129
- | **s** | **String** | | [optional] |
1130
- | **m** | **Integer** | | [optional] |
1131
-
1132
- ### Return type
1133
-
1134
- [**CouponItemSearchResultsResponse**](CouponItemSearchResultsResponse.md)
1135
-
1136
- ### Authorization
1137
-
1138
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1139
-
1140
- ### HTTP request headers
1141
-
1142
- - **Content-Type**: Not defined
1143
- - **Accept**: application/json
1144
-
1145
-
1146
- ## update_auto_apply
1147
-
1148
- > update_auto_apply(conditions)
1149
-
1150
- Update auto apply rules and conditions
1151
-
1152
- Update auto apply rules and conditions
1153
-
1154
- ### Examples
1155
-
1156
- ```ruby
1157
- require 'time'
1158
- require 'ultracart_api'
1159
- require 'json'
1160
- require 'yaml'
1161
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1162
-
1163
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1164
- # As such, this might not be the best way to use this object.
1165
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1166
-
1167
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1168
- conditions = UltracartClient::CouponAutoApplyConditions.new # CouponAutoApplyConditions | Conditions
1169
-
1170
- begin
1171
- # Update auto apply rules and conditions
1172
- api_instance.update_auto_apply(conditions)
1173
- rescue UltracartClient::ApiError => e
1174
- puts "Error when calling CouponApi->update_auto_apply: #{e}"
1175
- end
1176
- ```
1177
-
1178
- #### Using the update_auto_apply_with_http_info variant
1179
-
1180
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
1181
-
1182
- > <Array(nil, Integer, Hash)> update_auto_apply_with_http_info(conditions)
1183
-
1184
- ```ruby
1185
- begin
1186
- # Update auto apply rules and conditions
1187
- data, status_code, headers = api_instance.update_auto_apply_with_http_info(conditions)
1188
- p status_code # => 2xx
1189
- p headers # => { ... }
1190
- p data # => nil
1191
- rescue UltracartClient::ApiError => e
1192
- puts "Error when calling CouponApi->update_auto_apply_with_http_info: #{e}"
1193
- end
1194
- ```
1195
-
1196
- ### Parameters
1197
-
1198
- | Name | Type | Description | Notes |
1199
- | ---- | ---- | ----------- | ----- |
1200
- | **conditions** | [**CouponAutoApplyConditions**](CouponAutoApplyConditions.md) | Conditions | |
1201
-
1202
- ### Return type
1203
-
1204
- nil (empty response body)
1205
-
1206
- ### Authorization
1207
-
1208
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1209
-
1210
- ### HTTP request headers
1211
-
1212
- - **Content-Type**: application/json
1213
- - **Accept**: application/json
1214
-
1215
-
1216
- ## update_coupon
1217
-
1218
- > <CouponResponse> update_coupon(coupon_oid, coupon, opts)
1219
-
1220
- Update a coupon
1221
-
1222
- Update a coupon on the UltraCart account.
1223
-
1224
- ### Examples
1225
-
1226
- ```ruby
1227
- require 'time'
1228
- require 'ultracart_api'
1229
- require 'json'
1230
- require 'yaml'
1231
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1232
-
1233
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1234
- # As such, this might not be the best way to use this object.
1235
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1236
-
1237
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1238
- coupon_oid = 56 # Integer | The coupon_oid to update.
1239
- coupon = UltracartClient::Coupon.new # Coupon | Coupon to update
1240
- opts = {
1241
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1242
- }
1243
-
1244
- begin
1245
- # Update a coupon
1246
- result = api_instance.update_coupon(coupon_oid, coupon, opts)
1247
- p result
1248
- rescue UltracartClient::ApiError => e
1249
- puts "Error when calling CouponApi->update_coupon: #{e}"
1250
- end
1251
- ```
1252
-
1253
- #### Using the update_coupon_with_http_info variant
1254
-
1255
- This returns an Array which contains the response data, status code and headers.
1256
-
1257
- > <Array(<CouponResponse>, Integer, Hash)> update_coupon_with_http_info(coupon_oid, coupon, opts)
1258
-
1259
- ```ruby
1260
- begin
1261
- # Update a coupon
1262
- data, status_code, headers = api_instance.update_coupon_with_http_info(coupon_oid, coupon, opts)
1263
- p status_code # => 2xx
1264
- p headers # => { ... }
1265
- p data # => <CouponResponse>
1266
- rescue UltracartClient::ApiError => e
1267
- puts "Error when calling CouponApi->update_coupon_with_http_info: #{e}"
1268
- end
1269
- ```
1270
-
1271
- ### Parameters
1272
-
1273
- | Name | Type | Description | Notes |
1274
- | ---- | ---- | ----------- | ----- |
1275
- | **coupon_oid** | **Integer** | The coupon_oid to update. | |
1276
- | **coupon** | [**Coupon**](Coupon.md) | Coupon to update | |
1277
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1278
-
1279
- ### Return type
1280
-
1281
- [**CouponResponse**](CouponResponse.md)
1282
-
1283
- ### Authorization
1284
-
1285
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1286
-
1287
- ### HTTP request headers
1288
-
1289
- - **Content-Type**: application/json; charset=UTF-8
1290
- - **Accept**: application/json
1291
-
1292
-
1293
- ## update_coupons
1294
-
1295
- > <CouponsResponse> update_coupons(coupons_request, opts)
1296
-
1297
- Update multiple coupons
1298
-
1299
- Update multiple coupon on the UltraCart account.
1300
-
1301
- ### Examples
1302
-
1303
- ```ruby
1304
- require 'time'
1305
- require 'ultracart_api'
1306
- require 'json'
1307
- require 'yaml'
1308
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1309
-
1310
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1311
- # As such, this might not be the best way to use this object.
1312
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1313
-
1314
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1315
- coupons_request = UltracartClient::CouponsRequest.new # CouponsRequest | Coupons to update (synchronous maximum 50 / asynchronous maximum 100)
1316
- opts = {
1317
- _expand: '_expand_example', # String | The object expansion to perform on the result. See documentation for examples
1318
- _placeholders: true, # Boolean | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.
1319
- _async: true # Boolean | True if the operation should be run async. No result returned
1320
- }
1321
-
1322
- begin
1323
- # Update multiple coupons
1324
- result = api_instance.update_coupons(coupons_request, opts)
1325
- p result
1326
- rescue UltracartClient::ApiError => e
1327
- puts "Error when calling CouponApi->update_coupons: #{e}"
1328
- end
1329
- ```
1330
-
1331
- #### Using the update_coupons_with_http_info variant
1332
-
1333
- This returns an Array which contains the response data, status code and headers.
1334
-
1335
- > <Array(<CouponsResponse>, Integer, Hash)> update_coupons_with_http_info(coupons_request, opts)
1336
-
1337
- ```ruby
1338
- begin
1339
- # Update multiple coupons
1340
- data, status_code, headers = api_instance.update_coupons_with_http_info(coupons_request, opts)
1341
- p status_code # => 2xx
1342
- p headers # => { ... }
1343
- p data # => <CouponsResponse>
1344
- rescue UltracartClient::ApiError => e
1345
- puts "Error when calling CouponApi->update_coupons_with_http_info: #{e}"
1346
- end
1347
- ```
1348
-
1349
- ### Parameters
1350
-
1351
- | Name | Type | Description | Notes |
1352
- | ---- | ---- | ----------- | ----- |
1353
- | **coupons_request** | [**CouponsRequest**](CouponsRequest.md) | Coupons to update (synchronous maximum 50 / asynchronous maximum 100) | |
1354
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1355
- | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
1356
- | **_async** | **Boolean** | True if the operation should be run async. No result returned | [optional] |
1357
-
1358
- ### Return type
1359
-
1360
- [**CouponsResponse**](CouponsResponse.md)
1361
-
1362
- ### Authorization
1363
-
1364
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1365
-
1366
- ### HTTP request headers
1367
-
1368
- - **Content-Type**: application/json; charset=UTF-8
1369
- - **Accept**: application/json
1370
-
1371
-
1372
- ## upload_coupon_codes
1373
-
1374
- > <UploadCouponCodesResponse> upload_coupon_codes(coupon_oid, upload_coupon_codes_request)
1375
-
1376
- Upload one-time codes for a coupon
1377
-
1378
- Upload one-time codes for a coupon
1379
-
1380
- ### Examples
1381
-
1382
- ```ruby
1383
- require 'time'
1384
- require 'ultracart_api'
1385
- require 'json'
1386
- require 'yaml'
1387
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1388
-
1389
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1390
- # As such, this might not be the best way to use this object.
1391
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1392
-
1393
- api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1394
- coupon_oid = 56 # Integer | The coupon oid to associate with the provided one-time codes.
1395
- upload_coupon_codes_request = UltracartClient::UploadCouponCodesRequest.new # UploadCouponCodesRequest | One-time coupon codes
1396
-
1397
- begin
1398
- # Upload one-time codes for a coupon
1399
- result = api_instance.upload_coupon_codes(coupon_oid, upload_coupon_codes_request)
1400
- p result
1401
- rescue UltracartClient::ApiError => e
1402
- puts "Error when calling CouponApi->upload_coupon_codes: #{e}"
1403
- end
1404
- ```
1405
-
1406
- #### Using the upload_coupon_codes_with_http_info variant
1407
-
1408
- This returns an Array which contains the response data, status code and headers.
1409
-
1410
- > <Array(<UploadCouponCodesResponse>, Integer, Hash)> upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request)
1411
-
1412
- ```ruby
1413
- begin
1414
- # Upload one-time codes for a coupon
1415
- data, status_code, headers = api_instance.upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request)
1416
- p status_code # => 2xx
1417
- p headers # => { ... }
1418
- p data # => <UploadCouponCodesResponse>
1419
- rescue UltracartClient::ApiError => e
1420
- puts "Error when calling CouponApi->upload_coupon_codes_with_http_info: #{e}"
1421
- end
1422
- ```
1423
-
1424
- ### Parameters
1425
-
1426
- | Name | Type | Description | Notes |
1427
- | ---- | ---- | ----------- | ----- |
1428
- | **coupon_oid** | **Integer** | The coupon oid to associate with the provided one-time codes. | |
1429
- | **upload_coupon_codes_request** | [**UploadCouponCodesRequest**](UploadCouponCodesRequest.md) | One-time coupon codes | |
1430
-
1431
- ### Return type
1432
-
1433
- [**UploadCouponCodesResponse**](UploadCouponCodesResponse.md)
1434
-
1435
- ### Authorization
1436
-
1437
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1438
-
1439
- ### HTTP request headers
1440
-
1441
- - **Content-Type**: application/json; charset=UTF-8
1442
- - **Accept**: application/json
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
+