Class: CDEKApiClient::API::Webhook
- Inherits:
-
Object
- Object
- CDEKApiClient::API::Webhook
- Defined in:
- lib/cdek_api_client/api/webhook.rb
Overview
Handles webhook-related API requests.
Instance Method Summary collapse
-
#delete(webhook_id) ⇒ Hash
Deletes a webhook by its ID.
-
#initialize(client) ⇒ Webhook
constructor
Initializes the Webhook object.
-
#list ⇒ Array<Hash>
Retrieves a list of registered webhooks.
-
#register(webhook_data) ⇒ Hash
Registers a new webhook.
Constructor Details
#initialize(client) ⇒ Webhook
Initializes the Webhook object.
10 11 12 |
# File 'lib/cdek_api_client/api/webhook.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#delete(webhook_id) ⇒ Hash
Deletes a webhook by its ID.
35 36 37 38 |
# File 'lib/cdek_api_client/api/webhook.rb', line 35 def delete(webhook_id) response = @client.request('delete', "webhooks/#{webhook_id}") @client.send(:handle_response, response) end |
#list ⇒ Array<Hash>
Retrieves a list of registered webhooks.
26 27 28 29 |
# File 'lib/cdek_api_client/api/webhook.rb', line 26 def list response = @client.request('get', 'webhooks') @client.send(:handle_response, response) end |
#register(webhook_data) ⇒ Hash
Registers a new webhook.
18 19 20 21 |
# File 'lib/cdek_api_client/api/webhook.rb', line 18 def register(webhook_data) response = @client.request('post', 'webhooks', body: webhook_data) @client.send(:handle_response, response) end |