Class: Seam::Clients::Webhooks
- Inherits:
-
Object
- Object
- Seam::Clients::Webhooks
- Defined in:
- lib/seam/routes/clients/webhooks.rb
Instance Method Summary collapse
- #create(url:, event_types: nil) ⇒ Object
- #delete(webhook_id:) ⇒ Object
- #get(webhook_id:) ⇒ Object
-
#initialize(client:, defaults:) ⇒ Webhooks
constructor
A new instance of Webhooks.
- #list ⇒ Object
- #update(event_types:, webhook_id:) ⇒ Object
Constructor Details
#initialize(client:, defaults:) ⇒ Webhooks
6 7 8 9 |
# File 'lib/seam/routes/clients/webhooks.rb', line 6 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#create(url:, event_types: nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/seam/routes/clients/webhooks.rb', line 11 def create(url:, event_types: nil) res = @client.post("/webhooks/create", {url: url, event_types: event_types}.compact) Seam::Resources::Webhook.load_from_response(res.body["webhook"]) end |
#delete(webhook_id:) ⇒ Object
17 18 19 20 21 |
# File 'lib/seam/routes/clients/webhooks.rb', line 17 def delete(webhook_id:) @client.post("/webhooks/delete", {webhook_id: webhook_id}.compact) nil end |
#get(webhook_id:) ⇒ Object
23 24 25 26 27 |
# File 'lib/seam/routes/clients/webhooks.rb', line 23 def get(webhook_id:) res = @client.post("/webhooks/get", {webhook_id: webhook_id}.compact) Seam::Resources::Webhook.load_from_response(res.body["webhook"]) end |
#list ⇒ Object
29 30 31 32 33 |
# File 'lib/seam/routes/clients/webhooks.rb', line 29 def list res = @client.post("/webhooks/list") Seam::Resources::Webhook.load_from_response(res.body["webhooks"]) end |
#update(event_types:, webhook_id:) ⇒ Object
35 36 37 38 39 |
# File 'lib/seam/routes/clients/webhooks.rb', line 35 def update(event_types:, webhook_id:) @client.post("/webhooks/update", {event_types: event_types, webhook_id: webhook_id}.compact) nil end |