Sha256: 744af4d639e56701d7084250bbfafcde427d661546bba7516fc916765d136244

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

module Calendly
  class WebhookResource < Resource
    def list(organization_uri:, scope:, **params)
      response = get_request("webhook_subscriptions", params: {organization: organization_uri, scope: scope}.merge(params).compact)
      Collection.from_response(response, key: "collection", type: Webhook, client: client)
    end

    def create(url:, events:, organization_uri:, scope:, signing_key: nil, user_uri: nil)
      body = {url: url, events: events, organization: organization_uri, user: user_uri, scope: scope, signing_key: signing_key}.compact
      Webhook.new post_request("webhook_subscriptions", body: body).dig("resource").merge(client: client)
    end

    def retrieve(webhook_uuid:)
      Webhook.new get_request("webhook_subscriptions/#{webhook_uuid}").dig("resource").merge(client: client)
    end

    def delete(webhook_uuid:)
      delete_request("webhook_subscriptions/#{webhook_uuid}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calendlyr-0.3.3 lib/calendly/resources/webhooks.rb