ultracart_api 4.1.12 → 4.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/docs/WebhookApi.md CHANGED
@@ -1,628 +1,787 @@
1
- # UltracartClient::WebhookApi
2
-
3
- All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
-
5
- | Method | HTTP request | Description |
6
- | ------ | ------------ | ----------- |
7
- | [**delete_webhook**](WebhookApi.md#delete_webhook) | **DELETE** /webhook/webhooks/{webhookOid} | Delete a webhook |
8
- | [**delete_webhook_by_url**](WebhookApi.md#delete_webhook_by_url) | **DELETE** /webhook/webhooks | Delete a webhook by URL |
9
- | [**get_webhook_log**](WebhookApi.md#get_webhook_log) | **GET** /webhook/webhooks/{webhookOid}/logs/{requestId} | Retrieve an individual log |
10
- | [**get_webhook_log_summaries**](WebhookApi.md#get_webhook_log_summaries) | **GET** /webhook/webhooks/{webhookOid}/logs | Retrieve the log summaries |
11
- | [**get_webhooks**](WebhookApi.md#get_webhooks) | **GET** /webhook/webhooks | Retrieve webhooks |
12
- | [**insert_webhook**](WebhookApi.md#insert_webhook) | **POST** /webhook/webhooks | Add a webhook |
13
- | [**resend_event**](WebhookApi.md#resend_event) | **POST** /webhook/webhooks/{webhookOid}/reflow/{eventName} | Resend events to the webhook endpoint. |
14
- | [**update_webhook**](WebhookApi.md#update_webhook) | **PUT** /webhook/webhooks/{webhookOid} | Update a webhook |
15
-
16
-
17
- ## delete_webhook
18
-
19
- > delete_webhook(webhook_oid)
20
-
21
- Delete a webhook
22
-
23
- Delete a webhook on the UltraCart account.
24
-
25
- ### Examples
26
-
27
- ```ruby
28
- require 'time'
29
- require 'ultracart_api'
30
- require 'json'
31
- require 'yaml'
32
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
33
-
34
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
35
- # As such, this might not be the best way to use this object.
36
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
37
-
38
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
39
- webhook_oid = 56 # Integer | The webhook oid to delete.
40
-
41
- begin
42
- # Delete a webhook
43
- api_instance.delete_webhook(webhook_oid)
44
- rescue UltracartClient::ApiError => e
45
- puts "Error when calling WebhookApi->delete_webhook: #{e}"
46
- end
47
- ```
48
-
49
- #### Using the delete_webhook_with_http_info variant
50
-
51
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
52
-
53
- > <Array(nil, Integer, Hash)> delete_webhook_with_http_info(webhook_oid)
54
-
55
- ```ruby
56
- begin
57
- # Delete a webhook
58
- data, status_code, headers = api_instance.delete_webhook_with_http_info(webhook_oid)
59
- p status_code # => 2xx
60
- p headers # => { ... }
61
- p data # => nil
62
- rescue UltracartClient::ApiError => e
63
- puts "Error when calling WebhookApi->delete_webhook_with_http_info: #{e}"
64
- end
65
- ```
66
-
67
- ### Parameters
68
-
69
- | Name | Type | Description | Notes |
70
- | ---- | ---- | ----------- | ----- |
71
- | **webhook_oid** | **Integer** | The webhook oid to delete. | |
72
-
73
- ### Return type
74
-
75
- nil (empty response body)
76
-
77
- ### Authorization
78
-
79
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
80
-
81
- ### HTTP request headers
82
-
83
- - **Content-Type**: Not defined
84
- - **Accept**: application/json
85
-
86
-
87
- ## delete_webhook_by_url
88
-
89
- > <WebhookResponse> delete_webhook_by_url(webhook)
90
-
91
- Delete a webhook by URL
92
-
93
- Delete a webhook based upon the URL on the webhook_url matching an existing webhook.
94
-
95
- ### Examples
96
-
97
- ```ruby
98
- require 'time'
99
- require 'ultracart_api'
100
- require 'json'
101
- require 'yaml'
102
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
103
-
104
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
105
- # As such, this might not be the best way to use this object.
106
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
107
-
108
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
109
- webhook = UltracartClient::Webhook.new # Webhook | Webhook to delete
110
-
111
- begin
112
- # Delete a webhook by URL
113
- result = api_instance.delete_webhook_by_url(webhook)
114
- p result
115
- rescue UltracartClient::ApiError => e
116
- puts "Error when calling WebhookApi->delete_webhook_by_url: #{e}"
117
- end
118
- ```
119
-
120
- #### Using the delete_webhook_by_url_with_http_info variant
121
-
122
- This returns an Array which contains the response data, status code and headers.
123
-
124
- > <Array(<WebhookResponse>, Integer, Hash)> delete_webhook_by_url_with_http_info(webhook)
125
-
126
- ```ruby
127
- begin
128
- # Delete a webhook by URL
129
- data, status_code, headers = api_instance.delete_webhook_by_url_with_http_info(webhook)
130
- p status_code # => 2xx
131
- p headers # => { ... }
132
- p data # => <WebhookResponse>
133
- rescue UltracartClient::ApiError => e
134
- puts "Error when calling WebhookApi->delete_webhook_by_url_with_http_info: #{e}"
135
- end
136
- ```
137
-
138
- ### Parameters
139
-
140
- | Name | Type | Description | Notes |
141
- | ---- | ---- | ----------- | ----- |
142
- | **webhook** | [**Webhook**](Webhook.md) | Webhook to delete | |
143
-
144
- ### Return type
145
-
146
- [**WebhookResponse**](WebhookResponse.md)
147
-
148
- ### Authorization
149
-
150
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
151
-
152
- ### HTTP request headers
153
-
154
- - **Content-Type**: application/json; charset=UTF-8
155
- - **Accept**: application/json
156
-
157
-
158
- ## get_webhook_log
159
-
160
- > <WebhookLogResponse> get_webhook_log(webhook_oid, request_id)
161
-
162
- Retrieve an individual log
163
-
164
- Retrieves an individual log for a webhook given the webhook oid the request id.
165
-
166
- ### Examples
167
-
168
- ```ruby
169
- require 'time'
170
- require 'ultracart_api'
171
- require 'json'
172
- require 'yaml'
173
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
174
-
175
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
176
- # As such, this might not be the best way to use this object.
177
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
178
-
179
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
180
- webhook_oid = 56 # Integer | The webhook oid that owns the log.
181
- request_id = 'request_id_example' # String | The request id associated with the log to view.
182
-
183
- begin
184
- # Retrieve an individual log
185
- result = api_instance.get_webhook_log(webhook_oid, request_id)
186
- p result
187
- rescue UltracartClient::ApiError => e
188
- puts "Error when calling WebhookApi->get_webhook_log: #{e}"
189
- end
190
- ```
191
-
192
- #### Using the get_webhook_log_with_http_info variant
193
-
194
- This returns an Array which contains the response data, status code and headers.
195
-
196
- > <Array(<WebhookLogResponse>, Integer, Hash)> get_webhook_log_with_http_info(webhook_oid, request_id)
197
-
198
- ```ruby
199
- begin
200
- # Retrieve an individual log
201
- data, status_code, headers = api_instance.get_webhook_log_with_http_info(webhook_oid, request_id)
202
- p status_code # => 2xx
203
- p headers # => { ... }
204
- p data # => <WebhookLogResponse>
205
- rescue UltracartClient::ApiError => e
206
- puts "Error when calling WebhookApi->get_webhook_log_with_http_info: #{e}"
207
- end
208
- ```
209
-
210
- ### Parameters
211
-
212
- | Name | Type | Description | Notes |
213
- | ---- | ---- | ----------- | ----- |
214
- | **webhook_oid** | **Integer** | The webhook oid that owns the log. | |
215
- | **request_id** | **String** | The request id associated with the log to view. | |
216
-
217
- ### Return type
218
-
219
- [**WebhookLogResponse**](WebhookLogResponse.md)
220
-
221
- ### Authorization
222
-
223
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
224
-
225
- ### HTTP request headers
226
-
227
- - **Content-Type**: Not defined
228
- - **Accept**: application/json
229
-
230
-
231
- ## get_webhook_log_summaries
232
-
233
- > <WebhookLogSummariesResponse> get_webhook_log_summaries(webhook_oid, opts)
234
-
235
- Retrieve the log summaries
236
-
237
- Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
238
-
239
- ### Examples
240
-
241
- ```ruby
242
- require 'time'
243
- require 'ultracart_api'
244
- require 'json'
245
- require 'yaml'
246
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
247
-
248
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
249
- # As such, this might not be the best way to use this object.
250
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
251
-
252
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
253
- webhook_oid = 56 # Integer | The webhook oid to retrieve log summaries for.
254
- opts = {
255
- request_id: 'request_id_example', # String |
256
- begin_date: 'begin_date_example', # String |
257
- end_date: 'end_date_example', # String |
258
- status: 'status_example', # String |
259
- event: 'event_example', # String |
260
- order_id: 'order_id_example', # String |
261
- request: 'request_example', # String |
262
- duration: 56, # Integer |
263
- _limit: 56, # Integer | The maximum number of records to return on this one API call.
264
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
265
- _since: '_since_example' # String | Fetch log summaries that have been delivered since this date/time.
266
- }
267
-
268
- begin
269
- # Retrieve the log summaries
270
- result = api_instance.get_webhook_log_summaries(webhook_oid, opts)
271
- p result
272
- rescue UltracartClient::ApiError => e
273
- puts "Error when calling WebhookApi->get_webhook_log_summaries: #{e}"
274
- end
275
- ```
276
-
277
- #### Using the get_webhook_log_summaries_with_http_info variant
278
-
279
- This returns an Array which contains the response data, status code and headers.
280
-
281
- > <Array(<WebhookLogSummariesResponse>, Integer, Hash)> get_webhook_log_summaries_with_http_info(webhook_oid, opts)
282
-
283
- ```ruby
284
- begin
285
- # Retrieve the log summaries
286
- data, status_code, headers = api_instance.get_webhook_log_summaries_with_http_info(webhook_oid, opts)
287
- p status_code # => 2xx
288
- p headers # => { ... }
289
- p data # => <WebhookLogSummariesResponse>
290
- rescue UltracartClient::ApiError => e
291
- puts "Error when calling WebhookApi->get_webhook_log_summaries_with_http_info: #{e}"
292
- end
293
- ```
294
-
295
- ### Parameters
296
-
297
- | Name | Type | Description | Notes |
298
- | ---- | ---- | ----------- | ----- |
299
- | **webhook_oid** | **Integer** | The webhook oid to retrieve log summaries for. | |
300
- | **request_id** | **String** | | [optional] |
301
- | **begin_date** | **String** | | [optional] |
302
- | **end_date** | **String** | | [optional] |
303
- | **status** | **String** | | [optional] |
304
- | **event** | **String** | | [optional] |
305
- | **order_id** | **String** | | [optional] |
306
- | **request** | **String** | | [optional] |
307
- | **duration** | **Integer** | | [optional] |
308
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. | [optional][default to 100] |
309
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
310
- | **_since** | **String** | Fetch log summaries that have been delivered since this date/time. | [optional] |
311
-
312
- ### Return type
313
-
314
- [**WebhookLogSummariesResponse**](WebhookLogSummariesResponse.md)
315
-
316
- ### Authorization
317
-
318
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
319
-
320
- ### HTTP request headers
321
-
322
- - **Content-Type**: Not defined
323
- - **Accept**: application/json
324
-
325
-
326
- ## get_webhooks
327
-
328
- > <WebhooksResponse> get_webhooks(opts)
329
-
330
- Retrieve webhooks
331
-
332
- Retrieves the webhooks associated with this application.
333
-
334
- ### Examples
335
-
336
- ```ruby
337
- require 'time'
338
- require 'ultracart_api'
339
- require 'json'
340
- require 'yaml'
341
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
342
-
343
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
344
- # As such, this might not be the best way to use this object.
345
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
346
-
347
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
348
- opts = {
349
- _limit: 56, # Integer | The maximum number of records to return on this one API call.
350
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
351
- _sort: '_sort_example', # String | The sort order of the webhooks. See documentation for examples
352
- _placeholders: true # Boolean | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.
353
- }
354
-
355
- begin
356
- # Retrieve webhooks
357
- result = api_instance.get_webhooks(opts)
358
- p result
359
- rescue UltracartClient::ApiError => e
360
- puts "Error when calling WebhookApi->get_webhooks: #{e}"
361
- end
362
- ```
363
-
364
- #### Using the get_webhooks_with_http_info variant
365
-
366
- This returns an Array which contains the response data, status code and headers.
367
-
368
- > <Array(<WebhooksResponse>, Integer, Hash)> get_webhooks_with_http_info(opts)
369
-
370
- ```ruby
371
- begin
372
- # Retrieve webhooks
373
- data, status_code, headers = api_instance.get_webhooks_with_http_info(opts)
374
- p status_code # => 2xx
375
- p headers # => { ... }
376
- p data # => <WebhooksResponse>
377
- rescue UltracartClient::ApiError => e
378
- puts "Error when calling WebhookApi->get_webhooks_with_http_info: #{e}"
379
- end
380
- ```
381
-
382
- ### Parameters
383
-
384
- | Name | Type | Description | Notes |
385
- | ---- | ---- | ----------- | ----- |
386
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. | [optional][default to 100] |
387
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
388
- | **_sort** | **String** | The sort order of the webhooks. See documentation for examples | [optional] |
389
- | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
390
-
391
- ### Return type
392
-
393
- [**WebhooksResponse**](WebhooksResponse.md)
394
-
395
- ### Authorization
396
-
397
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
398
-
399
- ### HTTP request headers
400
-
401
- - **Content-Type**: Not defined
402
- - **Accept**: application/json
403
-
404
-
405
- ## insert_webhook
406
-
407
- > <WebhookResponse> insert_webhook(webhook, opts)
408
-
409
- Add a webhook
410
-
411
- 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.
412
-
413
- ### Examples
414
-
415
- ```ruby
416
- require 'time'
417
- require 'ultracart_api'
418
- require 'json'
419
- require 'yaml'
420
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
421
-
422
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
423
- # As such, this might not be the best way to use this object.
424
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
425
-
426
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
427
- webhook = UltracartClient::Webhook.new # Webhook | Webhook to create
428
- opts = {
429
- _placeholders: true # Boolean | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.
430
- }
431
-
432
- begin
433
- # Add a webhook
434
- result = api_instance.insert_webhook(webhook, opts)
435
- p result
436
- rescue UltracartClient::ApiError => e
437
- puts "Error when calling WebhookApi->insert_webhook: #{e}"
438
- end
439
- ```
440
-
441
- #### Using the insert_webhook_with_http_info variant
442
-
443
- This returns an Array which contains the response data, status code and headers.
444
-
445
- > <Array(<WebhookResponse>, Integer, Hash)> insert_webhook_with_http_info(webhook, opts)
446
-
447
- ```ruby
448
- begin
449
- # Add a webhook
450
- data, status_code, headers = api_instance.insert_webhook_with_http_info(webhook, opts)
451
- p status_code # => 2xx
452
- p headers # => { ... }
453
- p data # => <WebhookResponse>
454
- rescue UltracartClient::ApiError => e
455
- puts "Error when calling WebhookApi->insert_webhook_with_http_info: #{e}"
456
- end
457
- ```
458
-
459
- ### Parameters
460
-
461
- | Name | Type | Description | Notes |
462
- | ---- | ---- | ----------- | ----- |
463
- | **webhook** | [**Webhook**](Webhook.md) | Webhook to create | |
464
- | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
465
-
466
- ### Return type
467
-
468
- [**WebhookResponse**](WebhookResponse.md)
469
-
470
- ### Authorization
471
-
472
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
473
-
474
- ### HTTP request headers
475
-
476
- - **Content-Type**: application/json; charset=UTF-8
477
- - **Accept**: application/json
478
-
479
-
480
- ## resend_event
481
-
482
- > <WebhookReflowResponse> resend_event(webhook_oid, event_name)
483
-
484
- Resend events to the webhook endpoint.
485
-
486
- 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.
487
-
488
- ### Examples
489
-
490
- ```ruby
491
- require 'time'
492
- require 'ultracart_api'
493
- require 'json'
494
- require 'yaml'
495
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
496
-
497
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
498
- # As such, this might not be the best way to use this object.
499
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
500
-
501
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
502
- webhook_oid = 56 # Integer | The webhook oid that is receiving the reflowed events.
503
- event_name = 'event_name_example' # String | The event to reflow.
504
-
505
- begin
506
- # Resend events to the webhook endpoint.
507
- result = api_instance.resend_event(webhook_oid, event_name)
508
- p result
509
- rescue UltracartClient::ApiError => e
510
- puts "Error when calling WebhookApi->resend_event: #{e}"
511
- end
512
- ```
513
-
514
- #### Using the resend_event_with_http_info variant
515
-
516
- This returns an Array which contains the response data, status code and headers.
517
-
518
- > <Array(<WebhookReflowResponse>, Integer, Hash)> resend_event_with_http_info(webhook_oid, event_name)
519
-
520
- ```ruby
521
- begin
522
- # Resend events to the webhook endpoint.
523
- data, status_code, headers = api_instance.resend_event_with_http_info(webhook_oid, event_name)
524
- p status_code # => 2xx
525
- p headers # => { ... }
526
- p data # => <WebhookReflowResponse>
527
- rescue UltracartClient::ApiError => e
528
- puts "Error when calling WebhookApi->resend_event_with_http_info: #{e}"
529
- end
530
- ```
531
-
532
- ### Parameters
533
-
534
- | Name | Type | Description | Notes |
535
- | ---- | ---- | ----------- | ----- |
536
- | **webhook_oid** | **Integer** | The webhook oid that is receiving the reflowed events. | |
537
- | **event_name** | **String** | The event to reflow. | |
538
-
539
- ### Return type
540
-
541
- [**WebhookReflowResponse**](WebhookReflowResponse.md)
542
-
543
- ### Authorization
544
-
545
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
546
-
547
- ### HTTP request headers
548
-
549
- - **Content-Type**: Not defined
550
- - **Accept**: application/json
551
-
552
-
553
- ## update_webhook
554
-
555
- > <WebhookResponse> update_webhook(webhook_oid, webhook, opts)
556
-
557
- Update a webhook
558
-
559
- Update a webhook on the account
560
-
561
- ### Examples
562
-
563
- ```ruby
564
- require 'time'
565
- require 'ultracart_api'
566
- require 'json'
567
- require 'yaml'
568
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
569
-
570
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
571
- # As such, this might not be the best way to use this object.
572
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
573
-
574
- api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
575
- webhook_oid = 56 # Integer | The webhook oid to update.
576
- webhook = UltracartClient::Webhook.new # Webhook | Webhook to update
577
- opts = {
578
- _placeholders: true # Boolean | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API.
579
- }
580
-
581
- begin
582
- # Update a webhook
583
- result = api_instance.update_webhook(webhook_oid, webhook, opts)
584
- p result
585
- rescue UltracartClient::ApiError => e
586
- puts "Error when calling WebhookApi->update_webhook: #{e}"
587
- end
588
- ```
589
-
590
- #### Using the update_webhook_with_http_info variant
591
-
592
- This returns an Array which contains the response data, status code and headers.
593
-
594
- > <Array(<WebhookResponse>, Integer, Hash)> update_webhook_with_http_info(webhook_oid, webhook, opts)
595
-
596
- ```ruby
597
- begin
598
- # Update a webhook
599
- data, status_code, headers = api_instance.update_webhook_with_http_info(webhook_oid, webhook, opts)
600
- p status_code # => 2xx
601
- p headers # => { ... }
602
- p data # => <WebhookResponse>
603
- rescue UltracartClient::ApiError => e
604
- puts "Error when calling WebhookApi->update_webhook_with_http_info: #{e}"
605
- end
606
- ```
607
-
608
- ### Parameters
609
-
610
- | Name | Type | Description | Notes |
611
- | ---- | ---- | ----------- | ----- |
612
- | **webhook_oid** | **Integer** | The webhook oid to update. | |
613
- | **webhook** | [**Webhook**](Webhook.md) | Webhook to update | |
614
- | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
615
-
616
- ### Return type
617
-
618
- [**WebhookResponse**](WebhookResponse.md)
619
-
620
- ### Authorization
621
-
622
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
623
-
624
- ### HTTP request headers
625
-
626
- - **Content-Type**: application/json; charset=UTF-8
627
- - **Accept**: application/json
628
-
1
+ # UltracartClient::WebhookApi
2
+
3
+ All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**delete_webhook**](WebhookApi.md#delete_webhook) | **DELETE** /webhook/webhooks/{webhookOid} | Delete a webhook |
8
+ | [**delete_webhook_by_url**](WebhookApi.md#delete_webhook_by_url) | **DELETE** /webhook/webhooks | Delete a webhook by URL |
9
+ | [**get_webhook_log**](WebhookApi.md#get_webhook_log) | **GET** /webhook/webhooks/{webhookOid}/logs/{requestId} | Retrieve an individual log |
10
+ | [**get_webhook_log_summaries**](WebhookApi.md#get_webhook_log_summaries) | **GET** /webhook/webhooks/{webhookOid}/logs | Retrieve the log summaries |
11
+ | [**get_webhooks**](WebhookApi.md#get_webhooks) | **GET** /webhook/webhooks | Retrieve webhooks |
12
+ | [**insert_webhook**](WebhookApi.md#insert_webhook) | **POST** /webhook/webhooks | Add a webhook |
13
+ | [**resend_event**](WebhookApi.md#resend_event) | **POST** /webhook/webhooks/{webhookOid}/reflow/{eventName} | Resend events to the webhook endpoint. |
14
+ | [**update_webhook**](WebhookApi.md#update_webhook) | **PUT** /webhook/webhooks/{webhookOid} | Update a webhook |
15
+
16
+
17
+ ## delete_webhook
18
+
19
+ > delete_webhook(webhook_oid)
20
+
21
+ Delete a webhook
22
+
23
+ Delete a webhook on the UltraCart account.
24
+
25
+
26
+ ### Examples
27
+
28
+ ```ruby
29
+ require 'ultracart_api'
30
+ require_relative '../constants'
31
+
32
+ # deletes a webhook
33
+ #
34
+ # You will need the webhook_oid to call this method. Call getWebhooks() if you don't know your oid.
35
+ # Returns status code 204 (No Content) on success
36
+
37
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
38
+ webhook_oid = 123456789 # call getWebhooks if you don't know this.
39
+ webhook_api.delete_webhook(webhook_oid)
40
+ ```
41
+
42
+
43
+ #### Using the delete_webhook_with_http_info variant
44
+
45
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
46
+
47
+ > <Array(nil, Integer, Hash)> delete_webhook_with_http_info(webhook_oid)
48
+
49
+ ```ruby
50
+ begin
51
+ # Delete a webhook
52
+ data, status_code, headers = api_instance.delete_webhook_with_http_info(webhook_oid)
53
+ p status_code # => 2xx
54
+ p headers # => { ... }
55
+ p data # => nil
56
+ rescue UltracartClient::ApiError => e
57
+ puts "Error when calling WebhookApi->delete_webhook_with_http_info: #{e}"
58
+ end
59
+ ```
60
+
61
+ ### Parameters
62
+
63
+ | Name | Type | Description | Notes |
64
+ | ---- | ---- | ----------- | ----- |
65
+ | **webhook_oid** | **Integer** | The webhook oid to delete. | |
66
+
67
+ ### Return type
68
+
69
+ nil (empty response body)
70
+
71
+ ### Authorization
72
+
73
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
74
+
75
+ ### HTTP request headers
76
+
77
+ - **Content-Type**: Not defined
78
+ - **Accept**: application/json
79
+
80
+
81
+ ## delete_webhook_by_url
82
+
83
+ > <WebhookResponse> delete_webhook_by_url(webhook)
84
+
85
+ Delete a webhook by URL
86
+
87
+ Delete a webhook based upon the URL on the webhook_url matching an existing webhook.
88
+
89
+
90
+ ### Examples
91
+
92
+ ```ruby
93
+ require 'ultracart_api'
94
+ require_relative '../constants'
95
+
96
+ # This method can be confusing due to its payload. The method does indeed delete a webhook by url, but you need to
97
+ # pass a webhook object in as the payload. However, only the url is used. UltraCart does this to avoid any confusion
98
+ # with the rest url versus the webhook url.
99
+ #
100
+ # To use:
101
+ # Get your webhook url.
102
+ # Create a Webhook object.
103
+ # Set the Webhook url property.
104
+ # Pass the webhook to deleteWebhookByUrl()
105
+ #
106
+ # Returns status code 204 (No Content) on success
107
+
108
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
109
+
110
+ webhook_url = "https://www.mywebiste.com/page/to/call/when/this/webhook/fires.php"
111
+ webhook = UltracartClient::Webhook.new
112
+ webhook.webhook_url = webhook_url
113
+
114
+ webhook_api.delete_webhook_by_url(webhook)
115
+ ```
116
+
117
+
118
+ #### Using the delete_webhook_by_url_with_http_info variant
119
+
120
+ This returns an Array which contains the response data, status code and headers.
121
+
122
+ > <Array(<WebhookResponse>, Integer, Hash)> delete_webhook_by_url_with_http_info(webhook)
123
+
124
+ ```ruby
125
+ begin
126
+ # Delete a webhook by URL
127
+ data, status_code, headers = api_instance.delete_webhook_by_url_with_http_info(webhook)
128
+ p status_code # => 2xx
129
+ p headers # => { ... }
130
+ p data # => <WebhookResponse>
131
+ rescue UltracartClient::ApiError => e
132
+ puts "Error when calling WebhookApi->delete_webhook_by_url_with_http_info: #{e}"
133
+ end
134
+ ```
135
+
136
+ ### Parameters
137
+
138
+ | Name | Type | Description | Notes |
139
+ | ---- | ---- | ----------- | ----- |
140
+ | **webhook** | [**Webhook**](Webhook.md) | Webhook to delete | |
141
+
142
+ ### Return type
143
+
144
+ [**WebhookResponse**](WebhookResponse.md)
145
+
146
+ ### Authorization
147
+
148
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
149
+
150
+ ### HTTP request headers
151
+
152
+ - **Content-Type**: application/json; charset=UTF-8
153
+ - **Accept**: application/json
154
+
155
+
156
+ ## get_webhook_log
157
+
158
+ > <WebhookLogResponse> get_webhook_log(webhook_oid, request_id)
159
+
160
+ Retrieve an individual log
161
+
162
+ Retrieves an individual log for a webhook given the webhook oid the request id.
163
+
164
+
165
+ ### Examples
166
+
167
+ ```ruby
168
+ require 'ultracart_api'
169
+ require_relative '../constants'
170
+
171
+ # getWebhookLog() provides a detail log of a webhook event. It is used in tandem with getWebhookLogSummaries to audit
172
+ # webhook events. This method call will require the webhook_oid and the request_id. The webhook_oid can be discerned
173
+ # from the results of getWebhooks() and the request_id can be found from getWebhookLogSummaries(). see those examples
174
+ # if needed.
175
+
176
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
177
+
178
+ webhook_oid = 123456789 # call getWebhooks if you don't know this.
179
+ request_id = '987654321' # call getWebhookLogSummaries if you don't know this.
180
+
181
+ api_response = webhook_api.get_webhook_log(webhook_oid, request_id)
182
+ webhook_log = api_response.webhook_log
183
+
184
+ if api_response.error
185
+ puts api_response.error.developer_message
186
+ puts api_response.error.user_message
187
+ exit
188
+ end
189
+
190
+ puts webhook_log
191
+ ```
192
+
193
+
194
+ #### Using the get_webhook_log_with_http_info variant
195
+
196
+ This returns an Array which contains the response data, status code and headers.
197
+
198
+ > <Array(<WebhookLogResponse>, Integer, Hash)> get_webhook_log_with_http_info(webhook_oid, request_id)
199
+
200
+ ```ruby
201
+ begin
202
+ # Retrieve an individual log
203
+ data, status_code, headers = api_instance.get_webhook_log_with_http_info(webhook_oid, request_id)
204
+ p status_code # => 2xx
205
+ p headers # => { ... }
206
+ p data # => <WebhookLogResponse>
207
+ rescue UltracartClient::ApiError => e
208
+ puts "Error when calling WebhookApi->get_webhook_log_with_http_info: #{e}"
209
+ end
210
+ ```
211
+
212
+ ### Parameters
213
+
214
+ | Name | Type | Description | Notes |
215
+ | ---- | ---- | ----------- | ----- |
216
+ | **webhook_oid** | **Integer** | The webhook oid that owns the log. | |
217
+ | **request_id** | **String** | The request id associated with the log to view. | |
218
+
219
+ ### Return type
220
+
221
+ [**WebhookLogResponse**](WebhookLogResponse.md)
222
+
223
+ ### Authorization
224
+
225
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
226
+
227
+ ### HTTP request headers
228
+
229
+ - **Content-Type**: Not defined
230
+ - **Accept**: application/json
231
+
232
+
233
+ ## get_webhook_log_summaries
234
+
235
+ > <WebhookLogSummariesResponse> get_webhook_log_summaries(webhook_oid, opts)
236
+
237
+ Retrieve the log summaries
238
+
239
+ Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
240
+
241
+
242
+ ### Examples
243
+
244
+ ```ruby
245
+ require 'ultracart_api'
246
+ require_relative '../constants'
247
+
248
+ # This example illustrates how to retrieve webhook log summaries.
249
+
250
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
251
+
252
+ def get_summary_chunk(webhook_api, offset, limit)
253
+ webhook_oid = 123456789 # if you don't know this, use getWebhooks to find your webhook, then get its oid.
254
+ _since = (Date.today - 10).strftime('%Y-%m-%d') + "T00:00:00+00:00" # get the last 10 days
255
+ # Pay attention to whether limit or offset comes first in the method signature. UltraCart is not consistent with their ordering.
256
+ api_response = webhook_api.get_webhook_log_summaries(webhook_oid, limit, offset, _since)
257
+
258
+ return api_response.webhook_log_summaries if api_response.webhook_log_summaries
259
+ []
260
+ end
261
+
262
+ summaries = []
263
+
264
+ iteration = 1
265
+ offset = 0
266
+ limit = 200
267
+ more_records_to_fetch = true
268
+
269
+ begin
270
+ while more_records_to_fetch
271
+ puts "executing iteration #{iteration}"
272
+
273
+ chunk_of_summaries = get_summary_chunk(webhook_api, offset, limit)
274
+ summaries.concat(chunk_of_summaries)
275
+ offset = offset + limit
276
+ more_records_to_fetch = chunk_of_summaries.length == limit
277
+ iteration += 1
278
+ end
279
+ rescue UltracartClient::ApiError => e
280
+ puts "ApiError occurred on iteration #{iteration}"
281
+ puts e.inspect
282
+ exit 1
283
+ end
284
+
285
+ # this will be verbose...
286
+ puts summaries.inspect
287
+ ```
288
+
289
+
290
+ #### Using the get_webhook_log_summaries_with_http_info variant
291
+
292
+ This returns an Array which contains the response data, status code and headers.
293
+
294
+ > <Array(<WebhookLogSummariesResponse>, Integer, Hash)> get_webhook_log_summaries_with_http_info(webhook_oid, opts)
295
+
296
+ ```ruby
297
+ begin
298
+ # Retrieve the log summaries
299
+ data, status_code, headers = api_instance.get_webhook_log_summaries_with_http_info(webhook_oid, opts)
300
+ p status_code # => 2xx
301
+ p headers # => { ... }
302
+ p data # => <WebhookLogSummariesResponse>
303
+ rescue UltracartClient::ApiError => e
304
+ puts "Error when calling WebhookApi->get_webhook_log_summaries_with_http_info: #{e}"
305
+ end
306
+ ```
307
+
308
+ ### Parameters
309
+
310
+ | Name | Type | Description | Notes |
311
+ | ---- | ---- | ----------- | ----- |
312
+ | **webhook_oid** | **Integer** | The webhook oid to retrieve log summaries for. | |
313
+ | **request_id** | **String** | | [optional] |
314
+ | **begin_date** | **String** | | [optional] |
315
+ | **end_date** | **String** | | [optional] |
316
+ | **status** | **String** | | [optional] |
317
+ | **event** | **String** | | [optional] |
318
+ | **order_id** | **String** | | [optional] |
319
+ | **request** | **String** | | [optional] |
320
+ | **duration** | **Integer** | | [optional] |
321
+ | **_limit** | **Integer** | The maximum number of records to return on this one API call. | [optional][default to 100] |
322
+ | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
323
+ | **_since** | **String** | Fetch log summaries that have been delivered since this date/time. | [optional] |
324
+
325
+ ### Return type
326
+
327
+ [**WebhookLogSummariesResponse**](WebhookLogSummariesResponse.md)
328
+
329
+ ### Authorization
330
+
331
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
332
+
333
+ ### HTTP request headers
334
+
335
+ - **Content-Type**: Not defined
336
+ - **Accept**: application/json
337
+
338
+
339
+ ## get_webhooks
340
+
341
+ > <WebhooksResponse> get_webhooks(opts)
342
+
343
+ Retrieve webhooks
344
+
345
+ Retrieves the webhooks associated with this application.
346
+
347
+
348
+ ### Examples
349
+
350
+ ```ruby
351
+ require 'ultracart_api'
352
+ require_relative '../constants'
353
+
354
+ # This example illustrates how to retrieve all webhooks.
355
+
356
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
357
+
358
+ def get_webhook_chunk(webhook_api, offset, limit)
359
+ _sort = nil # default sorting is webhook_url, disabled, and those are also the two choices for sorting.
360
+ _placeholders = nil # useful for UI displays, but not needed here.
361
+ # Pay attention to whether limit or offset comes first in the method signature. UltraCart is not consistent with their ordering.
362
+ opts = {
363
+ '_sort' => _sort,
364
+ '_placeholders' => _placeholders
365
+ }
366
+ api_response = webhook_api.get_webhooks(limit, offset, opts)
367
+
368
+ return api_response.webhooks if api_response.webhooks
369
+ []
370
+ end
371
+
372
+ webhooks = []
373
+
374
+ iteration = 1
375
+ offset = 0
376
+ limit = 200
377
+ more_records_to_fetch = true
378
+
379
+ begin
380
+ while more_records_to_fetch
381
+ puts "executing iteration #{iteration}"
382
+
383
+ chunk_of_webhooks = get_webhook_chunk(webhook_api, offset, limit)
384
+ webhooks.concat(chunk_of_webhooks)
385
+ offset = offset + limit
386
+ more_records_to_fetch = chunk_of_webhooks.length == limit
387
+ iteration += 1
388
+ end
389
+ rescue UltracartClient::ApiError => e
390
+ puts "ApiError occurred on iteration #{iteration}"
391
+ puts e.inspect
392
+ exit 1
393
+ end
394
+
395
+ # this will be verbose...
396
+ puts webhooks.inspect
397
+ ```
398
+
399
+
400
+ #### Using the get_webhooks_with_http_info variant
401
+
402
+ This returns an Array which contains the response data, status code and headers.
403
+
404
+ > <Array(<WebhooksResponse>, Integer, Hash)> get_webhooks_with_http_info(opts)
405
+
406
+ ```ruby
407
+ begin
408
+ # Retrieve webhooks
409
+ data, status_code, headers = api_instance.get_webhooks_with_http_info(opts)
410
+ p status_code # => 2xx
411
+ p headers # => { ... }
412
+ p data # => <WebhooksResponse>
413
+ rescue UltracartClient::ApiError => e
414
+ puts "Error when calling WebhookApi->get_webhooks_with_http_info: #{e}"
415
+ end
416
+ ```
417
+
418
+ ### Parameters
419
+
420
+ | Name | Type | Description | Notes |
421
+ | ---- | ---- | ----------- | ----- |
422
+ | **_limit** | **Integer** | The maximum number of records to return on this one API call. | [optional][default to 100] |
423
+ | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
424
+ | **_sort** | **String** | The sort order of the webhooks. See documentation for examples | [optional] |
425
+ | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
426
+
427
+ ### Return type
428
+
429
+ [**WebhooksResponse**](WebhooksResponse.md)
430
+
431
+ ### Authorization
432
+
433
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
434
+
435
+ ### HTTP request headers
436
+
437
+ - **Content-Type**: Not defined
438
+ - **Accept**: application/json
439
+
440
+
441
+ ## insert_webhook
442
+
443
+ > <WebhookResponse> insert_webhook(webhook, opts)
444
+
445
+ Add a webhook
446
+
447
+ 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.
448
+
449
+
450
+ ### Examples
451
+
452
+ ```ruby
453
+ require 'ultracart_api'
454
+ require_relative '../constants'
455
+
456
+ # Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but
457
+ # do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and
458
+ # return them. This allows your application to have simpler logic on the setup of a secure webhook.
459
+ #
460
+ # Event Category Event Name Description
461
+ # auto_order auto_order_cancel Fired when an auto order is canceled
462
+ # auto_order auto_order_create Fired when an auto order is created
463
+ # auto_order auto_order_decline Fired when an auto order is declined
464
+ # auto_order auto_order_disable Fired when an auto order is disabled
465
+ # auto_order auto_order_preshipment Fired when an auto order generates a new pre-shipment notice
466
+ # auto_order auto_order_rebill Fired when an auto order is rebilled
467
+ # auto_order auto_order_update Fired when an auto order is updated
468
+ # chargeback chargeback_create Fired when a chargeback is created
469
+ # chargeback chargeback_delete Fired when a chargeback is deleted
470
+ # chargeback chargeback_update Fired when a chargeback is updated
471
+ # checkout checkout_cart_abandon Fired when a cart is abandoned
472
+ # checkout checkout_cart_send_return_email Fired when a return email should be sent to a customer
473
+ # customer customer_create Fired when a customer profile is created.
474
+ # customer customer_delete Fired when a customer profile is deleted.
475
+ # customer customer_update Fired when a customer profile is updated.
476
+ # fulfillment fulfillment_hold Fired when an order is held for review
477
+ # fulfillment fulfillment_transmit Fired to transmit an order to the fulfillment house
478
+ # item item_create Fired when a new item is created.
479
+ # item item_delete Fired when an item is deleted.
480
+ # item item_update Fired when an item is updated.
481
+ # order order_abandon_recovery Fired when a previously abandoned cart turns into an order
482
+ # order order_create Fired when an order is placed
483
+ # order order_delete Fired when an order is deleted
484
+ # order order_payment_failed Fired when a payment fails
485
+ # order order_payment_process Fired when a payment is processed
486
+ # order order_refund Fired when an order is refunded
487
+ # order order_reject Fired when an order is rejected
488
+ # order order_s3_invoice Fired when an invoice PDF is stored in S3 bucket
489
+ # order order_s3_packing_slip Fired when a packing slip PDF is stored in an S3 bucket
490
+ # order order_ship Fired when an order is shipped
491
+ # order order_ship_delivered Fired when an order has a shipment delivered
492
+ # order order_ship_expected Fired when an order has an expected delivery date
493
+ # order order_ship_out_for_delivery Fired when an order has a shipment out for delivery
494
+ # order order_stage_change Fired when an order stage changes
495
+ # order order_update Fired when an order is edited
496
+ # storefront screen_recording Fired when a screen recording is created
497
+ # user user_create Fired when a user is created
498
+ # user user_delete Fired when a user is deleted
499
+ # user user_login Fired when a user logs in
500
+ # user user_update Fired when a user is updated
501
+ # workflow_task workflow_task_create Fired when a workflow task is created
502
+ # workflow_task workflow_task_delete Fired when a workflow task is deleted
503
+ # workflow_task workflow_task_update Fired when a workflow task is updated
504
+ #
505
+ # Note: Each event uses the same expansions as the event category. To see a list of possible expansion values,
506
+ # visit www.ultracart.com/api/. Order Expansions (https://www.ultracart.com/api/#resource_order.html) are listed
507
+ # below because most webhooks are for order events.
508
+ # Order Expansion:
509
+ # affiliate auto_order billing checkout
510
+ # affiliate.ledger channel_partner coupon customer_profile
511
+ # digital_order edi fraud_score gift
512
+ # gift_certificate internal item linked_shipment
513
+ # marketing payment payment.transaction point_of_sale
514
+ # quote salesforce shipping shipping.tracking_number_details
515
+ # summary taxes utms
516
+ #
517
+ # Note: The WebhookEventSubscription.event_ruler field is processed with the AWS Event Ruler library to filter down
518
+ # events to just what you want. If you wish to employ a ruler filter, see https://github.com/aws/event-ruler
519
+ # for syntax examples. You'll need to apply the aws syntax against the UltraCart object models. Contact UltraCart
520
+ # support if you need assistance creating the proper ruler expression.
521
+
522
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
523
+
524
+ webhook = UltracartClient::Webhook.new
525
+ webhook.webhook_url = "https://www.mywebiste.com/page/to/call/when/this/webhook/fires.php" # Must be HTTPS if customer related information is being delivered.
526
+ webhook.authentication_type = "basic" # "basic","none","api user","aws iam"
527
+ webhook.basic_username = "george"
528
+ webhook.basic_password = "LlamaLlamaRedPajama"
529
+ webhook.maximum_events = 10
530
+ webhook.maximum_size = 5242880 # 5 MB is pretty chunky.
531
+ webhook.api_version = "2017-03-01" # this is our only API version so far.
532
+ webhook.compress_events = true # compress events with gzip, then base64 encode them as a string.
533
+
534
+ event_sub1 = UltracartClient::WebhookEventSubscription.new
535
+ event_sub1.event_name = "order_create"
536
+ event_sub1.event_description = "when an order is placed"
537
+ event_sub1.expansion = "shipping,billing,item,coupon,summary" # whatever you need.
538
+ event_sub1.event_ruler = nil # no filtering. we want all objects.
539
+ event_sub1.comments = "Merchant specific comment, for example: Bobby needs this webhook for the Accounting department."
540
+
541
+ event_sub2 = UltracartClient::WebhookEventSubscription.new
542
+ event_sub2.event_name = "order_update"
543
+ event_sub2.event_description = "when an order is modified"
544
+ event_sub2.expansion = "shipping,billing,item,coupon,summary" # whatever you need.
545
+ event_sub2.event_ruler = nil # no filtering. we want all objects.
546
+ event_sub2.comments = "Merchant specific comment, for example: Bobby needs this webhook for the Accounting department."
547
+
548
+ event_sub3 = UltracartClient::WebhookEventSubscription.new
549
+ event_sub3.event_name = "order_delete"
550
+ event_sub3.event_description = "when an order is modified"
551
+ event_sub3.expansion = "" # don't need any expansion on delete. only need to know the order_id
552
+ event_sub3.event_ruler = nil # no filtering. we want all objects.
553
+ event_sub3.comments = "Merchant specific comment, for example: Bobby needs this webhook for the Accounting department."
554
+
555
+ event_category1 = UltracartClient::WebhookEventCategory.new
556
+ event_category1.event_category = "order"
557
+ event_category1.events = [event_sub1, event_sub2, event_sub3]
558
+
559
+ # api_response.webhook will return the newly created webhook.
560
+ api_response = webhook_api.insert_webhook(webhook, false)
561
+
562
+ if api_response.error
563
+ puts api_response.error.developer_message
564
+ puts api_response.error.user_message
565
+ exit
566
+ end
567
+
568
+ created_webhook = api_response.webhook
569
+ # TODO - store the webhook oid in case you ever need to make changes.
570
+
571
+ # This should equal what you submitted, plus contain much new information
572
+ puts created_webhook.inspect
573
+ ```
574
+
575
+
576
+ #### Using the insert_webhook_with_http_info variant
577
+
578
+ This returns an Array which contains the response data, status code and headers.
579
+
580
+ > <Array(<WebhookResponse>, Integer, Hash)> insert_webhook_with_http_info(webhook, opts)
581
+
582
+ ```ruby
583
+ begin
584
+ # Add a webhook
585
+ data, status_code, headers = api_instance.insert_webhook_with_http_info(webhook, opts)
586
+ p status_code # => 2xx
587
+ p headers # => { ... }
588
+ p data # => <WebhookResponse>
589
+ rescue UltracartClient::ApiError => e
590
+ puts "Error when calling WebhookApi->insert_webhook_with_http_info: #{e}"
591
+ end
592
+ ```
593
+
594
+ ### Parameters
595
+
596
+ | Name | Type | Description | Notes |
597
+ | ---- | ---- | ----------- | ----- |
598
+ | **webhook** | [**Webhook**](Webhook.md) | Webhook to create | |
599
+ | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
600
+
601
+ ### Return type
602
+
603
+ [**WebhookResponse**](WebhookResponse.md)
604
+
605
+ ### Authorization
606
+
607
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
608
+
609
+ ### HTTP request headers
610
+
611
+ - **Content-Type**: application/json; charset=UTF-8
612
+ - **Accept**: application/json
613
+
614
+
615
+ ## resend_event
616
+
617
+ > <WebhookReflowResponse> resend_event(webhook_oid, event_name)
618
+
619
+ Resend events to the webhook endpoint.
620
+
621
+ 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.
622
+
623
+
624
+ ### Examples
625
+
626
+ ```ruby
627
+ require 'ultracart_api'
628
+ require_relative '../constants'
629
+
630
+ # resentEvent is used to reflow an event. It will resend ALL events in history. So it is essentially a way to
631
+ # get all objects from an event. Currently, there are only two events available for reflow: "item_update", and "order_create".
632
+ # These two events provide the means to have a webhook receive all items or orders. This method is usually called
633
+ # at the beginning of a webhook's life to prepopulate a merchant's database with all items or orders.
634
+ #
635
+ # You will need the webhook_oid to call this method. Call getWebhooks() if you don't know your oid.
636
+
637
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
638
+
639
+ webhook_oid = 123456789 # call getWebhooks if you don't know this.
640
+ event_name = "item_update" # or "order_create", but for this sample, we want all items.
641
+
642
+ api_response = webhook_api.resend_event(webhook_oid, event_name)
643
+ reflow = api_response.reflow
644
+ success = reflow.queued
645
+
646
+ if api_response.error
647
+ puts api_response.error.developer_message
648
+ puts api_response.error.user_message
649
+ exit
650
+ end
651
+
652
+ puts api_response.inspect
653
+ ```
654
+
655
+
656
+ #### Using the resend_event_with_http_info variant
657
+
658
+ This returns an Array which contains the response data, status code and headers.
659
+
660
+ > <Array(<WebhookReflowResponse>, Integer, Hash)> resend_event_with_http_info(webhook_oid, event_name)
661
+
662
+ ```ruby
663
+ begin
664
+ # Resend events to the webhook endpoint.
665
+ data, status_code, headers = api_instance.resend_event_with_http_info(webhook_oid, event_name)
666
+ p status_code # => 2xx
667
+ p headers # => { ... }
668
+ p data # => <WebhookReflowResponse>
669
+ rescue UltracartClient::ApiError => e
670
+ puts "Error when calling WebhookApi->resend_event_with_http_info: #{e}"
671
+ end
672
+ ```
673
+
674
+ ### Parameters
675
+
676
+ | Name | Type | Description | Notes |
677
+ | ---- | ---- | ----------- | ----- |
678
+ | **webhook_oid** | **Integer** | The webhook oid that is receiving the reflowed events. | |
679
+ | **event_name** | **String** | The event to reflow. | |
680
+
681
+ ### Return type
682
+
683
+ [**WebhookReflowResponse**](WebhookReflowResponse.md)
684
+
685
+ ### Authorization
686
+
687
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
688
+
689
+ ### HTTP request headers
690
+
691
+ - **Content-Type**: Not defined
692
+ - **Accept**: application/json
693
+
694
+
695
+ ## update_webhook
696
+
697
+ > <WebhookResponse> update_webhook(webhook_oid, webhook, opts)
698
+
699
+ Update a webhook
700
+
701
+ Update a webhook on the account
702
+
703
+
704
+ ### Examples
705
+
706
+ ```ruby
707
+ require 'ultracart_api'
708
+ require_relative '../constants'
709
+
710
+ # Updates a webhook on the account. See insertWebhook.php for a complete example with field usage.
711
+ # For this example, we are just updating the basic password.
712
+
713
+ webhook_api = UltracartClient::WebhookApi.new_using_api_key(Constants::API_KEY)
714
+
715
+ # you should have stored this when you created the webhook. If you don't know it, call getWebhooks and iterate through
716
+ # them to find you target webhook (add useful comments to each webhook really helps in this endeavor) and get the
717
+ # webhook oid from that. You'll want to call getWebhooks any way to get the object for updating. It is HIGHLY
718
+ # recommended to get the object from UltraCart for updating rather than constructing it yourself to avoid accidentally
719
+ # deleting a part of the object during the update.
720
+ webhook_oid = 123456789
721
+
722
+ webhook_to_update = nil
723
+ opts = {
724
+ '_sort' => nil,
725
+ '_placeholders' => nil
726
+ }
727
+ webhooks = webhook_api.get_webhooks(100, 0, opts).webhooks
728
+ webhooks.each do |webhook|
729
+ if webhook.webhook_oid == webhook_oid
730
+ webhook_to_update = webhook
731
+ break
732
+ end
733
+ end
734
+
735
+ webhook_to_update.basic_password = "new password here"
736
+ api_response = webhook_api.update_webhook(webhook_oid, webhook_to_update)
737
+ updated_webhook = api_response.webhook
738
+
739
+ if api_response.error
740
+ puts api_response.error.developer_message
741
+ puts api_response.error.user_message
742
+ exit
743
+ end
744
+
745
+ puts updated_webhook.inspect
746
+ ```
747
+
748
+
749
+ #### Using the update_webhook_with_http_info variant
750
+
751
+ This returns an Array which contains the response data, status code and headers.
752
+
753
+ > <Array(<WebhookResponse>, Integer, Hash)> update_webhook_with_http_info(webhook_oid, webhook, opts)
754
+
755
+ ```ruby
756
+ begin
757
+ # Update a webhook
758
+ data, status_code, headers = api_instance.update_webhook_with_http_info(webhook_oid, webhook, opts)
759
+ p status_code # => 2xx
760
+ p headers # => { ... }
761
+ p data # => <WebhookResponse>
762
+ rescue UltracartClient::ApiError => e
763
+ puts "Error when calling WebhookApi->update_webhook_with_http_info: #{e}"
764
+ end
765
+ ```
766
+
767
+ ### Parameters
768
+
769
+ | Name | Type | Description | Notes |
770
+ | ---- | ---- | ----------- | ----- |
771
+ | **webhook_oid** | **Integer** | The webhook oid to update. | |
772
+ | **webhook** | [**Webhook**](Webhook.md) | Webhook to update | |
773
+ | **_placeholders** | **Boolean** | Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. | [optional] |
774
+
775
+ ### Return type
776
+
777
+ [**WebhookResponse**](WebhookResponse.md)
778
+
779
+ ### Authorization
780
+
781
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
782
+
783
+ ### HTTP request headers
784
+
785
+ - **Content-Type**: application/json; charset=UTF-8
786
+ - **Accept**: application/json
787
+