calendly 0.5.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +93 -0
- data/README.md +41 -30
- data/lib/calendly/api_error.rb +3 -0
- data/lib/calendly/client.rb +136 -75
- data/lib/calendly/configuration.rb +6 -1
- data/lib/calendly/models/event.rb +44 -31
- data/lib/calendly/models/event_type.rb +76 -21
- data/lib/calendly/models/event_type_custom_question.rb +48 -0
- data/lib/calendly/models/event_type_profile.rb +54 -0
- data/lib/calendly/models/guest.rb +21 -0
- data/lib/calendly/models/invitee.rb +41 -13
- data/lib/calendly/models/invitee_cancellation.rb +17 -0
- data/lib/calendly/models/invitee_payment.rb +28 -0
- data/lib/calendly/models/invitee_question_and_answer.rb +9 -1
- data/lib/calendly/models/invitee_tracking.rb +12 -1
- data/lib/calendly/models/invitees_counter.rb +19 -0
- data/lib/calendly/models/location.rb +10 -0
- data/lib/calendly/models/model_utils.rb +32 -6
- data/lib/calendly/models/organization.rb +75 -48
- data/lib/calendly/models/organization_invitation.rb +6 -0
- data/lib/calendly/models/organization_membership.rb +28 -18
- data/lib/calendly/models/team.rb +20 -0
- data/lib/calendly/models/user.rb +85 -25
- data/lib/calendly/models/webhook_subscription.rb +17 -0
- data/lib/calendly/version.rb +1 -1
- metadata +11 -4
@@ -3,60 +3,99 @@
|
|
3
3
|
require 'calendly/client'
|
4
4
|
require 'calendly/models/model_utils'
|
5
5
|
require 'calendly/models/event'
|
6
|
+
require 'calendly/models/invitee_cancellation'
|
7
|
+
require 'calendly/models/invitee_payment'
|
8
|
+
require 'calendly/models/invitee_question_and_answer'
|
9
|
+
require 'calendly/models/invitee_tracking'
|
6
10
|
|
7
11
|
module Calendly
|
8
|
-
# Calendly's
|
12
|
+
# Calendly's invitee model.
|
9
13
|
# An individual who has been invited to meet with a Calendly member.
|
10
14
|
class Invitee
|
11
15
|
include ModelUtils
|
12
16
|
UUID_RE = %r{\A#{Client::API_HOST}/scheduled_events/\w+/invitees/(\w+)\z}.freeze
|
13
17
|
TIME_FIELDS = %i[created_at updated_at].freeze
|
14
|
-
ASSOCIATION = {
|
18
|
+
ASSOCIATION = {
|
19
|
+
event: Event,
|
20
|
+
cancellation: InviteeCancellation,
|
21
|
+
payment: InviteePayment,
|
22
|
+
questions_and_answers: InviteeQuestionAndAnswer,
|
23
|
+
tracking: InviteeTracking
|
24
|
+
}.freeze
|
15
25
|
|
16
26
|
# @return [String]
|
17
27
|
# unique id of the Invitee object.
|
18
28
|
attr_accessor :uuid
|
29
|
+
|
19
30
|
# @return [String]
|
20
31
|
# Canonical resource reference.
|
21
32
|
attr_accessor :uri
|
33
|
+
|
22
34
|
# @return [String]
|
23
35
|
# The invitee's email address.
|
24
36
|
attr_accessor :email
|
37
|
+
|
25
38
|
# @return [String]
|
26
39
|
# The invitee's human-readable name.
|
27
40
|
attr_accessor :name
|
41
|
+
|
42
|
+
# @return [String]
|
43
|
+
# The first name of the invitee who booked the event when the event type is configured to use separate fields for
|
44
|
+
# first name and last name. Null when event type is configured to use a single field for name.
|
45
|
+
attr_accessor :first_name
|
46
|
+
|
47
|
+
# @return [String]
|
48
|
+
# The last name of the invitee who booked the event when the event type is configured to use separate fields
|
49
|
+
# for first name and last name. Null when event type is configured to use a single field for name.
|
50
|
+
attr_accessor :last_name
|
51
|
+
|
28
52
|
# @return [String]
|
29
53
|
# Whether the invitee has canceled or is still active.
|
30
54
|
attr_accessor :status
|
55
|
+
|
31
56
|
# @return [String]
|
32
57
|
# Timezone offest to use when presenting time information to invitee.
|
33
58
|
attr_accessor :timezone
|
59
|
+
|
34
60
|
# @return [String]
|
35
61
|
# Text (SMS) reminder phone number.
|
36
62
|
attr_accessor :text_reminder_number
|
63
|
+
|
37
64
|
# @return [Boolean]
|
38
65
|
# Indicates if this invitee has rescheduled.
|
39
66
|
# If true, a reference to the new Invitee instance is provided in the new_invitee field.
|
40
67
|
attr_accessor :rescheduled
|
68
|
+
|
41
69
|
# @return [String, nil]
|
42
70
|
# Reference to old Invitee instance that got rescheduled.
|
43
71
|
attr_accessor :old_invitee
|
72
|
+
|
44
73
|
# @return [String, nil]
|
45
74
|
# Link to new invitee, after reschedule.
|
46
75
|
attr_accessor :new_invitee
|
76
|
+
|
47
77
|
# @return [String]
|
48
78
|
# Link to cancelling the event for the invitee.
|
49
79
|
attr_accessor :cancel_url
|
80
|
+
|
50
81
|
# @return [String]
|
51
82
|
# Link to rescheduling the event for the invitee.
|
52
83
|
attr_accessor :reschedule_url
|
84
|
+
|
53
85
|
# @return [Time]
|
54
86
|
# Moment when user record was first created.
|
55
87
|
attr_accessor :created_at
|
88
|
+
|
56
89
|
# @return [Time]
|
57
90
|
# Moment when user record was last updated.
|
58
91
|
attr_accessor :updated_at
|
59
92
|
|
93
|
+
# @return [InviteeCancellation] Provides data pertaining to the cancellation of the Invitee.
|
94
|
+
attr_accessor :cancellation
|
95
|
+
|
96
|
+
# @return [InviteePayment] Invitee payment.
|
97
|
+
attr_accessor :payment
|
98
|
+
|
60
99
|
# @return [Event]
|
61
100
|
# Reference to Event associated with this invitee.
|
62
101
|
attr_accessor :event
|
@@ -80,16 +119,5 @@ module Calendly
|
|
80
119
|
ev_uuid = event.uuid if event
|
81
120
|
client.event_invitee ev_uuid, uuid
|
82
121
|
end
|
83
|
-
|
84
|
-
private
|
85
|
-
|
86
|
-
def after_set_attributes(attrs)
|
87
|
-
super attrs
|
88
|
-
answers = attrs[:questions_and_answers]
|
89
|
-
@questions_and_answers = answers.map { |ans| InviteeQuestionAndAnswer.new ans } if answers&.is_a? Array
|
90
|
-
|
91
|
-
trac_attrs = attrs[:tracking]
|
92
|
-
@tracking = InviteeTracking.new trac_attrs if trac_attrs&.is_a? Hash
|
93
|
-
end
|
94
122
|
end
|
95
123
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'calendly/models/model_utils'
|
4
|
+
|
5
|
+
module Calendly
|
6
|
+
# Calendly's invitee cancellation model.
|
7
|
+
# Provides data pertaining to the cancellation of the Invitee.
|
8
|
+
class InviteeCancellation
|
9
|
+
include ModelUtils
|
10
|
+
|
11
|
+
# @return [String] Name of the person whom canceled.
|
12
|
+
attr_accessor :canceled_by
|
13
|
+
|
14
|
+
# @return [String] Reason that the cancellation occurred.
|
15
|
+
attr_accessor :reason
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'calendly/models/model_utils'
|
4
|
+
|
5
|
+
module Calendly
|
6
|
+
# Calendly's invitee payment model.
|
7
|
+
class InviteePayment
|
8
|
+
include ModelUtils
|
9
|
+
|
10
|
+
# @return [String] Unique identifier for the payment.
|
11
|
+
attr_accessor :external_id
|
12
|
+
|
13
|
+
# @return [String] Payment provider.
|
14
|
+
attr_accessor :provider
|
15
|
+
|
16
|
+
# @return[Float] The amount of the payment.
|
17
|
+
attr_accessor :amount
|
18
|
+
|
19
|
+
# @return [String] The currency format that the payment is in.
|
20
|
+
attr_accessor :currency
|
21
|
+
|
22
|
+
# @return [String] Terms of the payment.
|
23
|
+
attr_accessor :terms
|
24
|
+
|
25
|
+
# @return [Boolean] Indicates whether the payment was successfully processed.
|
26
|
+
attr_accessor :successful
|
27
|
+
end
|
28
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'calendly/models/model_utils'
|
4
4
|
|
5
5
|
module Calendly
|
6
|
-
# Calendly's
|
6
|
+
# Calendly's question and answer model.
|
7
7
|
# An individual form question and response.
|
8
8
|
class InviteeQuestionAndAnswer
|
9
9
|
include ModelUtils
|
@@ -11,11 +11,19 @@ module Calendly
|
|
11
11
|
# @return [String]
|
12
12
|
# The question from the event booking confirmation form.
|
13
13
|
attr_accessor :question
|
14
|
+
|
14
15
|
# @return [String]
|
15
16
|
# The answer supplied by the invitee to this question.
|
16
17
|
attr_accessor :answer
|
18
|
+
|
17
19
|
# @return [Integer]
|
18
20
|
# The position of this question in the event booking confirmation form.
|
19
21
|
attr_accessor :position
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def inspect_attributes
|
26
|
+
super + %i[position question]
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'calendly/models/model_utils'
|
4
4
|
|
5
5
|
module Calendly
|
6
|
-
# Calendly's
|
6
|
+
# Calendly's invitee tracking model.
|
7
7
|
# Object that represents UTM and Salesforce tracking parameters associated with the invitee.
|
8
8
|
class InviteeTracking
|
9
9
|
include ModelUtils
|
@@ -11,20 +11,31 @@ module Calendly
|
|
11
11
|
# @return [String]
|
12
12
|
# UTM campaign tracking parameter.
|
13
13
|
attr_accessor :utm_campaign
|
14
|
+
|
14
15
|
# @return [String]
|
15
16
|
# UTM source tracking parameter.
|
16
17
|
attr_accessor :utm_source
|
18
|
+
|
17
19
|
# @return [String]
|
18
20
|
# UTM medium tracking parameter.
|
19
21
|
attr_accessor :utm_medium
|
22
|
+
|
20
23
|
# @return [String]
|
21
24
|
# UTM content tracking parameter.
|
22
25
|
attr_accessor :utm_content
|
26
|
+
|
23
27
|
# @return [String]
|
24
28
|
# UTM term tracking parameter.
|
25
29
|
attr_accessor :utm_term
|
30
|
+
|
26
31
|
# @return [String]
|
27
32
|
# Salesforce Record ID.
|
28
33
|
attr_accessor :salesforce_uuid
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def inspect_attributes
|
38
|
+
super + %i[utm_source utm_medium utm_campaign]
|
39
|
+
end
|
29
40
|
end
|
30
41
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'calendly/models/model_utils'
|
4
|
+
|
5
|
+
module Calendly
|
6
|
+
# Calendly's invitees counter model.
|
7
|
+
class InviteesCounter
|
8
|
+
include ModelUtils
|
9
|
+
|
10
|
+
# @return [Integer] number of total invitees in this event.
|
11
|
+
attr_accessor :total
|
12
|
+
|
13
|
+
# @return [Integer] number of active invitees in this event.
|
14
|
+
attr_accessor :active
|
15
|
+
|
16
|
+
# @return [Integer] max invitees in this event.
|
17
|
+
attr_accessor :limit
|
18
|
+
end
|
19
|
+
end
|
@@ -59,13 +59,23 @@ module Calendly
|
|
59
59
|
|
60
60
|
# @return [String]
|
61
61
|
attr_accessor :type
|
62
|
+
|
62
63
|
# @return [String]
|
63
64
|
attr_accessor :location
|
65
|
+
|
64
66
|
# @return [String]
|
65
67
|
attr_accessor :status
|
68
|
+
|
66
69
|
# @return [String]
|
67
70
|
attr_accessor :join_url
|
71
|
+
|
68
72
|
# @return [Hash]
|
69
73
|
attr_accessor :data
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def inspect_attributes
|
78
|
+
super + %i[location]
|
79
|
+
end
|
70
80
|
end
|
71
81
|
end
|
@@ -26,7 +26,7 @@ module Calendly
|
|
26
26
|
end
|
27
27
|
|
28
28
|
#
|
29
|
-
#
|
29
|
+
# Alias of uuid.
|
30
30
|
#
|
31
31
|
# @return [String]
|
32
32
|
# @raise [Calendly::Error] if uuid is not defined.
|
@@ -37,9 +37,20 @@ module Calendly
|
|
37
37
|
uuid
|
38
38
|
end
|
39
39
|
|
40
|
+
#
|
41
|
+
# Self object description human readable in CLI.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
# @since 0.0.1
|
40
45
|
def inspect
|
41
|
-
|
42
|
-
|
46
|
+
att_info = []
|
47
|
+
inspect_attributes.each do |att|
|
48
|
+
next unless respond_to? att
|
49
|
+
|
50
|
+
att_info << "#{att}=#{send(att).inspect}"
|
51
|
+
end
|
52
|
+
att_info << '..'
|
53
|
+
"\#<#{self.class}:#{object_id} #{att_info.join(', ')}>"
|
43
54
|
end
|
44
55
|
|
45
56
|
module ClassMethods
|
@@ -61,7 +72,7 @@ module Calendly
|
|
61
72
|
|
62
73
|
private
|
63
74
|
|
64
|
-
def set_attributes(attrs) # rubocop:disable
|
75
|
+
def set_attributes(attrs) # rubocop:disable Naming/AccessorMethodName, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
65
76
|
return if attrs.nil?
|
66
77
|
return unless attrs.is_a? Hash
|
67
78
|
return if attrs.empty?
|
@@ -70,8 +81,14 @@ module Calendly
|
|
70
81
|
next unless respond_to? "#{key}=".to_sym
|
71
82
|
|
72
83
|
if value && defined?(self.class::ASSOCIATION) && self.class::ASSOCIATION.key?(key)
|
73
|
-
|
74
|
-
value
|
84
|
+
klass = self.class::ASSOCIATION[key]
|
85
|
+
if value.is_a? String # rubocop:disable Style/CaseLikeIf
|
86
|
+
value = klass.new({uri: value}, @client)
|
87
|
+
elsif value.is_a? Hash
|
88
|
+
value = klass.new(value, @client)
|
89
|
+
elsif value.is_a? Array
|
90
|
+
value = value.map { |v| klass.new(v, @client) }
|
91
|
+
end
|
75
92
|
elsif value && defined?(self.class::TIME_FIELDS) && self.class::TIME_FIELDS.include?(key)
|
76
93
|
value = Time.parse value
|
77
94
|
end
|
@@ -102,5 +119,14 @@ module Calendly
|
|
102
119
|
end
|
103
120
|
items
|
104
121
|
end
|
122
|
+
|
123
|
+
#
|
124
|
+
# Basic attributes used by inspect method.
|
125
|
+
#
|
126
|
+
# @return [Array<Symbol>]
|
127
|
+
# @since 0.6.0
|
128
|
+
def inspect_attributes
|
129
|
+
%i[uuid name type slug status email]
|
130
|
+
end
|
105
131
|
end
|
106
132
|
end
|
@@ -12,6 +12,7 @@ module Calendly
|
|
12
12
|
# @return [String]
|
13
13
|
# unique id of the Organization object.
|
14
14
|
attr_accessor :uuid
|
15
|
+
|
15
16
|
# @return [String]
|
16
17
|
# Canonical resource reference.
|
17
18
|
attr_accessor :uri
|
@@ -19,52 +20,52 @@ module Calendly
|
|
19
20
|
#
|
20
21
|
# Get List memberships of all users belonging to self.
|
21
22
|
#
|
22
|
-
# @param [Hash]
|
23
|
-
# @option
|
24
|
-
# @option
|
25
|
-
# @option
|
23
|
+
# @param [Hash] options the optional request parameters. Optional.
|
24
|
+
# @option options [Integer] :count Number of rows to return.
|
25
|
+
# @option options [String] :email Filter by email.
|
26
|
+
# @option options [String] :page_token Pass this to get the next portion of collection.
|
26
27
|
# @return [Array<Calendly::OrganizationMembership>]
|
27
28
|
# @raise [Calendly::Error] if the uri is empty.
|
28
29
|
# @raise [Calendly::ApiError] if the api returns error code.
|
29
30
|
# @since 0.1.0
|
30
|
-
def memberships(
|
31
|
-
return @cached_memberships if @cached_memberships
|
31
|
+
def memberships(options: nil)
|
32
|
+
return @cached_memberships if defined?(@cached_memberships) && @cached_memberships
|
32
33
|
|
33
|
-
request_proc = proc { |
|
34
|
-
@cached_memberships = auto_pagination request_proc,
|
34
|
+
request_proc = proc { |opts| client.memberships uri, options: opts }
|
35
|
+
@cached_memberships = auto_pagination request_proc, options
|
35
36
|
end
|
36
37
|
|
37
38
|
# @since 0.2.0
|
38
|
-
def memberships!(
|
39
|
+
def memberships!(options: nil)
|
39
40
|
@cached_memberships = nil
|
40
|
-
memberships
|
41
|
+
memberships options: options
|
41
42
|
end
|
42
43
|
|
43
44
|
#
|
44
45
|
# Get Organization Invitations.
|
45
46
|
#
|
46
|
-
# @param [Hash]
|
47
|
-
# @option
|
48
|
-
# @option
|
49
|
-
# @option
|
50
|
-
# @option
|
47
|
+
# @param [Hash] options the optional request parameters. Optional.
|
48
|
+
# @option options [Integer] :count Number of rows to return.
|
49
|
+
# @option options [String] :email Filter by email.
|
50
|
+
# @option options [String] :page_token Pass this to get the next portion of collection.
|
51
|
+
# @option options [String] :sort Order results by the specified field and directin.
|
51
52
|
# Accepts comma-separated list of {field}:{direction} values.
|
52
|
-
# @option
|
53
|
+
# @option options [String] :status Filter by status.
|
53
54
|
# @return [Array<Calendly::OrganizationInvitation>]
|
54
55
|
# @raise [Calendly::Error] if the uuid is empty.
|
55
56
|
# @raise [Calendly::ApiError] if the api returns error code.
|
56
57
|
# @since 0.1.0
|
57
|
-
def invitations(
|
58
|
-
return @cached_invitations if @cached_invitations
|
58
|
+
def invitations(options: nil)
|
59
|
+
return @cached_invitations if defined?(@cached_invitations) && @cached_invitations
|
59
60
|
|
60
|
-
request_proc = proc { |
|
61
|
-
@cached_invitations = auto_pagination request_proc,
|
61
|
+
request_proc = proc { |opts| client.invitations uuid, options: opts }
|
62
|
+
@cached_invitations = auto_pagination request_proc, options
|
62
63
|
end
|
63
64
|
|
64
65
|
# @since 0.2.0
|
65
|
-
def invitations!(
|
66
|
+
def invitations!(options: nil)
|
66
67
|
@cached_invitations = nil
|
67
|
-
invitations
|
68
|
+
invitations options: options
|
68
69
|
end
|
69
70
|
|
70
71
|
#
|
@@ -80,58 +81,83 @@ module Calendly
|
|
80
81
|
client.create_invitation uuid, email
|
81
82
|
end
|
82
83
|
|
84
|
+
#
|
85
|
+
# Returns all Event Types associated with self.
|
86
|
+
#
|
87
|
+
# @param [Hash] options the optional request parameters. Optional.
|
88
|
+
# @option options [Integer] :count Number of rows to return.
|
89
|
+
# @option options [String] :page_token Pass this to get the next portion of collection.
|
90
|
+
# @option options [String] :sort Order results by the specified field and direction.
|
91
|
+
# Accepts comma-separated list of {field}:{direction} values.
|
92
|
+
# @return [Array<Calendly::EventType>]
|
93
|
+
# @raise [Calendly::Error] if the uri is empty.
|
94
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
95
|
+
# @since 0.6.0
|
96
|
+
def event_types(options: nil)
|
97
|
+
return @cached_event_types if defined?(@cached_event_types) && @cached_event_types
|
98
|
+
|
99
|
+
request_proc = proc { |opts| client.event_types uri, options: opts }
|
100
|
+
@cached_event_types = auto_pagination request_proc, options
|
101
|
+
end
|
102
|
+
|
103
|
+
# @since 0.6.0
|
104
|
+
def event_types!(options: nil)
|
105
|
+
@cached_event_types = nil
|
106
|
+
event_types options: options
|
107
|
+
end
|
108
|
+
|
83
109
|
#
|
84
110
|
# Returns all Scheduled Events associated with self.
|
85
111
|
#
|
86
|
-
# @param [Hash]
|
87
|
-
# @option
|
88
|
-
# @option
|
89
|
-
# @option
|
90
|
-
# @option
|
91
|
-
# @option
|
92
|
-
# @option
|
112
|
+
# @param [Hash] options the optional request parameters. Optional.
|
113
|
+
# @option options [Integer] :count Number of rows to return.
|
114
|
+
# @option options [String] :invitee_email Return events scheduled with the specified invitee email
|
115
|
+
# @option options [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by.
|
116
|
+
# @option options [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
|
117
|
+
# @option options [String] :page_token Pass this to get the next portion of collection.
|
118
|
+
# @option options [String] :sort Order results by the specified field and directin.
|
93
119
|
# Accepts comma-separated list of {field}:{direction} values.
|
94
|
-
# @option
|
120
|
+
# @option options [String] :status Whether the scheduled event is active or canceled
|
95
121
|
# @return [Array<Calendly::Event>]
|
96
122
|
# @raise [Calendly::Error] if the uri is empty.
|
97
123
|
# @raise [Calendly::ApiError] if the api returns error code.
|
98
124
|
# @since 0.5.0
|
99
|
-
def scheduled_events(
|
100
|
-
return @cached_scheduled_events if @cached_scheduled_events
|
125
|
+
def scheduled_events(options: nil)
|
126
|
+
return @cached_scheduled_events if defined?(@cached_scheduled_events) && @cached_scheduled_events
|
101
127
|
|
102
|
-
request_proc = proc { |
|
103
|
-
@cached_scheduled_events = auto_pagination request_proc,
|
128
|
+
request_proc = proc { |opts| client.scheduled_events uri, options: opts }
|
129
|
+
@cached_scheduled_events = auto_pagination request_proc, options
|
104
130
|
end
|
105
131
|
|
106
132
|
# @since 0.5.0
|
107
|
-
def scheduled_events!(
|
133
|
+
def scheduled_events!(options: nil)
|
108
134
|
@cached_scheduled_events = nil
|
109
|
-
scheduled_events
|
135
|
+
scheduled_events options: options
|
110
136
|
end
|
111
137
|
|
112
138
|
#
|
113
139
|
# Get List of organization scope Webhooks associated with self.
|
114
140
|
#
|
115
|
-
# @param [Hash]
|
116
|
-
# @option
|
117
|
-
# @option
|
118
|
-
# @option
|
141
|
+
# @param [Hash] options the optional request parameters. Optional.
|
142
|
+
# @option options [Integer] :count Number of rows to return.
|
143
|
+
# @option options [String] :page_token Pass this to get the next portion of collection.
|
144
|
+
# @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
|
119
145
|
# Accepts comma-separated list of {field}:{direction} values.
|
120
146
|
# @return [Array<Calendly::WebhookSubscription>]
|
121
147
|
# @raise [Calendly::Error] if the uri is empty.
|
122
148
|
# @raise [Calendly::ApiError] if the api returns error code.
|
123
149
|
# @since 0.1.3
|
124
|
-
def webhooks(
|
125
|
-
return @cached_webhooks if @cached_webhooks
|
150
|
+
def webhooks(options: nil)
|
151
|
+
return @cached_webhooks if defined?(@cached_webhooks) && @cached_webhooks
|
126
152
|
|
127
|
-
request_proc = proc { |
|
128
|
-
@cached_webhooks = auto_pagination request_proc,
|
153
|
+
request_proc = proc { |opts| client.webhooks uri, options: opts }
|
154
|
+
@cached_webhooks = auto_pagination request_proc, options
|
129
155
|
end
|
130
156
|
|
131
157
|
# @since 0.2.0
|
132
|
-
def webhooks!(
|
158
|
+
def webhooks!(options: nil)
|
133
159
|
@cached_webhooks = nil
|
134
|
-
webhooks
|
160
|
+
webhooks options: options
|
135
161
|
end
|
136
162
|
|
137
163
|
#
|
@@ -139,14 +165,15 @@ module Calendly
|
|
139
165
|
#
|
140
166
|
# @param [String] url Canonical reference (unique identifier) for the resource.
|
141
167
|
# @param [Array<String>] events List of user events to subscribe to. options: invitee.created or invitee.canceled
|
168
|
+
# @param [String] signing_key secret key shared between your application and Calendly. Optional.
|
142
169
|
# @return [Calendly::WebhookSubscription]
|
143
170
|
# @raise [Calendly::Error] if the url arg is empty.
|
144
171
|
# @raise [Calendly::Error] if the events arg is empty.
|
145
172
|
# @raise [Calendly::Error] if the uri is empty.
|
146
173
|
# @raise [Calendly::ApiError] if the api returns error code.
|
147
174
|
# @since 0.1.3
|
148
|
-
def create_webhook(url, events)
|
149
|
-
client.create_webhook url, events, uri
|
175
|
+
def create_webhook(url, events, signing_key: nil)
|
176
|
+
client.create_webhook url, events, uri, signing_key: signing_key
|
150
177
|
end
|
151
178
|
end
|
152
179
|
end
|