Class: UltracartClient::WebhookApi

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WebhookApi

Returns a new instance of WebhookApi.



19
20
21
# File 'lib/ultracart_api/api/webhook_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/webhook_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/webhook_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::WebhookApi.new(api_client)
end

Instance Method Details

#delete_webhook(webhook_oid, opts = {}) ⇒ nil

Delete a webhook Delete a webhook on the UltraCart account.

Parameters:

  • webhook_oid (Integer)

    The webhook oid to delete.

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

    the optional parameters

Returns:

  • (nil)


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

def delete_webhook(webhook_oid, opts = {})
  delete_webhook_with_http_info(webhook_oid, opts)
  nil
end

#delete_webhook_by_url(webhook, opts = {}) ⇒ WebhookResponse

Delete a webhook by URL Delete a webhook based upon the URL on the webhook_url matching an existing webhook.

Parameters:

  • webhook (Webhook)

    Webhook to delete

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

    the optional parameters

Returns:



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

def delete_webhook_by_url(webhook, opts = {})
  data, _status_code, _headers = delete_webhook_by_url_with_http_info(webhook, opts)
  data
end

#delete_webhook_by_url_with_http_info(webhook, opts = {}) ⇒ Array<(WebhookResponse, Integer, Hash)>

Delete a webhook by URL Delete a webhook based upon the URL on the webhook_url matching an existing webhook.

Parameters:

  • webhook (Webhook)

    Webhook to delete

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

    the optional parameters

Returns:

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

    WebhookResponse data, 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/webhook_api.rb', line 114

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

  # 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(webhook)

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

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

  new_options = opts.merge(
    :operation => :"WebhookApi.delete_webhook_by_url",
    :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: WebhookApi#delete_webhook_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_webhook_with_http_info(webhook_oid, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a webhook Delete a webhook on the UltraCart account.

Parameters:

  • webhook_oid (Integer)

    The webhook 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/webhook_api.rb', line 50

def delete_webhook_with_http_info(webhook_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.delete_webhook ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.delete_webhook"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}'.sub('{' + 'webhookOid' + '}', CGI.escape(webhook_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 => :"WebhookApi.delete_webhook",
    :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: WebhookApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_webhook_log(webhook_oid, request_id, opts = {}) ⇒ WebhookLogResponse

Retrieve an individual log Retrieves an individual log for a webhook given the webhook oid the request id.

Parameters:

  • webhook_oid (Integer)

    The webhook oid that owns the log.

  • request_id (String)

    The request id associated with the log to view.

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

    the optional parameters

Returns:



174
175
176
177
# File 'lib/ultracart_api/api/webhook_api.rb', line 174

def get_webhook_log(webhook_oid, request_id, opts = {})
  data, _status_code, _headers = get_webhook_log_with_http_info(webhook_oid, request_id, opts)
  data
end

#get_webhook_log_summaries(webhook_oid, opts = {}) ⇒ WebhookLogSummariesResponse

Retrieve the log summaries Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.

Parameters:

  • webhook_oid (Integer)

    The webhook oid to retrieve log summaries for.

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

    the optional parameters

Options Hash (opts):

  • :request_id (String)
  • :begin_date (String)
  • :end_date (String)
  • :status (String)
  • :event (String)
  • :order_id (String)
  • :request (String)
  • :duration (Integer)
  • :_limit (Integer)

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

  • :_offset (Integer)

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

  • :_since (String)

    Fetch log summaries that have been delivered since this date/time.

Returns:



254
255
256
257
# File 'lib/ultracart_api/api/webhook_api.rb', line 254

def get_webhook_log_summaries(webhook_oid, opts = {})
  data, _status_code, _headers = get_webhook_log_summaries_with_http_info(webhook_oid, opts)
  data
end

#get_webhook_log_summaries_with_http_info(webhook_oid, opts = {}) ⇒ Array<(WebhookLogSummariesResponse, Integer, Hash)>

Retrieve the log summaries Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.

Parameters:

  • webhook_oid (Integer)

    The webhook oid to retrieve log summaries for.

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

    the optional parameters

Options Hash (opts):

  • :request_id (String)
  • :begin_date (String)
  • :end_date (String)
  • :status (String)
  • :event (String)
  • :order_id (String)
  • :request (String)
  • :duration (Integer)
  • :_limit (Integer)

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

  • :_offset (Integer)

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

  • :_since (String)

    Fetch log summaries that have been delivered since this date/time.

Returns:

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

    WebhookLogSummariesResponse data, response status code and response headers



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/ultracart_api/api/webhook_api.rb', line 275

def get_webhook_log_summaries_with_http_info(webhook_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log_summaries ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log_summaries"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/logs'.sub('{' + 'webhookOid' + '}', CGI.escape(webhook_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'requestId'] = opts[:'request_id'] if !opts[:'request_id'].nil?
  query_params[:'beginDate'] = opts[:'begin_date'] if !opts[:'begin_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
  query_params[:'orderId'] = opts[:'order_id'] if !opts[:'order_id'].nil?
  query_params[:'request'] = opts[:'request'] if !opts[:'request'].nil?
  query_params[:'duration'] = opts[:'duration'] if !opts[:'duration'].nil?
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].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] || 'WebhookLogSummariesResponse'

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

  new_options = opts.merge(
    :operation => :"WebhookApi.get_webhook_log_summaries",
    :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: WebhookApi#get_webhook_log_summaries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_webhook_log_with_http_info(webhook_oid, request_id, opts = {}) ⇒ Array<(WebhookLogResponse, Integer, Hash)>

Retrieve an individual log Retrieves an individual log for a webhook given the webhook oid the request id.

Parameters:

  • webhook_oid (Integer)

    The webhook oid that owns the log.

  • request_id (String)

    The request id associated with the log to view.

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

    the optional parameters

Returns:

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

    WebhookLogResponse data, response status code and response headers



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

def get_webhook_log_with_http_info(webhook_oid, request_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log"
  end
  # verify the required parameter 'request_id' is set
  if @api_client.config.client_side_validation && request_id.nil?
    fail ArgumentError, "Missing the required parameter 'request_id' when calling WebhookApi.get_webhook_log"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/logs/{requestId}'.sub('{' + 'webhookOid' + '}', CGI.escape(webhook_oid.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.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] || 'WebhookLogResponse'

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

  new_options = opts.merge(
    :operation => :"WebhookApi.get_webhook_log",
    :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: WebhookApi#get_webhook_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_webhooks(opts = {}) ⇒ WebhooksResponse

Retrieve webhooks Retrieves the webhooks associated with this application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (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 webhooks. 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:



343
344
345
346
# File 'lib/ultracart_api/api/webhook_api.rb', line 343

def get_webhooks(opts = {})
  data, _status_code, _headers = get_webhooks_with_http_info(opts)
  data
end

#get_webhooks_with_http_info(opts = {}) ⇒ Array<(WebhooksResponse, Integer, Hash)>

Retrieve webhooks Retrieves the webhooks associated with this application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (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 webhooks. 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<(WebhooksResponse, Integer, Hash)>)

    WebhooksResponse data, response status code and response headers



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/ultracart_api/api/webhook_api.rb', line 356

def get_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhooks ...'
  end
  # resource path
  local_var_path = '/webhook/webhooks'

  # 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[:'_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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"WebhookApi.get_webhooks",
    :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: WebhookApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#insert_webhook(webhook, opts = {}) ⇒ WebhookResponse

Add a webhook Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and return them. This allows your application to have simpler logic on the setup of a secure webhook.

Parameters:

  • webhook (Webhook)

    Webhook to create

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

    the optional parameters

Options Hash (opts):

  • :_placeholders (Boolean)

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

Returns:



411
412
413
414
# File 'lib/ultracart_api/api/webhook_api.rb', line 411

def insert_webhook(webhook, opts = {})
  data, _status_code, _headers = insert_webhook_with_http_info(webhook, opts)
  data
end

#insert_webhook_with_http_info(webhook, opts = {}) ⇒ Array<(WebhookResponse, Integer, Hash)>

Add a webhook Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and return them. This allows your application to have simpler logic on the setup of a secure webhook.

Parameters:

  • webhook (Webhook)

    Webhook to create

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

    the optional parameters

Options Hash (opts):

  • :_placeholders (Boolean)

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

Returns:

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

    WebhookResponse data, response status code and response headers



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/ultracart_api/api/webhook_api.rb', line 422

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

  # query parameters
  query_params = opts[:query_params] || {}
  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(webhook)

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

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

  new_options = opts.merge(
    :operation => :"WebhookApi.insert_webhook",
    :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: WebhookApi#insert_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#resend_event(webhook_oid, event_name, opts = {}) ⇒ WebhookReflowResponse

Resend events to the webhook endpoint. This method will resend events to the webhook endpoint. This method can be used for example to send all the existing items on an account to a webhook.

Parameters:

  • webhook_oid (Integer)

    The webhook oid that is receiving the reflowed events.

  • event_name (String)

    The event to reflow.

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

    the optional parameters

Returns:



483
484
485
486
# File 'lib/ultracart_api/api/webhook_api.rb', line 483

def resend_event(webhook_oid, event_name, opts = {})
  data, _status_code, _headers = resend_event_with_http_info(webhook_oid, event_name, opts)
  data
end

#resend_event_with_http_info(webhook_oid, event_name, opts = {}) ⇒ Array<(WebhookReflowResponse, Integer, Hash)>

Resend events to the webhook endpoint. This method will resend events to the webhook endpoint. This method can be used for example to send all the existing items on an account to a webhook.

Parameters:

  • webhook_oid (Integer)

    The webhook oid that is receiving the reflowed events.

  • event_name (String)

    The event to reflow.

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

    the optional parameters

Returns:

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

    WebhookReflowResponse data, response status code and response headers



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

def resend_event_with_http_info(webhook_oid, event_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.resend_event ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.resend_event"
  end
  # verify the required parameter 'event_name' is set
  if @api_client.config.client_side_validation && event_name.nil?
    fail ArgumentError, "Missing the required parameter 'event_name' when calling WebhookApi.resend_event"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/reflow/{eventName}'.sub('{' + 'webhookOid' + '}', CGI.escape(webhook_oid.to_s)).sub('{' + 'eventName' + '}', CGI.escape(event_name.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] || 'WebhookReflowResponse'

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

  new_options = opts.merge(
    :operation => :"WebhookApi.resend_event",
    :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: WebhookApi#resend_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_webhook(webhook_oid, webhook, opts = {}) ⇒ WebhookResponse

Update a webhook Update a webhook on the account

Parameters:

  • webhook_oid (Integer)

    The webhook oid to update.

  • webhook (Webhook)

    Webhook to update

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

    the optional parameters

Options Hash (opts):

  • :_placeholders (Boolean)

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

Returns:



554
555
556
557
# File 'lib/ultracart_api/api/webhook_api.rb', line 554

def update_webhook(webhook_oid, webhook, opts = {})
  data, _status_code, _headers = update_webhook_with_http_info(webhook_oid, webhook, opts)
  data
end

#update_webhook_with_http_info(webhook_oid, webhook, opts = {}) ⇒ Array<(WebhookResponse, Integer, Hash)>

Update a webhook Update a webhook on the account

Parameters:

  • webhook_oid (Integer)

    The webhook oid to update.

  • webhook (Webhook)

    Webhook to update

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

    the optional parameters

Options Hash (opts):

  • :_placeholders (Boolean)

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

Returns:

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

    WebhookResponse data, response status code and response headers



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# File 'lib/ultracart_api/api/webhook_api.rb', line 566

def update_webhook_with_http_info(webhook_oid, webhook, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.update_webhook ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.update_webhook"
  end
  # verify the required parameter 'webhook' is set
  if @api_client.config.client_side_validation && webhook.nil?
    fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhookApi.update_webhook"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}'.sub('{' + 'webhookOid' + '}', CGI.escape(webhook_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  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(webhook)

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

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

  new_options = opts.merge(
    :operation => :"WebhookApi.update_webhook",
    :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: WebhookApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end