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

    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 to delete

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

    the optional parameters

Returns:



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

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

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

Parameters:

  • webhook

    Webhook to delete

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

    the optional parameters

Returns:

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

    WebhookResponse data, 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
143
# File 'lib/ultracart_api/api/webhook_api.rb', line 104

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

  # 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(webhook)
  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,
    :return_type => 'WebhookResponse')
  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, Fixnum, Hash)>

Delete a webhook Delete a webhook on the UltraCart account.

Parameters:

  • webhook_oid

    The webhook 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/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' + '}', webhook_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: 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

    The webhook oid that owns the log.

  • request_id

    The request id associated with the log to view.

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

    the optional parameters

Returns:



150
151
152
153
# File 'lib/ultracart_api/api/webhook_api.rb', line 150

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

    The webhook oid to retrieve log summaries for.

  • 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)

  • :_since (String)

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

Returns:



213
214
215
216
# File 'lib/ultracart_api/api/webhook_api.rb', line 213

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

    The webhook oid to retrieve log summaries for.

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

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call.

  • :_offset (Integer)

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

  • :_since (String)

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

Returns:



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/ultracart_api/api/webhook_api.rb', line 226

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

  # query parameters
  query_params = {}
  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 = {}
  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 => 'WebhookLogSummariesResponse')
  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, Fixnum, Hash)>

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

Parameters:

  • webhook_oid

    The webhook oid that owns the log.

  • request_id

    The request id associated with the log to view.

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

    the optional parameters

Returns:

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

    WebhookLogResponse data, response status code and response headers



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/ultracart_api/api/webhook_api.rb', line 161

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' + '}', webhook_oid.to_s).sub('{' + 'requestId' + '}', request_id.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 => 'WebhookLogResponse')
  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:



277
278
279
280
# File 'lib/ultracart_api/api/webhook_api.rb', line 277

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

#get_webhooks_with_http_info(opts = {}) ⇒ Array<(WebhooksResponse, Fixnum, 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.

  • :_offset (Integer)

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

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

    WebhooksResponse data, response status code and response headers



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

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 = {}
  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 = {}
  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 => 'WebhooksResponse')
  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 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:



336
337
338
339
# File 'lib/ultracart_api/api/webhook_api.rb', line 336

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

    WebhookResponse data, response status code and response headers



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/ultracart_api/api/webhook_api.rb', line 347

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 = {}
  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(webhook)
  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 => 'WebhookResponse')
  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 = {}) ⇒ WebhookSampleRequestResponse

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

    The webhook oid that is receiving the reflowed events.

  • event_name

    The event to reflow.

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

    the optional parameters

Returns:



394
395
396
397
# File 'lib/ultracart_api/api/webhook_api.rb', line 394

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

    The webhook oid that is receiving the reflowed events.

  • event_name

    The event to reflow.

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

    the optional parameters

Returns:



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/ultracart_api/api/webhook_api.rb', line 405

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' + '}', webhook_oid.to_s).sub('{' + 'eventName' + '}', event_name.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 = nil
  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 => 'WebhookSampleRequestResponse')
  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, webhook_oid, opts = {}) ⇒ WebhookResponse

Update a webhook Update a webhook on the account

Parameters:

  • webhook

    Webhook to update

  • webhook_oid

    The webhook oid 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:



456
457
458
459
# File 'lib/ultracart_api/api/webhook_api.rb', line 456

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

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

Update a webhook Update a webhook on the account

Parameters:

  • webhook

    Webhook to update

  • webhook_oid

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

    WebhookResponse data, response status code and response headers



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

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

  # query parameters
  query_params = {}
  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(webhook)
  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 => 'WebhookResponse')
  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