Class: WebhooksClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/webhooks_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ WebhooksClient

Initialize the WebhooksClient class with an API client instance.

Parameters:

  • connection (LockstepApi)

    The API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 22

def initialize(connection)
    @connection = connection
end

Instance Method Details

#create_webhooks(body:) ⇒ Object

Creates one or more webhooks from a given model.

Parameters:

  • body (WebhookModel)

    The Webhooks to create



61
62
63
64
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 61

def create_webhooks(body:)
    path = "/api/v1/Webhooks"
    @connection.request(:post, path, body, nil)
end

#delete_webhook(id:) ⇒ Object

Deletes the Webhook referred to by this unique identifier.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the Webhook to delete.



52
53
54
55
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 52

def delete_webhook(id:)
    path = "/api/v1/Webhooks/#{id}"
    @connection.request(:delete, path, nil, nil)
end

#query_webhook_history(webhook_id:, filter:, select:, page_size:, page_number:) ⇒ Object

Parameters:



99
100
101
102
103
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 99

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}
    @connection.request(:get, path, nil, params)
end

#query_webhooks(filter:, include_param:, 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.

Parameters:



85
86
87
88
89
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 85

def query_webhooks(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Webhooks/query"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#regenerate_client_secret(id:) ⇒ Object

Updates a webhook that matches the specified id with a new client secret.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the Webhook to update.



70
71
72
73
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 70

def regenerate_client_secret(id:)
    path = "/api/v1/Webhooks/#{id}/regenerateclientsecret"
    @connection.request(:patch, path, nil, nil)
end

#retrieve_webhook(id:) ⇒ Object

Retrieves the Webhook specified by this unique identifier.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of this Webhook



31
32
33
34
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 31

def retrieve_webhook(id:)
    path = "/api/v1/Webhooks/#{id}"
    @connection.request(:get, path, nil, nil)
end

#retry_failed_webhook_history(webhook_id:, webhook_history_id:) ⇒ Object

Parameters:

  • webhook_id (uuid)

    The unique Lockstep Platform ID number of this Webhook

  • webhook_history_id (uuid)

    The unique Lockstep Platform ID number of the Webhook History to be retried. Note: the webhook history supplied must have a isSuccessful status of false to be retried.



110
111
112
113
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 110

def retry_failed_webhook_history(webhook_id:, webhook_history_id:)
    path = "/api/v1/Webhooks/#{webhookId}/history/#{webhookHistoryId}/retry"
    @connection.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.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the Webhook to update.

  • body (object)

    A list of changes to apply to this Webhook



43
44
45
46
# File 'lib/lockstep_sdk/clients/webhooks_client.rb', line 43

def update_webhook(id:, body:)
    path = "/api/v1/Webhooks/#{id}"
    @connection.request(:patch, path, body.to_camelback_keys.to_json, nil)
end