Class: Calendlyr::WebhooksResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/calendlyr/resources/webhooks.rb

Constant Summary

Constants inherited from Resource

Resource::ERROR_CODES

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Calendlyr::Resource

Instance Method Details

#create(url:, events:, organization:, scope:, **params) ⇒ Object



8
9
10
11
# File 'lib/calendlyr/resources/webhooks.rb', line 8

def create(url:, events:, organization:, scope:, **params)
  body = params.merge(url: url, events: events, organization: organization, scope: scope)
  Webhooks::Subscription.new post_request("webhook_subscriptions", body: body).dig("resource").merge(client: client)
end

#delete(webhook_uuid:) ⇒ Object



17
18
19
# File 'lib/calendlyr/resources/webhooks.rb', line 17

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

#list(organization:, scope:, **params) ⇒ Object



3
4
5
6
# File 'lib/calendlyr/resources/webhooks.rb', line 3

def list(organization:, scope:, **params)
  response = get_request("webhook_subscriptions", params: params.merge(organization: organization, scope: scope).compact)
  Collection.from_response(response, type: Webhooks::Subscription, client: client)
end

#retrieve(webhook_uuid:) ⇒ Object



13
14
15
# File 'lib/calendlyr/resources/webhooks.rb', line 13

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

#sample_webhook_data(event:, organization:, scope:, **params) ⇒ Object



21
22
23
# File 'lib/calendlyr/resources/webhooks.rb', line 21

def sample_webhook_data(event:, organization:, scope:, **params)
  Object.new get_request("sample_webhook_data", params: params.merge(event: event, organization: organization, scope: scope)).merge(client: client)
end