Class: Basecamp::Services::WebhooksService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::WebhooksService
- Defined in:
- lib/basecamp/generated/services/webhooks_service.rb
Overview
Service for Webhooks operations
Instance Method Summary collapse
-
#create(bucket_id:, payload_url:, types:, active: nil) ⇒ Hash
Create a new webhook for a project.
-
#delete(webhook_id:) ⇒ void
Delete a webhook.
-
#get(webhook_id:) ⇒ Hash
Get a single webhook by id.
-
#list(bucket_id:) ⇒ Enumerator<Hash>
List all webhooks for a project.
-
#update(webhook_id:, payload_url: nil, types: nil, active: nil) ⇒ Hash
Update an existing webhook.
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create(bucket_id:, payload_url:, types:, active: nil) ⇒ Hash
Create a new webhook for a project
25 26 27 28 29 |
# File 'lib/basecamp/generated/services/webhooks_service.rb', line 25 def create(bucket_id:, payload_url:, types:, active: nil) with_operation(service: "webhooks", operation: "create", is_mutation: true, project_id: bucket_id) do http_post("/buckets/#{bucket_id}/webhooks.json", body: compact_params(payload_url: payload_url, types: types, active: active)).json end end |
#delete(webhook_id:) ⇒ void
This method returns an undefined value.
Delete a webhook
55 56 57 58 59 60 |
# File 'lib/basecamp/generated/services/webhooks_service.rb', line 55 def delete(webhook_id:) with_operation(service: "webhooks", operation: "delete", is_mutation: true, resource_id: webhook_id) do http_delete("/webhooks/#{webhook_id}") nil end end |
#get(webhook_id:) ⇒ Hash
Get a single webhook by id
34 35 36 37 38 |
# File 'lib/basecamp/generated/services/webhooks_service.rb', line 34 def get(webhook_id:) with_operation(service: "webhooks", operation: "get", is_mutation: false, resource_id: webhook_id) do http_get("/webhooks/#{webhook_id}").json end end |
#list(bucket_id:) ⇒ Enumerator<Hash>
List all webhooks for a project
13 14 15 16 17 |
# File 'lib/basecamp/generated/services/webhooks_service.rb', line 13 def list(bucket_id:) wrap_paginated(service: "webhooks", operation: "list", is_mutation: false, project_id: bucket_id) do paginate("/buckets/#{bucket_id}/webhooks.json") end end |
#update(webhook_id:, payload_url: nil, types: nil, active: nil) ⇒ Hash
Update an existing webhook
46 47 48 49 50 |
# File 'lib/basecamp/generated/services/webhooks_service.rb', line 46 def update(webhook_id:, payload_url: nil, types: nil, active: nil) with_operation(service: "webhooks", operation: "update", is_mutation: true, resource_id: webhook_id) do http_put("/webhooks/#{webhook_id}", body: compact_params(payload_url: payload_url, types: types, active: active)).json end end |