Class: AccessGrid::Webhooks
- Inherits:
-
Object
- Object
- AccessGrid::Webhooks
- Defined in:
- lib/accessgrid/console.rb
Overview
Manages webhook operations.
Instance Method Summary collapse
- #create(name:, url:, subscribed_events:, auth_method: 'bearer_token') ⇒ Object
- #delete(webhook_id) ⇒ Object
-
#initialize(client) ⇒ Webhooks
constructor
A new instance of Webhooks.
- #list(**params) ⇒ Object
- #verify(webhook_id) ⇒ Object
Constructor Details
#initialize(client) ⇒ Webhooks
Returns a new instance of Webhooks.
337 338 339 |
# File 'lib/accessgrid/console.rb', line 337 def initialize(client) @client = client end |
Instance Method Details
#create(name:, url:, subscribed_events:, auth_method: 'bearer_token') ⇒ Object
341 342 343 344 345 346 347 348 349 350 |
# File 'lib/accessgrid/console.rb', line 341 def create(name:, url:, subscribed_events:, auth_method: 'bearer_token') data = { name: name, url: url, subscribed_events: subscribed_events, auth_method: auth_method } response = @client.make_request(:post, '/v1/console/webhooks', data) Webhook.new(response) end |
#delete(webhook_id) ⇒ Object
357 358 359 |
# File 'lib/accessgrid/console.rb', line 357 def delete(webhook_id) @client.make_request(:delete, "/v1/console/webhooks/#{webhook_id}") end |
#list(**params) ⇒ Object
352 353 354 355 |
# File 'lib/accessgrid/console.rb', line 352 def list(**params) response = @client.make_request(:get, '/v1/console/webhooks', nil, params) (response['webhooks'] || []).map { |wh| Webhook.new(wh) } end |
#verify(webhook_id) ⇒ Object
361 362 363 364 |
# File 'lib/accessgrid/console.rb', line 361 def verify(webhook_id) response = @client.make_request(:post, "/v1/console/webhooks/#{webhook_id}/verify") WebhookVerification.new(response) end |