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.



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.



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.



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:, include_param:, 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:, include_param:, filter:, select:, page_size:, page_number:)
    path = "/api/v1/Webhooks/#{webhookId}/history/query"
    params = {:include => include_param, :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.



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.



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

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

#retrieve_webhook(id:) ⇒ Object

Retrieves the Webhook specified by this unique identifier.



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



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

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.



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