Class: Calendly::WebhookSubscription

Inherits:
Object
  • Object
show all
Includes:
ModelUtils
Defined in:
lib/calendly/models/webhook_subscription.rb

Overview

Calendly’s webhook model.

Constant Summary collapse

UUID_RE =
%r{\A#{Client::API_HOST}/webhook_subscriptions/(#{UUID_FORMAT})\z}.freeze
TIME_FIELDS =
i[created_at updated_at retry_started_at].freeze
ASSOCIATION =
{organization: Organization, user: User, creator: User}.freeze

Constants included from ModelUtils

ModelUtils::UUID_FORMAT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ModelUtils

#client, #id, included, #initialize, #inspect

Instance Attribute Details

#callback_urlString

The callback URL to use when the event is triggered.

Returns:

  • (String)


26
27
28
# File 'lib/calendly/models/webhook_subscription.rb', line 26

def callback_url
  @callback_url
end

#created_atTime

The moment when the webhook subscription was created.

Returns:

  • (Time)


30
31
32
# File 'lib/calendly/models/webhook_subscription.rb', line 30

def created_at
  @created_at
end

#creatorCalendly::User

The user who created the webhook subscription.

Returns:



62
63
64
# File 'lib/calendly/models/webhook_subscription.rb', line 62

def creator
  @creator
end

#eventsArray<String>

A list of events to which the webhook is subscribed.

Returns:

  • (Array<String>)


46
47
48
# File 'lib/calendly/models/webhook_subscription.rb', line 46

def events
  @events
end

#organizationCalendly::Organization

The organization that’s associated with the webhook subscription.



54
55
56
# File 'lib/calendly/models/webhook_subscription.rb', line 54

def organization
  @organization
end

#retry_started_atTime

The date and time the webhook subscription is retried.

Returns:

  • (Time)


38
39
40
# File 'lib/calendly/models/webhook_subscription.rb', line 38

def retry_started_at
  @retry_started_at
end

#scopeString

The scope of the webhook subscription.

Returns:

  • (String)


50
51
52
# File 'lib/calendly/models/webhook_subscription.rb', line 50

def scope
  @scope
end

#stateString

Indicates if the webhook subscription is “active” or “disabled”.

Returns:

  • (String)


42
43
44
# File 'lib/calendly/models/webhook_subscription.rb', line 42

def state
  @state
end

#updated_atTime

The moment when the webhook subscription was last updated.

Returns:

  • (Time)


34
35
36
# File 'lib/calendly/models/webhook_subscription.rb', line 34

def updated_at
  @updated_at
end

#uriString

Canonical reference (unique identifier) for the webhook.

Returns:

  • (String)


22
23
24
# File 'lib/calendly/models/webhook_subscription.rb', line 22

def uri
  @uri
end

#userCalendly::User

The user that’s associated with the webhook subscription.

Returns:



58
59
60
# File 'lib/calendly/models/webhook_subscription.rb', line 58

def user
  @user
end

#uuidString

unique id of the WebhookSubscription object.

Returns:

  • (String)


18
19
20
# File 'lib/calendly/models/webhook_subscription.rb', line 18

def uuid
  @uuid
end

Instance Method Details

#deletetrue

Delete a webhook subscription associated with self.

Returns:

  • (true)

Raises:

Since:

  • 0.1.0



82
83
84
# File 'lib/calendly/models/webhook_subscription.rb', line 82

def delete
  client.delete_webhook uuid
end

#fetchCalendly::WebhookSubscription

Get a webhook subscription associated with self.

Returns:

Raises:

Since:

  • 0.1.3



71
72
73
# File 'lib/calendly/models/webhook_subscription.rb', line 71

def fetch
  client.webhook uuid
end