Class: UpBankingClient::WebhooksApi
- Inherits:
-
Object
- Object
- UpBankingClient::WebhooksApi
- Defined in:
- lib/up_banking/api/webhooks_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ WebhooksApi
constructor
A new instance of WebhooksApi.
-
#webhooks_get(opts = {}) ⇒ ListWebhooksResponse
List webhooks Retrieve a list of configured webhooks.
-
#webhooks_get_with_http_info(opts = {}) ⇒ Array<(ListWebhooksResponse, Integer, Hash)>
List webhooks Retrieve a list of configured webhooks.
-
#webhooks_id_delete(id, opts = {}) ⇒ nil
Delete webhook Delete a specific webhook by providing its unique identifier.
-
#webhooks_id_delete_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete webhook Delete a specific webhook by providing its unique identifier.
-
#webhooks_id_get(id, opts = {}) ⇒ GetWebhookResponse
Retrieve webhook Retrieve a specific webhook by providing its unique identifier.
-
#webhooks_id_get_with_http_info(id, opts = {}) ⇒ Array<(GetWebhookResponse, Integer, Hash)>
Retrieve webhook Retrieve a specific webhook by providing its unique identifier.
-
#webhooks_post(opts = {}) ⇒ CreateWebhookResponse
Create webhook Create a new webhook with a given URL.
-
#webhooks_post_with_http_info(opts = {}) ⇒ Array<(CreateWebhookResponse, Integer, Hash)>
Create webhook Create a new webhook with a given URL.
-
#webhooks_webhook_id_logs_get(webhook_id, opts = {}) ⇒ ListWebhookDeliveryLogsResponse
List webhook logs Retrieve a list of delivery logs for a webhook by providing its unique identifier.
-
#webhooks_webhook_id_logs_get_with_http_info(webhook_id, opts = {}) ⇒ Array<(ListWebhookDeliveryLogsResponse, Integer, Hash)>
List webhook logs Retrieve a list of delivery logs for a webhook by providing its unique identifier.
-
#webhooks_webhook_id_ping_post(webhook_id, opts = {}) ⇒ WebhookEventCallback
Ping webhook Send a ‘PING` event to a webhook by providing its unique identifier.
-
#webhooks_webhook_id_ping_post_with_http_info(webhook_id, opts = {}) ⇒ Array<(WebhookEventCallback, Integer, Hash)>
Ping webhook Send a `PING` event to a webhook by providing its unique identifier.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ WebhooksApi
Returns a new instance of WebhooksApi.
19 20 21 |
# File 'lib/up_banking/api/webhooks_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/up_banking/api/webhooks_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#webhooks_get(opts = {}) ⇒ ListWebhooksResponse
List webhooks Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the ‘next` and `prev` links where present. Results are ordered oldest first to newest last.
27 28 29 30 |
# File 'lib/up_banking/api/webhooks_api.rb', line 27 def webhooks_get(opts = {}) data, _status_code, _headers = webhooks_get_with_http_info(opts) data end |
#webhooks_get_with_http_info(opts = {}) ⇒ Array<(ListWebhooksResponse, Integer, Hash)>
List webhooks Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. Results are ordered oldest first to newest last.
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 78 79 80 |
# File 'lib/up_banking/api/webhooks_api.rb', line 37 def webhooks_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_get ...' end # resource path local_var_path = '/webhooks' # query parameters query_params = opts[:query_params] || {} query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListWebhooksResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_get", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#webhooks_id_delete(id, opts = {}) ⇒ nil
Delete webhook Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL.
87 88 89 90 |
# File 'lib/up_banking/api/webhooks_api.rb', line 87 def webhooks_id_delete(id, opts = {}) webhooks_id_delete_with_http_info(id, opts) nil end |
#webhooks_id_delete_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete webhook Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL.
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 |
# File 'lib/up_banking/api/webhooks_api.rb', line 97 def webhooks_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_id_delete ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.webhooks_id_delete" end # resource path local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_id_delete", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#webhooks_id_get(id, opts = {}) ⇒ GetWebhookResponse
Retrieve webhook Retrieve a specific webhook by providing its unique identifier.
148 149 150 151 |
# File 'lib/up_banking/api/webhooks_api.rb', line 148 def webhooks_id_get(id, opts = {}) data, _status_code, _headers = webhooks_id_get_with_http_info(id, opts) data end |
#webhooks_id_get_with_http_info(id, opts = {}) ⇒ Array<(GetWebhookResponse, Integer, Hash)>
Retrieve webhook Retrieve a specific webhook by providing its unique identifier.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/up_banking/api/webhooks_api.rb', line 158 def webhooks_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_id_get ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.webhooks_id_get" end # resource path local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetWebhookResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_id_get", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#webhooks_post(opts = {}) ⇒ CreateWebhookResponse
Create webhook Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded ‘POST` requests. The URL must respond with a HTTP `200` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a `200` status. The response includes a `secretKey` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the `secretKey` is lost, simply create a new webhook with the same URL, capture its `secretKey` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a `PING` event](#post_webhooks_webhookId_ping) after creating it.
211 212 213 214 |
# File 'lib/up_banking/api/webhooks_api.rb', line 211 def webhooks_post(opts = {}) data, _status_code, _headers = webhooks_post_with_http_info(opts) data end |
#webhooks_post_with_http_info(opts = {}) ⇒ Array<(CreateWebhookResponse, Integer, Hash)>
Create webhook Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded `POST` requests. The URL must respond with a HTTP `200` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a `200` status. The response includes a `secretKey` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the `secretKey` is lost, simply create a new webhook with the same URL, capture its `secretKey` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a `PING` event](#post_webhooks_webhookId_ping) after creating it.
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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/up_banking/api/webhooks_api.rb', line 221 def webhooks_post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_post ...' 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']) # 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(opts[:'create_webhook_request']) # return_type return_type = opts[:debug_return_type] || 'CreateWebhookResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#webhooks_webhook_id_logs_get(webhook_id, opts = {}) ⇒ ListWebhookDeliveryLogsResponse
List webhook logs Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the ‘next` and `prev` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time.
276 277 278 279 |
# File 'lib/up_banking/api/webhooks_api.rb', line 276 def webhooks_webhook_id_logs_get(webhook_id, opts = {}) data, _status_code, _headers = webhooks_webhook_id_logs_get_with_http_info(webhook_id, opts) data end |
#webhooks_webhook_id_logs_get_with_http_info(webhook_id, opts = {}) ⇒ Array<(ListWebhookDeliveryLogsResponse, Integer, Hash)>
List webhook logs Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time.
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 |
# File 'lib/up_banking/api/webhooks_api.rb', line 287 def webhooks_webhook_id_logs_get_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_webhook_id_logs_get ...' 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.webhooks_webhook_id_logs_get" end # resource path local_var_path = '/webhooks/{webhookId}/logs'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListWebhookDeliveryLogsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_webhook_id_logs_get", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_webhook_id_logs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#webhooks_webhook_id_ping_post(webhook_id, opts = {}) ⇒ WebhookEventCallback
Ping webhook Send a ‘PING` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request.
341 342 343 344 |
# File 'lib/up_banking/api/webhooks_api.rb', line 341 def webhooks_webhook_id_ping_post(webhook_id, opts = {}) data, _status_code, _headers = webhooks_webhook_id_ping_post_with_http_info(webhook_id, opts) data end |
#webhooks_webhook_id_ping_post_with_http_info(webhook_id, opts = {}) ⇒ Array<(WebhookEventCallback, Integer, Hash)>
Ping webhook Send a `PING` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request.
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 |
# File 'lib/up_banking/api/webhooks_api.rb', line 351 def webhooks_webhook_id_ping_post_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_webhook_id_ping_post ...' 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.webhooks_webhook_id_ping_post" end # resource path local_var_path = '/webhooks/{webhookId}/ping'.sub('{' + 'webhookId' + '}', 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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'WebhookEventCallback' # auth_names auth_names = opts[:debug_auth_names] || ['bearer_auth'] = opts.merge( :operation => :"WebhooksApi.webhooks_webhook_id_ping_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_webhook_id_ping_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |