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

    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, Fixnum, Hash)>

Delete a coupon Delete a coupon on the UltraCart account.

Parameters:

  • coupon_oid

    The coupon_oid to delete.

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, 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
# 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' + '}', coupon_oid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (nil)


94
95
96
97
# File 'lib/ultracart_api/api/coupon_api.rb', line 94

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, Fixnum, Hash)>

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request

    Coupon oids to delete

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



104
105
106
107
108
109
110
111
112
113
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
# File 'lib/ultracart_api/api/coupon_api.rb', line 104

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 = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_delete_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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

    Coupon oids to delete

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

    the optional parameters

Returns:

  • (nil)


148
149
150
151
# File 'lib/ultracart_api/api/coupon_api.rb', line 148

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, Fixnum, Hash)>

Deletes multiple coupons Delete coupons on the UltraCart account.

Parameters:

  • coupon_delete_request

    Coupon oids to delete

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/ultracart_api/api/coupon_api.rb', line 158

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 = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_delete_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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

    The coupon merchant code to examine.

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

    the optional parameters

Returns:



202
203
204
205
# File 'lib/ultracart_api/api/coupon_api.rb', line 202

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, Fixnum, Hash)>

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

Parameters:

  • merchant_code

    The coupon merchant code to examine.

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

    the optional parameters

Returns:

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

    CouponExistsResponse data, response status code and response headers



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/ultracart_api/api/coupon_api.rb', line 212

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' + '}', merchant_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponExistsResponse')
  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

    The coupon oid to generate codes.

  • coupon_codes_request

    Coupon code generation parameters

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

    the optional parameters

Returns:



258
259
260
261
# File 'lib/ultracart_api/api/coupon_api.rb', line 258

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, Fixnum, Hash)>

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

Parameters:

  • coupon_oid

    The coupon oid to generate codes.

  • coupon_codes_request

    Coupon code generation parameters

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

    the optional parameters

Returns:

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

    CouponCodesResponse data, response status code and response headers



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/ultracart_api/api/coupon_api.rb', line 269

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' + '}', coupon_oid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_codes_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponCodesResponse')
  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

    The merchant code to generate one time codes.

  • coupon_codes_request

    Coupon code generation parameters

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

    the optional parameters

Returns:



319
320
321
322
# File 'lib/ultracart_api/api/coupon_api.rb', line 319

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, Fixnum, Hash)>

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

Parameters:

  • merchant_code

    The merchant code to generate one time codes.

  • coupon_codes_request

    Coupon code generation parameters

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

    the optional parameters

Returns:

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

    CouponCodesResponse data, response status code and response headers



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
# File 'lib/ultracart_api/api/coupon_api.rb', line 330

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' + '}', merchant_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_codes_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponCodesResponse')
  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:



378
379
380
381
# File 'lib/ultracart_api/api/coupon_api.rb', line 378

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, Fixnum, Hash)>

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

Parameters:

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

    the optional parameters

Returns:

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

    CouponAutoApplyConditions data, response status code and response headers



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/ultracart_api/api/coupon_api.rb', line 387

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 = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponAutoApplyConditions')
  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

    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:



429
430
431
432
# File 'lib/ultracart_api/api/coupon_api.rb', line 429

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

    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:



487
488
489
490
# File 'lib/ultracart_api/api/coupon_api.rb', line 487

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, Fixnum, Hash)>

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

Parameters:

  • merchant_code

    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, Fixnum, Hash)>)

    CouponResponse data, response status code and response headers



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/ultracart_api/api/coupon_api.rb', line 498

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' + '}', merchant_code.to_s)

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

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponResponse')
  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, Fixnum, Hash)>

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

Parameters:

  • coupon_oid

    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, Fixnum, Hash)>)

    CouponResponse data, response status code and response headers



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/ultracart_api/api/coupon_api.rb', line 440

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' + '}', coupon_oid.to_s)

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

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponResponse')
  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:



556
557
558
559
# File 'lib/ultracart_api/api/coupon_api.rb', line 556

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

    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:



636
637
638
639
# File 'lib/ultracart_api/api/coupon_api.rb', line 636

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, Fixnum, 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

    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)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index.

  • :_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, Fixnum, Hash)>)

    CouponsResponse data, response status code and response headers



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/ultracart_api/api/coupon_api.rb', line 650

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 = {}
  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 = {}
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_query)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponsResponse')
  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, Fixnum, 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)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index.

  • :_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, Fixnum, Hash)>)

    CouponsResponse data, response status code and response headers



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# File 'lib/ultracart_api/api/coupon_api.rb', line 578

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 = {}
  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 = {}
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponsResponse')
  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:



698
699
700
701
# File 'lib/ultracart_api/api/coupon_api.rb', line 698

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, Fixnum, 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, Fixnum, Hash)>)

    CouponEditorValues data, response status code and response headers



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
739
740
741
742
# File 'lib/ultracart_api/api/coupon_api.rb', line 707

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 = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponEditorValues')
  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 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:



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

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, Fixnum, Hash)>

Insert a coupon Insert a coupon on the UltraCart account.

Parameters:

  • 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, Fixnum, Hash)>)

    CouponResponse data, response status code and response headers



760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/ultracart_api/api/coupon_api.rb', line 760

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 = {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponResponse')
  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

    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:



808
809
810
811
# File 'lib/ultracart_api/api/coupon_api.rb', line 808

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, Fixnum, Hash)>

Insert multiple coupons Insert multiple coupon on the UltraCart account.

Parameters:

  • coupons_request

    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, Fixnum, Hash)>)

    CouponsResponse data, response status code and response headers



820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/ultracart_api/api/coupon_api.rb', line 820

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 = {}
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupons_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponsResponse')
  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:



868
869
870
871
# File 'lib/ultracart_api/api/coupon_api.rb', line 868

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

#search_items_with_http_info(opts = {}) ⇒ Array<(CouponItemSearchResultsResponse, Fixnum, 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:



879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/ultracart_api/api/coupon_api.rb', line 879

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 = {}
  query_params[:'s'] = opts[:'s'] if !opts[:'s'].nil?
  query_params[:'m'] = opts[:'m'] if !opts[:'m'].nil?

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponItemSearchResultsResponse')
  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:

  • conditions

    Conditions

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

    the optional parameters

Returns:

  • (nil)


922
923
924
925
# File 'lib/ultracart_api/api/coupon_api.rb', line 922

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, Fixnum, Hash)>

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

Parameters:

  • conditions

    Conditions

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
# File 'lib/ultracart_api/api/coupon_api.rb', line 932

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 = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(conditions)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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, coupon_oid, opts = {}) ⇒ CouponResponse

Update a coupon Update a coupon on the UltraCart account.

Parameters:

  • coupon

    Coupon to update

  • coupon_oid

    The coupon_oid 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:



978
979
980
981
# File 'lib/ultracart_api/api/coupon_api.rb', line 978

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

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

Update a coupon Update a coupon on the UltraCart account.

Parameters:

  • coupon

    Coupon to update

  • coupon_oid

    The coupon_oid 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, Fixnum, Hash)>)

    CouponResponse data, response status code and response headers



990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
# File 'lib/ultracart_api/api/coupon_api.rb', line 990

def update_coupon_with_http_info(coupon, coupon_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/coupon/coupons/{coupon_oid}'.sub('{' + 'coupon_oid' + '}', coupon_oid.to_s)

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

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponResponse')
  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

    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:



1043
1044
1045
1046
# File 'lib/ultracart_api/api/coupon_api.rb', line 1043

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, Fixnum, Hash)>

Update multiple coupons Update multiple coupon on the UltraCart account.

Parameters:

  • coupons_request

    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, Fixnum, Hash)>)

    CouponsResponse data, response status code and response headers



1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/ultracart_api/api/coupon_api.rb', line 1056

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 = {}
  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 = {}
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupons_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CouponsResponse')
  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

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

  • upload_coupon_codes_request

    One-time coupon codes

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

    the optional parameters

Returns:



1105
1106
1107
1108
# File 'lib/ultracart_api/api/coupon_api.rb', line 1105

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, Fixnum, Hash)>

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

Parameters:

  • coupon_oid

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

  • upload_coupon_codes_request

    One-time coupon codes

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

    the optional parameters

Returns:

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

    UploadCouponCodesResponse data, response status code and response headers



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

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' + '}', coupon_oid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(upload_coupon_codes_request)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UploadCouponCodesResponse')
  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