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.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/docs/AffiliateApi.md +123 -167
- data/docs/AutoOrderApi.md +1250 -903
- data/docs/ChannelPartnerApi.md +1678 -1121
- data/docs/ChargebackApi.md +297 -405
- data/docs/CheckoutApi.md +1622 -1424
- data/docs/Conversation.md +4 -0
- data/docs/ConversationApi.md +4820 -6315
- data/docs/CouponApi.md +1522 -1443
- data/docs/CustomerApi.md +2570 -1845
- data/docs/DatawarehouseApi.md +555 -723
- data/docs/FulfillmentApi.md +567 -441
- data/docs/GiftCertificateApi.md +617 -598
- data/docs/IntegrationLogApi.md +290 -385
- data/docs/ItemApi.md +2174 -1746
- data/docs/ItemRestriction.md +2 -0
- data/docs/OauthApi.md +203 -163
- data/docs/OrderApi.md +2774 -2177
- data/docs/SsoApi.md +223 -288
- data/docs/StorefrontApi.md +9692 -12967
- data/docs/TaxApi.md +1541 -2017
- data/docs/UserApi.md +606 -790
- data/docs/WebhookApi.md +787 -628
- data/docs/WorkflowApi.md +666 -879
- data/lib/ultracart_api/models/conversation.rb +21 -1
- data/lib/ultracart_api/models/item_restriction.rb +11 -1
- data/lib/ultracart_api/version.rb +1 -1
- metadata +2 -2
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'ultracart_api'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
#
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
webhook_oid
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
p
|
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
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
require
|
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
|
-
p
|
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
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
require '
|
246
|
-
require_relative '../constants'
|
247
|
-
|
248
|
-
# This example
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
webhook_oid =
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
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
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
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
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
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
|
-
|
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
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
#
|
572
|
-
|
573
|
-
|
574
|
-
|
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
|
-
|
624
|
-
###
|
625
|
-
|
626
|
-
|
627
|
-
|
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
|
+
|