Class: SyncteraRubySdk::WebhooksApi

Inherits:
Object
  • Object
show all
Defined in:
lib/synctera_ruby_sdk/api/webhooks_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WebhooksApi

Returns a new instance of WebhooksApi.



19
20
21
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_secret(opts = {}) ⇒ CreateSecret201Response

Create a secret Create a webhook secret. The secret will be used to verify all subsequent webhook request signature.

Parameters:

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

    the optional parameters

Returns:



26
27
28
29
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 26

def create_secret(opts = {})
  data, _status_code, _headers = create_secret_with_http_info(opts)
  data
end

#create_secret_with_http_info(opts = {}) ⇒ Array<(CreateSecret201Response, Integer, Hash)>

Create a secret Create a webhook secret. The secret will be used to verify all subsequent webhook request signature.

Parameters:

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

    the optional parameters

Returns:

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

    CreateSecret201Response data, response status code and response headers



35
36
37
38
39
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
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 35

def create_secret_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.create_secret ...'
  end
  # resource path
  local_var_path = '/webhook_secrets'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.create_secret",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#create_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_webhook(webhook, opts = {}) ⇒ Webhook

Create a webhook Create a webhook

Parameters:

  • webhook (Webhook)

    Webhook to create

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

    the optional parameters

Returns:



84
85
86
87
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 84

def create_webhook(webhook, opts = {})
  data, _status_code, _headers = create_webhook_with_http_info(webhook, opts)
  data
end

#create_webhook_with_http_info(webhook, opts = {}) ⇒ Array<(Webhook, Integer, Hash)>

Create a webhook Create a webhook

Parameters:

  • webhook (Webhook)

    Webhook to create

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

    the optional parameters

Returns:

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

    Webhook data, response status code and response headers



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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 94

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.create_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_webhook(webhook_id, opts = {}) ⇒ DeleteResponse

Delete a webhook Delete a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Returns:



152
153
154
155
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 152

def delete_webhook(webhook_id, opts = {})
  data, _status_code, _headers = delete_webhook_with_http_info(webhook_id, opts)
  data
end

#delete_webhook_with_http_info(webhook_id, opts = {}) ⇒ Array<(DeleteResponse, Integer, Hash)>

Delete a webhook Delete a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Returns:

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

    DeleteResponse data, response status code and response headers



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

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.delete_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_event(webhook_id, event_id, opts = {}) ⇒ Event

Get webhook event Get webhook event by ID

Parameters:

  • webhook_id (String)

    Webhook ID

  • event_id (String)

    Webhook event ID

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

    the optional parameters

Returns:



216
217
218
219
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 216

def get_event(webhook_id, event_id, opts = {})
  data, _status_code, _headers = get_event_with_http_info(webhook_id, event_id, opts)
  data
end

#get_event_with_http_info(webhook_id, event_id, opts = {}) ⇒ Array<(Event, Integer, Hash)>

Get webhook event Get webhook event by ID

Parameters:

  • webhook_id (String)

    Webhook ID

  • event_id (String)

    Webhook event ID

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

    the optional parameters

Returns:

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

    Event data, response status code and response headers



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 227

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.get_event",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#get_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_webhook(webhook_id, opts = {}) ⇒ Webhook

Get a webhook Get a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Returns:



284
285
286
287
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 284

def get_webhook(webhook_id, opts = {})
  data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts)
  data
end

#get_webhook_with_http_info(webhook_id, opts = {}) ⇒ Array<(Webhook, Integer, Hash)>

Get a webhook Get a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Returns:

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

    Webhook data, response status code and response headers



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
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 294

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.get_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_events(webhook_id, opts = {}) ⇒ EventList

List webhook events List webhook events. This response will not associate with the event response history.

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Start date of date range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.. start_date is alias of start_time and is deprecated. Please use start_time instead.

  • :end_date (Date)

    End date of date range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.. end_date is alias of end_time and is deprecated. Please use end_time instead.

  • :start_time (Time)

    Start time of date-time range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.

  • :end_time (Time)

    End time of date-time range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.

  • :limit (Integer) — default: default to 100
  • :page_token (String)

Returns:



353
354
355
356
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 353

def list_events(webhook_id, opts = {})
  data, _status_code, _headers = list_events_with_http_info(webhook_id, opts)
  data
end

#list_events_with_http_info(webhook_id, opts = {}) ⇒ Array<(EventList, Integer, Hash)>

List webhook events List webhook events. This response will not associate with the event response history.

Parameters:

  • webhook_id (String)

    Webhook ID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Start date of date range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.. start_date is alias of start_time and is deprecated. Please use start_time instead.

  • :end_date (Date)

    End date of date range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.. end_date is alias of end_time and is deprecated. Please use end_time instead.

  • :start_time (Time)

    Start time of date-time range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.

  • :end_time (Time)

    End time of date-time range filtering for events. Date is inclusive and should be in UTC timezone 00:00:00.

  • :limit (Integer) — default: default to 100
  • :page_token (String)

Returns:

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

    EventList data, response status code and response headers



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
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 369

def list_events_with_http_info(webhook_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.list_events ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.list_events"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_events, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/webhooks/{webhook_id}/events'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.list_events",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#list_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_webhooks(opts = {}) ⇒ WebhookList

List webhooks List all webhooks

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :is_enabled_only (Boolean)

Returns:



434
435
436
437
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 434

def list_webhooks(opts = {})
  data, _status_code, _headers = list_webhooks_with_http_info(opts)
  data
end

#list_webhooks_with_http_info(opts = {}) ⇒ Array<(WebhookList, Integer, Hash)>

List webhooks List all webhooks

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :is_enabled_only (Boolean)

Returns:

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

    WebhookList data, response status code and response headers



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
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 446

def list_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhooks, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/webhooks'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil?
  query_params[:'is_enabled_only'] = opts[:'is_enabled_only'] if !opts[:'is_enabled_only'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.list_webhooks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_secret(replace_secret_request, opts = {}) ⇒ ReplaceSecret200Response

Replace an existing secret Replace an existing webhook secret immediately or as part of rotation. This new secret will be used to verify all subsequent webhook request signature.

Parameters:

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

    the optional parameters

Returns:



502
503
504
505
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 502

def replace_secret(replace_secret_request, opts = {})
  data, _status_code, _headers = replace_secret_with_http_info(replace_secret_request, opts)
  data
end

#replace_secret_with_http_info(replace_secret_request, opts = {}) ⇒ Array<(ReplaceSecret200Response, Integer, Hash)>

Replace an existing secret Replace an existing webhook secret immediately or as part of rotation. This new secret will be used to verify all subsequent webhook request signature.

Parameters:

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

    the optional parameters

Returns:

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

    ReplaceSecret200Response data, response status code and response headers



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
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 512

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(replace_secret_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.replace_secret",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#replace_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#resend_event(webhook_id, event_id, opts = {}) ⇒ Event

Resend an event Resend a webhook event

Parameters:

  • webhook_id (String)

    Webhook ID

  • event_id (String)

    Webhook event ID

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

    the optional parameters

Options Hash (opts):

  • :delay (Integer)

    Delay the event triggering in seconds. Events are checked once a minute, so a short delay may not result in an immedidate resend.

Returns:



572
573
574
575
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 572

def resend_event(webhook_id, event_id, opts = {})
  data, _status_code, _headers = resend_event_with_http_info(webhook_id, event_id, opts)
  data
end

#resend_event_with_http_info(webhook_id, event_id, opts = {}) ⇒ Array<(Event, Integer, Hash)>

Resend an event Resend a webhook event

Parameters:

  • webhook_id (String)

    Webhook ID

  • event_id (String)

    Webhook event ID

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

    the optional parameters

Options Hash (opts):

  • :delay (Integer)

    Delay the event triggering in seconds. Events are checked once a minute, so a short delay may not result in an immedidate resend.

Returns:

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

    Event data, response status code and response headers



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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 584

def resend_event_with_http_info(webhook_id, event_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.resend_event ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.resend_event"
  end
  # verify the required parameter 'event_id' is set
  if @api_client.config.client_side_validation && event_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_id' when calling WebhooksApi.resend_event"
  end
  if @api_client.config.client_side_validation && !opts[:'delay'].nil? && opts[:'delay'] > 3600
    fail ArgumentError, 'invalid value for "opts[:"delay"]" when calling WebhooksApi.resend_event, must be smaller than or equal to 3600.'
  end

  if @api_client.config.client_side_validation && !opts[:'delay'].nil? && opts[:'delay'] < 0
    fail ArgumentError, 'invalid value for "opts[:"delay"]" when calling WebhooksApi.resend_event, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/webhooks/{webhook_id}/events/{event_id}/resend'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)).sub('{' + 'event_id' + '}', CGI.escape(event_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.resend_event",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#resend_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#revoke_secret(opts = {}) ⇒ nil

Revoke the secret Revoke the existing webhook secret. If this is called at the rolling secret time, then both old and new secrets will be revoked

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :old_secret_only (Boolean)

Returns:

  • (nil)


650
651
652
653
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 650

def revoke_secret(opts = {})
  revoke_secret_with_http_info(opts)
  nil
end

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

Revoke the secret Revoke the existing webhook secret. If this is called at the rolling secret time, then both old and new secrets will be revoked

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :old_secret_only (Boolean)

Returns:

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

    nil, response status code and response headers



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 660

def revoke_secret_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.revoke_secret ...'
  end
  # resource path
  local_var_path = '/webhook_secrets'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/problem+json'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.revoke_secret",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#revoke_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#trigger_event(trigger_event_request, opts = {}) ⇒ EventTrigger

Trigger an event Trigger an specific event for webhook testing purpose

Parameters:

  • trigger_event_request (TriggerEventRequest)

    Provide an event type to trigger

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

    the optional parameters

Returns:



710
711
712
713
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 710

def trigger_event(trigger_event_request, opts = {})
  data, _status_code, _headers = trigger_event_with_http_info(trigger_event_request, opts)
  data
end

#trigger_event_with_http_info(trigger_event_request, opts = {}) ⇒ Array<(EventTrigger, Integer, Hash)>

Trigger an event Trigger an specific event for webhook testing purpose

Parameters:

  • trigger_event_request (TriggerEventRequest)

    Provide an event type to trigger

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

    the optional parameters

Returns:

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

    EventTrigger data, response status code and response headers



720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 720

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(trigger_event_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.trigger_event",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#trigger_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_webhook(webhook_id, webhook, opts = {}) ⇒ Webhook

Update a webhook Update a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

  • webhook (Webhook)

    Webhook to update

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

    the optional parameters

Returns:



779
780
781
782
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 779

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

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

Update a webhook Update a webhook

Parameters:

  • webhook_id (String)

    Webhook ID

  • webhook (Webhook)

    Webhook to update

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

    the optional parameters

Returns:

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

    Webhook data, response status code and response headers



790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
# File 'lib/synctera_ruby_sdk/api/webhooks_api.rb', line 790

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WebhooksApi.update_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end