Class: Seam::Clients::Webhooks
- Inherits:
-
Object
- Object
- Seam::Clients::Webhooks
- Defined in:
- lib/seam/routes/webhooks.rb
Instance Method Summary collapse
-
#create(url:, event_types: nil) ⇒ Seam::Resources::Webhook
Creates a new webhook.
-
#delete(webhook_id:) ⇒ nil
Deletes a specified webhook.
-
#get(webhook_id:) ⇒ Seam::Resources::Webhook
Gets a specified webhook.
-
#initialize(client:, defaults:) ⇒ Webhooks
constructor
A new instance of Webhooks.
-
#list ⇒ Seam::Resources::Webhook
Returns a list of all webhooks.
-
#update(event_types:, webhook_id:) ⇒ nil
Updates a specified webhook.
Constructor Details
#initialize(client:, defaults:) ⇒ Webhooks
Returns a new instance of Webhooks.
6 7 8 9 |
# File 'lib/seam/routes/webhooks.rb', line 6 def initialize(client:, defaults:) @client = client @defaults = defaults end |
Instance Method Details
#create(url:, event_types: nil) ⇒ Seam::Resources::Webhook
Creates a new webhook.
15 16 17 18 19 |
# File 'lib/seam/routes/webhooks.rb', line 15 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:) ⇒ nil
Deletes a specified webhook.
24 25 26 27 28 |
# File 'lib/seam/routes/webhooks.rb', line 24 def delete(webhook_id:) @client.post("/webhooks/delete", {webhook_id: webhook_id}.compact) nil end |
#get(webhook_id:) ⇒ Seam::Resources::Webhook
Gets a specified webhook.
33 34 35 36 37 |
# File 'lib/seam/routes/webhooks.rb', line 33 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 ⇒ Seam::Resources::Webhook
Returns a list of all webhooks.
41 42 43 44 45 |
# File 'lib/seam/routes/webhooks.rb', line 41 def list res = @client.post("/webhooks/list") Seam::Resources::Webhook.load_from_response(res.body["webhooks"]) end |
#update(event_types:, webhook_id:) ⇒ nil
Updates a specified webhook.
51 52 53 54 55 |
# File 'lib/seam/routes/webhooks.rb', line 51 def update(event_types:, webhook_id:) @client.post("/webhooks/update", {event_types: event_types, webhook_id: webhook_id}.compact) nil end |