Class: SupportOps::Calendly::Webhooks
- Defined in:
- lib/support_ops_calendly/calendly/webhooks.rb
Overview
Get sample webhook data => developer.calendly.com/api-docs/1da466e7fbc1b-get-sample-webhook-data
Defines the module Webhooks within the module SupportOps::Calendly.
Instance Attribute Summary collapse
-
#callback_url ⇒ String
The callback URL to use when the event is triggered.
-
#created_at ⇒ String
The moment when the webhook subscription was created (e.g. “2020-01-02T03:04:05.678123Z”).
-
#creator ⇒ String
The URI of the user who created the webhook subscription.
-
#events ⇒ Array
A list of events to which the webhook is subscribed.
-
#group ⇒ String
The URI of the group that’s associated with the webhook subscription.
-
#organization ⇒ String
The URI of the organization that’s associated with the webhook subscription.
-
#retry_started_at ⇒ String
The date and time the webhook subscription is retried.
-
#scope ⇒ String
The scope of the webhook subscription.
-
#signing_key ⇒ String
Optional secret key shared between your application and Calendly (creates only).
-
#state ⇒ String
Indicates if the webhook subscription is “active” or “disabled”.
-
#updated_at ⇒ String
The moment when the webhook subscription was last updated (e.g. “2020-01-02T03:04:05.678123Z”).
-
#uri ⇒ String
Canonical reference (unique identifier) for the webhook.
-
#url ⇒ String
The URL where you want to receive POST requests for events you are subscribed to (creates only).
-
#user ⇒ String
The URI of the user that’s associated with the webhook subscription.
Class Method Summary collapse
-
.get(object) ⇒ Object
Get a specified Webhook Subscription.
-
.get!(object) ⇒ Object
Get a specified Webhook Subscription.
-
.list(key: value) ⇒ Object
Get a list of Webhook Subscriptions for a specified Organization or User.
Instance Method Summary collapse
-
#delete! ⇒ Object
Delete a Webhook Subscription.
-
#save! ⇒ Object
Create a Webhook Subscription for an Organization or User.
-
#uuid ⇒ String
Returns the UUID of a webhook.
Methods inherited from Base
attributes, client, #client=, configure, define_attributes, #find, #find!, #initialize, #members, readonly_attributes, #store_original_attributes
Constructor Details
This class inherits a constructor from SupportOps::Calendly::Base
Instance Attribute Details
#callback_url ⇒ String
The callback URL to use when the event is triggered
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def callback_url @callback_url end |
#created_at ⇒ String
The moment when the webhook subscription was created (e.g. “2020-01-02T03:04:05.678123Z”)
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def created_at @created_at end |
#creator ⇒ String
The URI of the user who created the webhook subscription
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def creator @creator end |
#events ⇒ Array
A list of events to which the webhook is subscribed
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def events @events end |
#group ⇒ String
The URI of the group that’s associated with the webhook subscription
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def group @group end |
#organization ⇒ String
The URI of the organization that’s associated with the webhook subscription
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def organization @organization end |
#retry_started_at ⇒ String
The date and time the webhook subscription is retried
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def retry_started_at @retry_started_at end |
#scope ⇒ String
The scope of the webhook subscription
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def scope @scope end |
#signing_key ⇒ String
Optional secret key shared between your application and Calendly (creates only)
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def signing_key @signing_key end |
#state ⇒ String
Indicates if the webhook subscription is “active” or “disabled”
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def state @state end |
#updated_at ⇒ String
The moment when the webhook subscription was last updated (e.g. “2020-01-02T03:04:05.678123Z”)
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def updated_at @updated_at end |
#uri ⇒ String
Canonical reference (unique identifier) for the webhook
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def uri @uri end |
#url ⇒ String
The URL where you want to receive POST requests for events you are subscribed to (creates only)
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def url @url end |
#user ⇒ String
The URI of the user that’s associated with the webhook subscription
27 28 29 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 27 def user @user end |
Class Method Details
.get(object) ⇒ Object
Get a specified Webhook Subscription
184 185 186 187 188 189 190 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 184 def self.get(object) if object.is_a? Webhooks Webhooks.new(uri: uri).find else Webhooks.new(uri: object).find end end |
.get!(object) ⇒ Object
Get a specified Webhook Subscription
210 211 212 213 214 215 216 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 210 def self.get!(object) if object.is_a? Webhooks Webhooks.new(uri: uri).find! else Webhooks.new(uri: object).find! end end |
.list(key: value) ⇒ Object
Get a list of Webhook Subscriptions for a specified Organization or User
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 136 def self.list(**args) args[:organization] = nil unless args[:organization] args[:scope] = nil unless args[:scope] raise 'You must provide an organization URI' if args[:organization].nil? raise 'You must provide a scope' if args[:scope].nil? raise 'You must provide a valid scope (group, organization, user)' unless %w[organization user group].include? args[:scope] args[:group] = nil unless args[:group] args[:sort] = nil unless args[:sort] args[:user] = nil unless args[:user] raise 'You must provide a user URI when using the scope of user' if args[:scope] == 'user' && args[:user].nil? raise 'You must provide a group URI when using the scope of group' if args[:scope] == 'group' && args[:group].nil? array = [] data = { count: 100 } data['group'] = args[:group] unless args[:group].nil? data['organization'] = args[:organization] unless args[:organization].nil? data['scope'] = args[:scope] unless args[:scope].nil? data['sort'] = args[:sort] unless args[:sort].nil? data['user'] = args[:user] unless args[:user].nil? loop do response = client.connection.get('webhook_subscriptions', data) body = Oj.load(response.body) array += body['collection'].map { |w| Webhooks.new(w) } break if body['pagination']['next_page_token'].nil? data['page_token'] = body['pagination']['next_page_token'] end array end |
Instance Method Details
#delete! ⇒ Object
This is inherited from Base#delete!
Delete a Webhook Subscription
18 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 18 def delete!; end |
#save! ⇒ Object
This is inherited from Base#save!
Create a Webhook Subscription for an Organization or User
25 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 25 def save!; end |
#uuid ⇒ String
This is inherited from Base#uuid
Returns the UUID of a webhook
20 |
# File 'lib/support_ops_calendly/calendly/webhooks.rb', line 20 def uuid; end |