Class: EasyLabs::Resources::WebhooksManagement

Inherits:
Base
  • Object
show all
Defined in:
lib/easylabs/resources/webhooks_management.rb

Overview

/webhooks management API (separate from the inbound-delivery verifier in EasyLabs::Webhooks).

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from EasyLabs::Resources::Base

Instance Method Details

#delete(id) ⇒ Object



24
25
26
# File 'lib/easylabs/resources/webhooks_management.rb', line 24

def delete(id)
  request(:delete, "/webhooks/#{id}")
end

#listObject



16
17
18
# File 'lib/easylabs/resources/webhooks_management.rb', line 16

def list
  request(:get, "/webhooks")
end

#list_deliveries(**query) ⇒ Object

GET /webhooks/deliveries — across the company’s endpoints.



29
30
31
# File 'lib/easylabs/resources/webhooks_management.rb', line 29

def list_deliveries(**query)
  request(:get, "/webhooks/deliveries", query: query.compact)
end

#list_endpoint_deliveries(endpoint_id, **query) ⇒ Object

GET /webhooks/:id/deliveries — single endpoint.



34
35
36
# File 'lib/easylabs/resources/webhooks_management.rb', line 34

def list_endpoint_deliveries(endpoint_id, **query)
  request(:get, "/webhooks/#{endpoint_id}/deliveries", query: query.compact)
end

#register(url:, events: ["*"]) ⇒ Object

POST /webhooks { url, events? }. Returns the registered endpoint including the ‘secret` (returned only on creation — store it).



12
13
14
# File 'lib/easylabs/resources/webhooks_management.rb', line 12

def register(url:, events: ["*"])
  request(:post, "/webhooks", body: { url: url, events: events })
end

#update(id, **body) ⇒ Object



20
21
22
# File 'lib/easylabs/resources/webhooks_management.rb', line 20

def update(id, **body)
  request(:patch, "/webhooks/#{id}", body: body)
end