Class: UltracartClient::CouponApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/api/coupon_api.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CouponApi

Returns a new instance of CouponApi.



19
20
21
# File 'lib/ultracart_api/api/coupon_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ultracart_api/api/coupon_api.rb', line 17

def api_client
  @api_client
end

Class Method Details

.new_using_api_key(simple_key, verify_ssl = true, debugging = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ultracart_api/api/coupon_api.rb', line 23

def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
  api_config = Configuration.new
  api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
  api_config.api_version = '2017-03-01'
  api_config.verify_ssl = verify_ssl

  api_client = ApiClient.new(api_config)
  api_client.config.debugging = debugging

  UltracartClient::CouponApi.new(api_client)
end

Instance Method Details

#delete_coupon(coupon_oid, opts = {}) ⇒ nil

Delete a coupon Delete a coupon on the UltraCart account.

Parameters:

  • coupon_oid (Integer)

    The coupon_oid to delete.

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

    the optional parameters

Returns:

  • (nil)


40
41
42
43
# File 'lib/ultracart_api/api/coupon_api.rb', line 40

def delete_coupon(coupon_oid, opts = {})
  delete_coupon_with_http_info(coupon_oid, opts)
  nil
end

#delete_coupon_with_http_info(coupon_oid, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a coupon Delete a coupon on the UltraCart account.

Parameters:

  • coupon_oid (Integer)

    The coupon_oid to delete.

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/ultracart_api/api/coupon_api.rb', line 50

def delete_coupon_with_http_info(coupon_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupon ...'
  end
  # verify the required parameter 'coupon_oid' is set
  if @api_client.config.client_side_validation && coupon_oid.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.delete_coupon"
  end
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', CGI.escape(coupon_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.delete_coupon",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#delete_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_coupons_by_code(coupon_delete_request, opts = {}) ⇒ nil

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request (CouponDeletesRequest)

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (nil)


104
105
106
107
# File 'lib/ultracart_api/api/coupon_api.rb', line 104

def delete_coupons_by_code(coupon_delete_request, opts = {})
  delete_coupons_by_code_with_http_info(coupon_delete_request, opts)
  nil
end

#delete_coupons_by_code_with_http_info(coupon_delete_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request (CouponDeletesRequest)

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/ultracart_api/api/coupon_api.rb', line 114

def delete_coupons_by_code_with_http_info(coupon_delete_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupons_by_code ...'
  end
  # verify the required parameter 'coupon_delete_request' is set
  if @api_client.config.client_side_validation && coupon_delete_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_delete_request' when calling CouponApi.delete_coupons_by_code"
  end
  # resource path
  local_var_path = '/coupon/coupons/by_code'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon_delete_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.delete_coupons_by_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#delete_coupons_by_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_coupons_by_oid(coupon_delete_request, opts = {}) ⇒ nil

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request (CouponDeletesRequest)

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (nil)


173
174
175
176
# File 'lib/ultracart_api/api/coupon_api.rb', line 173

def delete_coupons_by_oid(coupon_delete_request, opts = {})
  delete_coupons_by_oid_with_http_info(coupon_delete_request, opts)
  nil
end

#delete_coupons_by_oid_with_http_info(coupon_delete_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request (CouponDeletesRequest)

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/ultracart_api/api/coupon_api.rb', line 183

def delete_coupons_by_oid_with_http_info(coupon_delete_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.delete_coupons_by_oid ...'
  end
  # verify the required parameter 'coupon_delete_request' is set
  if @api_client.config.client_side_validation && coupon_delete_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_delete_request' when calling CouponApi.delete_coupons_by_oid"
  end
  # resource path
  local_var_path = '/coupon/coupons/by_oid'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon_delete_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.delete_coupons_by_oid",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#delete_coupons_by_oid\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#does_coupon_code_exist(merchant_code, opts = {}) ⇒ CouponExistsResponse

Determines if a coupon merchant code already exists Determines if a coupon merchant code already exists.

Parameters:

  • merchant_code (String)

    The coupon merchant code to examine.

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

    the optional parameters

Returns:



242
243
244
245
# File 'lib/ultracart_api/api/coupon_api.rb', line 242

def does_coupon_code_exist(merchant_code, opts = {})
  data, _status_code, _headers = does_coupon_code_exist_with_http_info(merchant_code, opts)
  data
end

#does_coupon_code_exist_with_http_info(merchant_code, opts = {}) ⇒ Array<(CouponExistsResponse, Integer, Hash)>

Determines if a coupon merchant code already exists Determines if a coupon merchant code already exists.

Parameters:

  • merchant_code (String)

    The coupon merchant code to examine.

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

    the optional parameters

Returns:

  • (Array<(CouponExistsResponse, Integer, Hash)>)

    CouponExistsResponse data, response status code and response headers



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/ultracart_api/api/coupon_api.rb', line 252

def does_coupon_code_exist_with_http_info(merchant_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.does_coupon_code_exist ...'
  end
  # verify the required parameter 'merchant_code' is set
  if @api_client.config.client_side_validation && merchant_code.nil?
    fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.does_coupon_code_exist"
  end
  # resource path
  local_var_path = '/coupon/coupons/merchant_code/{merchant_code}/exists'.sub('{' + 'merchant_code' + '}', CGI.escape(merchant_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponExistsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.does_coupon_code_exist",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#does_coupon_code_exist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_coupon_codes(coupon_oid, coupon_codes_request, opts = {}) ⇒ CouponCodesResponse

Generates one time codes for a coupon Generate one time codes for a coupon

Parameters:

  • coupon_oid (Integer)

    The coupon oid to generate codes.

  • coupon_codes_request (CouponCodesRequest)

    Coupon code generation parameters

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

    the optional parameters

Returns:



307
308
309
310
# File 'lib/ultracart_api/api/coupon_api.rb', line 307

def generate_coupon_codes(coupon_oid, coupon_codes_request, opts = {})
  data, _status_code, _headers = generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request, opts)
  data
end

#generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request, opts = {}) ⇒ Array<(CouponCodesResponse, Integer, Hash)>

Generates one time codes for a coupon Generate one time codes for a coupon

Parameters:

  • coupon_oid (Integer)

    The coupon oid to generate codes.

  • coupon_codes_request (CouponCodesRequest)

    Coupon code generation parameters

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

    the optional parameters

Returns:

  • (Array<(CouponCodesResponse, Integer, Hash)>)

    CouponCodesResponse data, response status code and response headers



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/ultracart_api/api/coupon_api.rb', line 318

def generate_coupon_codes_with_http_info(coupon_oid, coupon_codes_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.generate_coupon_codes ...'
  end
  # verify the required parameter 'coupon_oid' is set
  if @api_client.config.client_side_validation && coupon_oid.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.generate_coupon_codes"
  end
  # verify the required parameter 'coupon_codes_request' is set
  if @api_client.config.client_side_validation && coupon_codes_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_codes_request' when calling CouponApi.generate_coupon_codes"
  end
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}/generate_codes'.sub('{' + 'coupon_oid' + '}', CGI.escape(coupon_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon_codes_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponCodesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.generate_coupon_codes",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#generate_coupon_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request, opts = {}) ⇒ CouponCodesResponse

Generates one time codes by merchant code Generate one time codes by merchant code

Parameters:

  • merchant_code (String)

    The merchant code to generate one time codes.

  • coupon_codes_request (CouponCodesRequest)

    Coupon code generation parameters

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

    the optional parameters

Returns:



382
383
384
385
# File 'lib/ultracart_api/api/coupon_api.rb', line 382

def generate_one_time_codes_by_merchant_code(merchant_code, coupon_codes_request, opts = {})
  data, _status_code, _headers = generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request, opts)
  data
end

#generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request, opts = {}) ⇒ Array<(CouponCodesResponse, Integer, Hash)>

Generates one time codes by merchant code Generate one time codes by merchant code

Parameters:

  • merchant_code (String)

    The merchant code to generate one time codes.

  • coupon_codes_request (CouponCodesRequest)

    Coupon code generation parameters

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

    the optional parameters

Returns:

  • (Array<(CouponCodesResponse, Integer, Hash)>)

    CouponCodesResponse data, response status code and response headers



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/ultracart_api/api/coupon_api.rb', line 393

def generate_one_time_codes_by_merchant_code_with_http_info(merchant_code, coupon_codes_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.generate_one_time_codes_by_merchant_code ...'
  end
  # verify the required parameter 'merchant_code' is set
  if @api_client.config.client_side_validation && merchant_code.nil?
    fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.generate_one_time_codes_by_merchant_code"
  end
  # verify the required parameter 'coupon_codes_request' is set
  if @api_client.config.client_side_validation && coupon_codes_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_codes_request' when calling CouponApi.generate_one_time_codes_by_merchant_code"
  end
  # resource path
  local_var_path = '/coupon/coupons/merchant_code/{merchant_code}/generate_codes'.sub('{' + 'merchant_code' + '}', CGI.escape(merchant_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon_codes_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponCodesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.generate_one_time_codes_by_merchant_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#generate_one_time_codes_by_merchant_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_auto_apply(opts = {}) ⇒ CouponAutoApplyConditions

Retrieve auto apply rules and conditions Retrieve auto apply rules and conditions

Parameters:

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

    the optional parameters

Returns:



455
456
457
458
# File 'lib/ultracart_api/api/coupon_api.rb', line 455

def get_auto_apply(opts = {})
  data, _status_code, _headers = get_auto_apply_with_http_info(opts)
  data
end

#get_auto_apply_with_http_info(opts = {}) ⇒ Array<(CouponAutoApplyConditions, Integer, Hash)>

Retrieve auto apply rules and conditions Retrieve auto apply rules and conditions

Parameters:

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

    the optional parameters

Returns:

  • (Array<(CouponAutoApplyConditions, Integer, Hash)>)

    CouponAutoApplyConditions data, response status code and response headers



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/ultracart_api/api/coupon_api.rb', line 464

def get_auto_apply_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_auto_apply ...'
  end
  # resource path
  local_var_path = '/coupon/auto_apply'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponAutoApplyConditions'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_auto_apply",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_auto_apply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_coupon(coupon_oid, opts = {}) ⇒ CouponResponse

Retrieve a coupon Retrieves a single coupon using the specified coupon profile oid.

Parameters:

  • coupon_oid (Integer)

    The coupon oid to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



515
516
517
518
# File 'lib/ultracart_api/api/coupon_api.rb', line 515

def get_coupon(coupon_oid, opts = {})
  data, _status_code, _headers = get_coupon_with_http_info(coupon_oid, opts)
  data
end

#get_coupon_by_merchant_code(merchant_code, opts = {}) ⇒ CouponResponse

Retrieve a coupon by merchant code Retrieves a single coupon using the specified merchant code.

Parameters:

  • merchant_code (String)

    The coupon merchant code to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



582
583
584
585
# File 'lib/ultracart_api/api/coupon_api.rb', line 582

def get_coupon_by_merchant_code(merchant_code, opts = {})
  data, _status_code, _headers = get_coupon_by_merchant_code_with_http_info(merchant_code, opts)
  data
end

#get_coupon_by_merchant_code_with_http_info(merchant_code, opts = {}) ⇒ Array<(CouponResponse, Integer, Hash)>

Retrieve a coupon by merchant code Retrieves a single coupon using the specified merchant code.

Parameters:

  • merchant_code (String)

    The coupon merchant code to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponResponse, Integer, Hash)>)

    CouponResponse data, response status code and response headers



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/ultracart_api/api/coupon_api.rb', line 593

def get_coupon_by_merchant_code_with_http_info(merchant_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_coupon_by_merchant_code ...'
  end
  # verify the required parameter 'merchant_code' is set
  if @api_client.config.client_side_validation && merchant_code.nil?
    fail ArgumentError, "Missing the required parameter 'merchant_code' when calling CouponApi.get_coupon_by_merchant_code"
  end
  # resource path
  local_var_path = '/coupon/coupons/merchant_code/{merchant_code}'.sub('{' + 'merchant_code' + '}', CGI.escape(merchant_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_coupon_by_merchant_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_coupon_by_merchant_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_coupon_with_http_info(coupon_oid, opts = {}) ⇒ Array<(CouponResponse, Integer, Hash)>

Retrieve a coupon Retrieves a single coupon using the specified coupon profile oid.

Parameters:

  • coupon_oid (Integer)

    The coupon oid to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponResponse, Integer, Hash)>)

    CouponResponse data, response status code and response headers



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/ultracart_api/api/coupon_api.rb', line 526

def get_coupon_with_http_info(coupon_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_coupon ...'
  end
  # verify the required parameter 'coupon_oid' is set
  if @api_client.config.client_side_validation && coupon_oid.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.get_coupon"
  end
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', CGI.escape(coupon_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_coupon",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_coupons(opts = {}) ⇒ CouponsResponse

Retrieve coupons 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.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :merchant_code (String)

    Merchant code

  • :description (String)

    Description

  • :coupon_type (String)

    Coupon type

  • :start_date_begin (String)

    Start date begin

  • :start_date_end (String)

    Start date end

  • :expiration_date_begin (String)

    Expiration date begin

  • :expiration_date_end (String)

    Expiration date end

  • :affiliate_oid (Integer)

    Affiliate oid

  • :exclude_expired (Boolean)

    Exclude expired

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Max 200) (default to 100)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String)

    The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



660
661
662
663
# File 'lib/ultracart_api/api/coupon_api.rb', line 660

def get_coupons(opts = {})
  data, _status_code, _headers = get_coupons_with_http_info(opts)
  data
end

#get_coupons_by_query(coupon_query, opts = {}) ⇒ CouponsResponse

Retrieve coupons by query 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.

Parameters:

  • coupon_query (CouponQuery)

    Coupon query

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

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Max 200) (default to 100)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String)

    The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



749
750
751
752
# File 'lib/ultracart_api/api/coupon_api.rb', line 749

def get_coupons_by_query(coupon_query, opts = {})
  data, _status_code, _headers = get_coupons_by_query_with_http_info(coupon_query, opts)
  data
end

#get_coupons_by_query_with_http_info(coupon_query, opts = {}) ⇒ Array<(CouponsResponse, Integer, Hash)>

Retrieve coupons by query 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.

Parameters:

  • coupon_query (CouponQuery)

    Coupon query

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

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Max 200) (default to 100)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String)

    The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponsResponse, Integer, Hash)>)

    CouponsResponse data, response status code and response headers



763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'lib/ultracart_api/api/coupon_api.rb', line 763

def get_coupons_by_query_with_http_info(coupon_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_coupons_by_query ...'
  end
  # verify the required parameter 'coupon_query' is set
  if @api_client.config.client_side_validation && coupon_query.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_query' when calling CouponApi.get_coupons_by_query"
  end
  # resource path
  local_var_path = '/coupon/coupons/query'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon_query)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_coupons_by_query",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_coupons_by_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_coupons_with_http_info(opts = {}) ⇒ Array<(CouponsResponse, Integer, Hash)>

Retrieve coupons 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.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :merchant_code (String)

    Merchant code

  • :description (String)

    Description

  • :coupon_type (String)

    Coupon type

  • :start_date_begin (String)

    Start date begin

  • :start_date_end (String)

    Start date end

  • :expiration_date_begin (String)

    Expiration date begin

  • :expiration_date_end (String)

    Expiration date end

  • :affiliate_oid (Integer)

    Affiliate oid

  • :exclude_expired (Boolean)

    Exclude expired

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Max 200) (default to 100)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String)

    The sort order of the coupons. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponsResponse, Integer, Hash)>)

    CouponsResponse data, response status code and response headers



682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/ultracart_api/api/coupon_api.rb', line 682

def get_coupons_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_coupons ...'
  end
  # resource path
  local_var_path = '/coupon/coupons'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'merchant_code'] = opts[:'merchant_code'] if !opts[:'merchant_code'].nil?
  query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'coupon_type'] = opts[:'coupon_type'] if !opts[:'coupon_type'].nil?
  query_params[:'start_date_begin'] = opts[:'start_date_begin'] if !opts[:'start_date_begin'].nil?
  query_params[:'start_date_end'] = opts[:'start_date_end'] if !opts[:'start_date_end'].nil?
  query_params[:'expiration_date_begin'] = opts[:'expiration_date_begin'] if !opts[:'expiration_date_begin'].nil?
  query_params[:'expiration_date_end'] = opts[:'expiration_date_end'] if !opts[:'expiration_date_end'].nil?
  query_params[:'affiliate_oid'] = opts[:'affiliate_oid'] if !opts[:'affiliate_oid'].nil?
  query_params[:'exclude_expired'] = opts[:'exclude_expired'] if !opts[:'exclude_expired'].nil?
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_coupons",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_editor_values(opts = {}) ⇒ CouponEditorValues

Retrieve values needed for a coupon editor Retrieve values needed for a coupon editor

Parameters:

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

    the optional parameters

Returns:



825
826
827
828
# File 'lib/ultracart_api/api/coupon_api.rb', line 825

def get_editor_values(opts = {})
  data, _status_code, _headers = get_editor_values_with_http_info(opts)
  data
end

#get_editor_values_with_http_info(opts = {}) ⇒ Array<(CouponEditorValues, Integer, Hash)>

Retrieve values needed for a coupon editor Retrieve values needed for a coupon editor

Parameters:

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

    the optional parameters

Returns:

  • (Array<(CouponEditorValues, Integer, Hash)>)

    CouponEditorValues data, response status code and response headers



834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
# File 'lib/ultracart_api/api/coupon_api.rb', line 834

def get_editor_values_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.get_editor_values ...'
  end
  # resource path
  local_var_path = '/coupon/editor_values'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponEditorValues'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.get_editor_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#get_editor_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#insert_coupon(coupon, opts = {}) ⇒ CouponResponse

Insert a coupon Insert a coupon on the UltraCart account.

Parameters:

  • coupon (Coupon)

    Coupon to insert

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



885
886
887
888
# File 'lib/ultracart_api/api/coupon_api.rb', line 885

def insert_coupon(coupon, opts = {})
  data, _status_code, _headers = insert_coupon_with_http_info(coupon, opts)
  data
end

#insert_coupon_with_http_info(coupon, opts = {}) ⇒ Array<(CouponResponse, Integer, Hash)>

Insert a coupon Insert a coupon on the UltraCart account.

Parameters:

  • coupon (Coupon)

    Coupon to insert

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponResponse, Integer, Hash)>)

    CouponResponse data, response status code and response headers



896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'lib/ultracart_api/api/coupon_api.rb', line 896

def insert_coupon_with_http_info(coupon, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupon ...'
  end
  # verify the required parameter 'coupon' is set
  if @api_client.config.client_side_validation && coupon.nil?
    fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponApi.insert_coupon"
  end
  # resource path
  local_var_path = '/coupon/coupons'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.insert_coupon",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#insert_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#insert_coupons(coupons_request, opts = {}) ⇒ CouponsResponse

Insert multiple coupons Insert multiple coupon on the UltraCart account.

Parameters:

  • coupons_request (CouponsRequest)

    Coupons to insert (maximum 50)

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

  • :_placeholders (Boolean)

    Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.

Returns:



958
959
960
961
# File 'lib/ultracart_api/api/coupon_api.rb', line 958

def insert_coupons(coupons_request, opts = {})
  data, _status_code, _headers = insert_coupons_with_http_info(coupons_request, opts)
  data
end

#insert_coupons_with_http_info(coupons_request, opts = {}) ⇒ Array<(CouponsResponse, Integer, Hash)>

Insert multiple coupons Insert multiple coupon on the UltraCart account.

Parameters:

  • coupons_request (CouponsRequest)

    Coupons to insert (maximum 50)

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

  • :_placeholders (Boolean)

    Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.

Returns:

  • (Array<(CouponsResponse, Integer, Hash)>)

    CouponsResponse data, response status code and response headers



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/ultracart_api/api/coupon_api.rb', line 970

def insert_coupons_with_http_info(coupons_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupons ...'
  end
  # verify the required parameter 'coupons_request' is set
  if @api_client.config.client_side_validation && coupons_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupons_request' when calling CouponApi.insert_coupons"
  end
  # resource path
  local_var_path = '/coupon/coupons/batch'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupons_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.insert_coupons",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#insert_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_items(opts = {}) ⇒ CouponItemSearchResultsResponse

Searches for items to display within a coupon editor and assign to coupons Searches for items to display within a coupon editor and assign to coupons

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :s (String)
  • :m (Integer)

Returns:



1032
1033
1034
1035
# File 'lib/ultracart_api/api/coupon_api.rb', line 1032

def search_items(opts = {})
  data, _status_code, _headers = search_items_with_http_info(opts)
  data
end

#search_items_with_http_info(opts = {}) ⇒ Array<(CouponItemSearchResultsResponse, Integer, Hash)>

Searches for items to display within a coupon editor and assign to coupons Searches for items to display within a coupon editor and assign to coupons

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :s (String)
  • :m (Integer)

Returns:



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
# File 'lib/ultracart_api/api/coupon_api.rb', line 1043

def search_items_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.search_items ...'
  end
  # resource path
  local_var_path = '/coupon/searchItems'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'s'] = opts[:'s'] if !opts[:'s'].nil?
  query_params[:'m'] = opts[:'m'] if !opts[:'m'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CouponItemSearchResultsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.search_items",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#search_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_auto_apply(conditions, opts = {}) ⇒ nil

Update auto apply rules and conditions Update auto apply rules and conditions

Parameters:

Returns:

  • (nil)


1095
1096
1097
1098
# File 'lib/ultracart_api/api/coupon_api.rb', line 1095

def update_auto_apply(conditions, opts = {})
  update_auto_apply_with_http_info(conditions, opts)
  nil
end

#update_auto_apply_with_http_info(conditions, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update auto apply rules and conditions Update auto apply rules and conditions

Parameters:

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
# File 'lib/ultracart_api/api/coupon_api.rb', line 1105

def update_auto_apply_with_http_info(conditions, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.update_auto_apply ...'
  end
  # verify the required parameter 'conditions' is set
  if @api_client.config.client_side_validation && conditions.nil?
    fail ArgumentError, "Missing the required parameter 'conditions' when calling CouponApi.update_auto_apply"
  end
  # resource path
  local_var_path = '/coupon/auto_apply'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(conditions)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.update_auto_apply",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#update_auto_apply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_coupon(coupon_oid, coupon, opts = {}) ⇒ CouponResponse

Update a coupon Update a coupon on the UltraCart account.

Parameters:

  • coupon_oid (Integer)

    The coupon_oid to update.

  • coupon (Coupon)

    Coupon to update

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:



1166
1167
1168
1169
# File 'lib/ultracart_api/api/coupon_api.rb', line 1166

def update_coupon(coupon_oid, coupon, opts = {})
  data, _status_code, _headers = update_coupon_with_http_info(coupon_oid, coupon, opts)
  data
end

#update_coupon_with_http_info(coupon_oid, coupon, opts = {}) ⇒ Array<(CouponResponse, Integer, Hash)>

Update a coupon Update a coupon on the UltraCart account.

Parameters:

  • coupon_oid (Integer)

    The coupon_oid to update.

  • coupon (Coupon)

    Coupon to update

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

Returns:

  • (Array<(CouponResponse, Integer, Hash)>)

    CouponResponse data, response status code and response headers



1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
# File 'lib/ultracart_api/api/coupon_api.rb', line 1178

def update_coupon_with_http_info(coupon_oid, coupon, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.update_coupon ...'
  end
  # verify the required parameter 'coupon_oid' is set
  if @api_client.config.client_side_validation && coupon_oid.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.update_coupon"
  end
  # verify the required parameter 'coupon' is set
  if @api_client.config.client_side_validation && coupon.nil?
    fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponApi.update_coupon"
  end
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', CGI.escape(coupon_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupon)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.update_coupon",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#update_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_coupons(coupons_request, opts = {}) ⇒ CouponsResponse

Update multiple coupons Update multiple coupon on the UltraCart account.

Parameters:

  • coupons_request (CouponsRequest)

    Coupons to update (synchronous maximum 50 / asynchronous maximum 100)

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

  • :_placeholders (Boolean)

    Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.

  • :_async (Boolean)

    True if the operation should be run async. No result returned

Returns:



1245
1246
1247
1248
# File 'lib/ultracart_api/api/coupon_api.rb', line 1245

def update_coupons(coupons_request, opts = {})
  data, _status_code, _headers = update_coupons_with_http_info(coupons_request, opts)
  data
end

#update_coupons_with_http_info(coupons_request, opts = {}) ⇒ Array<(CouponsResponse, Integer, Hash)>

Update multiple coupons Update multiple coupon on the UltraCart account.

Parameters:

  • coupons_request (CouponsRequest)

    Coupons to update (synchronous maximum 50 / asynchronous maximum 100)

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

    the optional parameters

Options Hash (opts):

  • :_expand (String)

    The object expansion to perform on the result. See documentation for examples

  • :_placeholders (Boolean)

    Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.

  • :_async (Boolean)

    True if the operation should be run async. No result returned

Returns:

  • (Array<(CouponsResponse, Integer, Hash)>)

    CouponsResponse data, response status code and response headers



1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
# File 'lib/ultracart_api/api/coupon_api.rb', line 1258

def update_coupons_with_http_info(coupons_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.update_coupons ...'
  end
  # verify the required parameter 'coupons_request' is set
  if @api_client.config.client_side_validation && coupons_request.nil?
    fail ArgumentError, "Missing the required parameter 'coupons_request' when calling CouponApi.update_coupons"
  end
  # resource path
  local_var_path = '/coupon/coupons/batch'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?
  query_params[:'_async'] = opts[:'_async'] if !opts[:'_async'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(coupons_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CouponsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.update_coupons",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#update_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_coupon_codes(coupon_oid, upload_coupon_codes_request, opts = {}) ⇒ UploadCouponCodesResponse

Upload one-time codes for a coupon Upload one-time codes for a coupon

Parameters:

  • coupon_oid (Integer)

    The coupon oid to associate with the provided one-time codes.

  • upload_coupon_codes_request (UploadCouponCodesRequest)

    One-time coupon codes

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

    the optional parameters

Returns:



1321
1322
1323
1324
# File 'lib/ultracart_api/api/coupon_api.rb', line 1321

def upload_coupon_codes(coupon_oid, upload_coupon_codes_request, opts = {})
  data, _status_code, _headers = upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request, opts)
  data
end

#upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request, opts = {}) ⇒ Array<(UploadCouponCodesResponse, Integer, Hash)>

Upload one-time codes for a coupon Upload one-time codes for a coupon

Parameters:

  • coupon_oid (Integer)

    The coupon oid to associate with the provided one-time codes.

  • upload_coupon_codes_request (UploadCouponCodesRequest)

    One-time coupon codes

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

    the optional parameters

Returns:

  • (Array<(UploadCouponCodesResponse, Integer, Hash)>)

    UploadCouponCodesResponse data, response status code and response headers



1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
# File 'lib/ultracart_api/api/coupon_api.rb', line 1332

def upload_coupon_codes_with_http_info(coupon_oid, upload_coupon_codes_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CouponApi.upload_coupon_codes ...'
  end
  # verify the required parameter 'coupon_oid' is set
  if @api_client.config.client_side_validation && coupon_oid.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_oid' when calling CouponApi.upload_coupon_codes"
  end
  # verify the required parameter 'upload_coupon_codes_request' is set
  if @api_client.config.client_side_validation && upload_coupon_codes_request.nil?
    fail ArgumentError, "Missing the required parameter 'upload_coupon_codes_request' when calling CouponApi.upload_coupon_codes"
  end
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}/upload_codes'.sub('{' + 'coupon_oid' + '}', CGI.escape(coupon_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_coupon_codes_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UploadCouponCodesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"CouponApi.upload_coupon_codes",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponApi#upload_coupon_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end