Class: WebhooksClient
- Inherits:
-
Object
- Object
- WebhooksClient
- Defined in:
- lib/lockstep_sdk/clients/webhooks_client.rb
Instance Method Summary collapse
-
#create_webhooks(body:) ⇒ Object
Creates one or more webhooks from a given model.
-
#delete_webhook(id:) ⇒ Object
Deletes the Webhook referred to by this unique identifier.
-
#initialize(lockstepsdk) ⇒ WebhooksClient
constructor
Initialize the WebhooksClient class with a lockstepsdk instance.
- #query_webhook_history(webhook_id:, filter:, select:, page_size:, page_number:) ⇒ Object
-
#query_webhooks(filter:, order:, page_size:, page_number:) ⇒ Object
Queries Webhooks for this account using the specified filtering, sorting, and pagination rules requested.
-
#regenerate_client_secret(id:) ⇒ Object
Updates a webhook that matches the specified id with a new client secret.
-
#retrieve_webhook(id:) ⇒ Object
Retrieves the Webhook specified by this unique identifier.
-
#update_webhook(id:, body:) ⇒ Object
Updates a webhook that matches the specified id with the requested information.
Constructor Details
#initialize(lockstepsdk) ⇒ WebhooksClient
Initialize the WebhooksClient class with a lockstepsdk instance.
24 25 26 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 24 def initialize(lockstepsdk) @lockstepsdk = lockstepsdk end |
Instance Method Details
#create_webhooks(body:) ⇒ Object
Creates one or more webhooks from a given model.
63 64 65 66 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 63 def create_webhooks(body:) path = "/api/v1/Webhooks" @lockstepsdk.request(:post, path, body, nil) end |
#delete_webhook(id:) ⇒ Object
Deletes the Webhook referred to by this unique identifier.
54 55 56 57 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 54 def delete_webhook(id:) path = "/api/v1/Webhooks/#{id}" @lockstepsdk.request(:delete, path, nil, nil) end |
#query_webhook_history(webhook_id:, filter:, select:, page_size:, page_number:) ⇒ Object
100 101 102 103 104 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 100 def query_webhook_history(webhook_id:, filter:, select:, page_size:, page_number:) path = "/api/v1/Webhooks/#{webhookId}/history/query" params = {:filter => filter, :select => select, :pageSize => page_size, :pageNumber => page_number} @lockstepsdk.request(:get, path, nil, params) end |
#query_webhooks(filter:, order:, page_size:, page_number:) ⇒ Object
Queries Webhooks for this account using the specified filtering, sorting, and pagination rules requested.
More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.
86 87 88 89 90 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 86 def query_webhooks(filter:, order:, page_size:, page_number:) path = "/api/v1/Webhooks/query" params = {:filter => filter, :order => order, :pageSize => page_size, :pageNumber => page_number} @lockstepsdk.request(:get, path, nil, params) end |
#regenerate_client_secret(id:) ⇒ Object
Updates a webhook that matches the specified id with a new client secret.
72 73 74 75 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 72 def regenerate_client_secret(id:) path = "/api/v1/Webhooks/#{id}/regenerateclientsecret" @lockstepsdk.request(:patch, path, nil, nil) end |
#retrieve_webhook(id:) ⇒ Object
Retrieves the Webhook specified by this unique identifier.
33 34 35 36 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 33 def retrieve_webhook(id:) path = "/api/v1/Webhooks/#{id}" @lockstepsdk.request(:get, path, nil, nil) end |
#update_webhook(id:, body:) ⇒ Object
Updates a webhook that matches the specified id with the requested information.
The PATCH method allows you to change specific values on the object while leaving other values alone. As input you should supply a list of field names and new values. If you do not provide the name of a field, that field will remain unchanged. This allows you to ensure that you are only updating the specific fields desired.
45 46 47 48 |
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 45 def update_webhook(id:, body:) path = "/api/v1/Webhooks/#{id}" @lockstepsdk.request(:patch, path, body.to_camelback_keys.to_json, nil) end |