Class: Verity::Resources::Webhooks
- Inherits:
-
Object
- Object
- Verity::Resources::Webhooks
- Defined in:
- lib/verity/resources/webhooks.rb
Instance Method Summary collapse
- #create(url:, events:) ⇒ Object
- #delete(webhook_id) ⇒ Object
-
#initialize(client) ⇒ Webhooks
constructor
A new instance of Webhooks.
- #list ⇒ Object
- #test(webhook_id) ⇒ Object
- #update(webhook_id, url: nil, events: nil, status: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Webhooks
Returns a new instance of Webhooks.
6 7 8 |
# File 'lib/verity/resources/webhooks.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create(url:, events:) ⇒ Object
14 15 16 |
# File 'lib/verity/resources/webhooks.rb', line 14 def create(url:, events:) @client.request(:post, '/webhooks', body: { url: url, events: events }) end |
#delete(webhook_id) ⇒ Object
26 27 28 |
# File 'lib/verity/resources/webhooks.rb', line 26 def delete(webhook_id) @client.request(:delete, "/webhooks/#{webhook_id}") end |
#list ⇒ Object
10 11 12 |
# File 'lib/verity/resources/webhooks.rb', line 10 def list @client.request(:get, '/webhooks') end |
#test(webhook_id) ⇒ Object
30 31 32 |
# File 'lib/verity/resources/webhooks.rb', line 30 def test(webhook_id) @client.request(:post, "/webhooks/#{webhook_id}/test") end |
#update(webhook_id, url: nil, events: nil, status: nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/verity/resources/webhooks.rb', line 18 def update(webhook_id, url: nil, events: nil, status: nil) body = {} body[:url] = url if url body[:events] = events if events body[:status] = status if status @client.request(:patch, "/webhooks/#{webhook_id}", body: body) end |