calendly 0.4.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -15
- data/lib/calendly/client.rb +84 -7
- data/lib/calendly/models/event_type.rb +30 -0
- data/lib/calendly/models/invitee.rb +16 -0
- data/lib/calendly/models/organization.rb +29 -0
- data/lib/calendly/models/user.rb +1 -1
- data/lib/calendly/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 987260a701999245159a34a38b587e873a80272a3391b5909339c7b6cd01994a
|
4
|
+
data.tar.gz: bb1b11aba44dcfca555b97887611cc989921a972263ea071e1ec144cac7d2bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62d40c515e6833f34ef591b8b2a2a8089970951f6eae3fb68190388de58919a67c16851426f11c0c7c2b06bbc89f9de5248223ed2bd0d4b45fe45c11c0e232d7
|
7
|
+
data.tar.gz: 58136d311993b7b3a1e352888eba6756c7235476078934f2b8e893f06a29af33e36cefd3bdb751d8540948953c1cfdd145c1e160779cad2d3c554eff3f1ccc31
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,48 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.5.2
|
4
|
+
|
5
|
+
- started to support a API
|
6
|
+
- `POST /scheduling_links`
|
7
|
+
|
8
|
+
## 0.5.1
|
9
|
+
|
10
|
+
- added method EventType#fetch
|
11
|
+
|
12
|
+
## 0.5.0
|
13
|
+
|
14
|
+
- changed Calendly::Client#scheduled_events behavior (refs #21)
|
15
|
+
- previous version:
|
16
|
+
- getting events belonging to a specific USER
|
17
|
+
- current version:
|
18
|
+
- getting all events belonging to a specific ORGANIZATION
|
19
|
+
- added Calendly::Client#scheduled_events_by_user method instead_of the before behavior
|
20
|
+
|
21
|
+
## 0.4.2
|
22
|
+
|
23
|
+
- added new following fields to Invitee model (refs #21)
|
24
|
+
- :rescheduled
|
25
|
+
- :old_invitee
|
26
|
+
- :new_invitee
|
27
|
+
- :cancel_url
|
28
|
+
- :reschedule_url
|
29
|
+
|
30
|
+
## 0.4.1
|
31
|
+
|
32
|
+
- started to support a API
|
33
|
+
- `GET /event_types/{uuid}`
|
34
|
+
|
3
35
|
## 0.4.0
|
4
36
|
|
5
|
-
-
|
37
|
+
- fixed a changes for Location fields such as `kind` to `type`. (refs #18)
|
6
38
|
|
7
39
|
## 0.3.0
|
8
40
|
|
9
|
-
-
|
41
|
+
- removed zeitwerk dependency. (refs #16)
|
10
42
|
|
11
43
|
## 0.2.0
|
12
44
|
|
13
|
-
-
|
45
|
+
- added caching features in object when fetching data. (refs #14)
|
14
46
|
|
15
47
|
## 0.1.3
|
16
48
|
|
@@ -22,59 +54,59 @@
|
|
22
54
|
|
23
55
|
## 0.1.2
|
24
56
|
|
25
|
-
-
|
57
|
+
- fixed rubocop warnings.
|
26
58
|
|
27
59
|
## 0.1.1
|
28
60
|
|
29
|
-
-
|
61
|
+
- added tests to make coverage 100%.
|
30
62
|
|
31
63
|
## 0.1.0
|
32
64
|
|
33
|
-
-
|
34
|
-
-
|
65
|
+
- defined methods to access associated resources with each model.
|
66
|
+
- renamed methods:
|
35
67
|
- `Calendly::Client#events` to `Calendly::Client#scheduled_events`
|
36
68
|
|
37
69
|
## 0.0.7.alpha
|
38
70
|
|
39
|
-
- support APIs
|
71
|
+
- started to support APIs
|
40
72
|
- `POST /organizations/{uuid}/invitations`
|
41
73
|
- `DELETE /organizations/{org_uuid}/invitations/{invitation_uuid}`
|
42
74
|
- `DELETE /organization_memberships/{uuid}`
|
43
75
|
|
44
76
|
## 0.0.6.alpha
|
45
77
|
|
46
|
-
- support APIs
|
78
|
+
- started to support APIs
|
47
79
|
- `GET /organizations/{uuid}/invitations`
|
48
80
|
- `GET /organizations/{organization_uuid}/invitations/{invitation_uuid}`
|
49
81
|
|
50
82
|
## 0.0.5.alpha
|
51
83
|
|
52
|
-
- support APIs
|
84
|
+
- started to support APIs
|
53
85
|
- `GET /organization_memberships`
|
54
86
|
- `GET /organization_memberships/{uuid}`
|
55
|
-
-
|
87
|
+
- renamed fields
|
56
88
|
- Invitee#event to Invitee#event_uri
|
57
89
|
- Event#event_type to Event#event_type_uri
|
58
90
|
|
59
91
|
## 0.0.4.alpha
|
60
92
|
|
61
|
-
- support APIs
|
93
|
+
- started to support APIs
|
62
94
|
- `GET /scheduled_events/{event_uuid}/invitees`
|
63
95
|
- `GET /scheduled_events/{event_uuid}/invitees/{invitee_uuid}`
|
64
96
|
|
65
97
|
## 0.0.3.alpha
|
66
98
|
|
67
|
-
- support APIs
|
99
|
+
- started to support APIs
|
68
100
|
- `GET /scheduled_events`
|
69
101
|
- `GET /scheduled_events/{uuid}`
|
70
102
|
|
71
103
|
## 0.0.2.alpha
|
72
104
|
|
73
|
-
- support APIs
|
105
|
+
- started to support APIs
|
74
106
|
- `GET /event_types`
|
75
107
|
|
76
108
|
## 0.0.1.alpha
|
77
109
|
|
78
110
|
- Initial release
|
79
|
-
- support
|
111
|
+
- started to support a API
|
80
112
|
- `GET /users/{uuid}`
|
data/lib/calendly/client.rb
CHANGED
@@ -88,6 +88,20 @@ module Calendly
|
|
88
88
|
User.new body[:resource], self
|
89
89
|
end
|
90
90
|
|
91
|
+
#
|
92
|
+
# Returns a single Event Type by its UUID.
|
93
|
+
#
|
94
|
+
# @param [String] uuid the specified event type (event type's uuid).
|
95
|
+
# @return [Calendly::EventType]
|
96
|
+
# @raise [Calendly::Error] if the uuid arg is empty.
|
97
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
98
|
+
# @since 0.4.1
|
99
|
+
def event_type(uuid)
|
100
|
+
check_not_empty uuid, 'uuid'
|
101
|
+
body = request :get, "event_types/#{uuid}"
|
102
|
+
EventType.new body[:resource], self
|
103
|
+
end
|
104
|
+
|
91
105
|
#
|
92
106
|
# Returns all Event Types associated with a specified User.
|
93
107
|
#
|
@@ -130,10 +144,42 @@ module Calendly
|
|
130
144
|
end
|
131
145
|
|
132
146
|
#
|
133
|
-
# Get List of
|
147
|
+
# Get List of scheduled events belonging to a specific organization.
|
148
|
+
#
|
149
|
+
# @param [String] org_uri the specified organization (organization's uri).
|
150
|
+
# @param [Hash] opts the optional request parameters.
|
151
|
+
# @option opts [Integer] :count Number of rows to return.
|
152
|
+
# @option opts [String] :invitee_email Return events scheduled with the specified invitee email.
|
153
|
+
# @option opts [String] :max_start_time Upper bound (inclusive) for an event's start time to filter by.
|
154
|
+
# @option opts [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
|
155
|
+
# @option opts [String] :page_token Pass this to get the next portion of collection.
|
156
|
+
# @option opts [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
|
157
|
+
# @option opts [String] :status Whether the scheduled event is active or canceled.
|
158
|
+
# @return [Array<Array<Calendly::Event>, Hash>]
|
159
|
+
# - [Array<Calendly::Event>] events
|
160
|
+
# - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
|
161
|
+
# @raise [Calendly::Error] if the org_uri arg is empty.
|
162
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
163
|
+
# @since 0.5.0
|
164
|
+
def scheduled_events(org_uri, opts = {})
|
165
|
+
check_not_empty org_uri, 'org_uri'
|
166
|
+
|
167
|
+
opts_keys = %i[count invitee_email max_start_time min_start_time page_token sort status]
|
168
|
+
params = {organization: org_uri}
|
169
|
+
params = merge_options opts, opts_keys, params
|
170
|
+
body = request :get, 'scheduled_events', params: params
|
171
|
+
|
172
|
+
items = body[:collection] || []
|
173
|
+
evs = items.map { |item| Event.new item, self }
|
174
|
+
[evs, next_page_params(body)]
|
175
|
+
end
|
176
|
+
|
177
|
+
#
|
178
|
+
# Get List of scheduled events belonging to a specific user.
|
134
179
|
#
|
135
180
|
# @param [String] user_uri the specified user (user's uri).
|
136
181
|
# @param [Hash] opts the optional request parameters.
|
182
|
+
# @option opts [String] :organization the specified organization (organization's uri).
|
137
183
|
# @option opts [Integer] :count Number of rows to return.
|
138
184
|
# @option opts [String] :invitee_email Return events scheduled with the specified invitee email.
|
139
185
|
# @option opts [String] :max_start_time Upper bound (inclusive) for an event's start time to filter by.
|
@@ -147,10 +193,10 @@ module Calendly
|
|
147
193
|
# @raise [Calendly::Error] if the user_uri arg is empty.
|
148
194
|
# @raise [Calendly::ApiError] if the api returns error code.
|
149
195
|
# @since 0.0.3
|
150
|
-
def
|
196
|
+
def scheduled_events_by_user(user_uri, opts = {})
|
151
197
|
check_not_empty user_uri, 'user_uri'
|
152
198
|
|
153
|
-
opts_keys = %i[count invitee_email max_start_time min_start_time page_token sort status]
|
199
|
+
opts_keys = %i[organization count invitee_email max_start_time min_start_time page_token sort status]
|
154
200
|
params = {user: user_uri}
|
155
201
|
params = merge_options opts, opts_keys, params
|
156
202
|
body = request :get, 'scheduled_events', params: params
|
@@ -221,7 +267,7 @@ module Calendly
|
|
221
267
|
end
|
222
268
|
|
223
269
|
#
|
224
|
-
# Get List
|
270
|
+
# Get List of memberships belonging to specific an organization.
|
225
271
|
#
|
226
272
|
# @param [String] org_uri the specified organization (organization's uri).
|
227
273
|
# @param [Hash] opts the optional request parameters.
|
@@ -248,7 +294,7 @@ module Calendly
|
|
248
294
|
end
|
249
295
|
|
250
296
|
#
|
251
|
-
# Get List
|
297
|
+
# Get List of memberships belonging to specific a user.
|
252
298
|
#
|
253
299
|
# @param [String] user_uri the specified user (user's uri).
|
254
300
|
# @param [Hash] opts the optional request parameters.
|
@@ -466,7 +512,7 @@ module Calendly
|
|
466
512
|
else
|
467
513
|
params[:scope] = 'organization'
|
468
514
|
end
|
469
|
-
body = request
|
515
|
+
body = request :post, 'webhook_subscriptions', body: params
|
470
516
|
WebhookSubscription.new body[:resource], self
|
471
517
|
end
|
472
518
|
|
@@ -484,11 +530,42 @@ module Calendly
|
|
484
530
|
true
|
485
531
|
end
|
486
532
|
|
533
|
+
#
|
534
|
+
# Create a scheduling link.
|
535
|
+
#
|
536
|
+
# @param [String] uri A link to the resource that owns this scheduling Link.
|
537
|
+
# @param [String] max_event_count The max number of events that can be scheduled using this scheduling link.
|
538
|
+
# @param [String] resource_type Resource type.
|
539
|
+
# @return [Hash]
|
540
|
+
# e.g.
|
541
|
+
# {
|
542
|
+
# booking_url: "https://calendly.com/s/FOO-BAR-SLUG",
|
543
|
+
# owner: "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
|
544
|
+
# owner_type: "EventType"
|
545
|
+
# }
|
546
|
+
# @raise [Calendly::Error] if the uri arg is empty.
|
547
|
+
# @raise [Calendly::Error] if the max_event_count arg is empty.
|
548
|
+
# @raise [Calendly::Error] if the resource_type arg is empty.
|
549
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
550
|
+
# @since 0.5.2
|
551
|
+
def create_schedule_link(uri, max_event_count = 1, resource_type: 'EventType')
|
552
|
+
check_not_empty uri, 'uri'
|
553
|
+
check_not_empty max_event_count, 'max_event_count'
|
554
|
+
check_not_empty resource_type, 'resource_type'
|
555
|
+
params = {
|
556
|
+
max_event_count: max_event_count,
|
557
|
+
owner: uri,
|
558
|
+
owner_type: resource_type
|
559
|
+
}
|
560
|
+
body = request :post, 'scheduling_links', body: params
|
561
|
+
body[:resource]
|
562
|
+
end
|
563
|
+
|
487
564
|
private
|
488
565
|
|
489
566
|
def request(method, path, params: nil, body: nil)
|
490
567
|
debug_log "Request #{method.to_s.upcase} #{API_HOST}/#{path} params:#{params}, body:#{body}"
|
491
|
-
res = access_token.request
|
568
|
+
res = access_token.request method, path, params: params, body: body
|
492
569
|
debug_log "Response status:#{res.status}, body:#{res.body}"
|
493
570
|
parse_as_json res
|
494
571
|
rescue OAuth2::Error => e
|
@@ -75,6 +75,36 @@ module Calendly
|
|
75
75
|
# Whether the profile belongs to a “User” or a “Team”.
|
76
76
|
attr_accessor :owner_type
|
77
77
|
|
78
|
+
#
|
79
|
+
# Get EventType associated with self.
|
80
|
+
#
|
81
|
+
# @return [Calendly::EventType]
|
82
|
+
# @raise [Calendly::Error] if the uuid is empty.
|
83
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
84
|
+
# @since 0.5.1
|
85
|
+
def fetch
|
86
|
+
client.event_type uuid
|
87
|
+
end
|
88
|
+
|
89
|
+
#
|
90
|
+
# Create an associated scheduling link.
|
91
|
+
#
|
92
|
+
# @param [String] max_event_count The max number of events that can be scheduled using this scheduling link.
|
93
|
+
# @return [Hash]
|
94
|
+
# e.g.
|
95
|
+
# {
|
96
|
+
# booking_url: "https://calendly.com/s/FOO-BAR-SLUG",
|
97
|
+
# owner: "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
|
98
|
+
# owner_type: "EventType"
|
99
|
+
# }
|
100
|
+
# @raise [Calendly::Error] if the uri is empty.
|
101
|
+
# @raise [Calendly::Error] if the max_event_count arg is empty.
|
102
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
103
|
+
# @since 0.5.2
|
104
|
+
def create_schedule_link(max_event_count = 1)
|
105
|
+
client.create_schedule_link uri, max_event_count, resource_type: 'EventType'
|
106
|
+
end
|
107
|
+
|
78
108
|
private
|
79
109
|
|
80
110
|
def after_set_attributes(attrs)
|
@@ -34,6 +34,22 @@ module Calendly
|
|
34
34
|
# @return [String]
|
35
35
|
# Text (SMS) reminder phone number.
|
36
36
|
attr_accessor :text_reminder_number
|
37
|
+
# @return [Boolean]
|
38
|
+
# Indicates if this invitee has rescheduled.
|
39
|
+
# If true, a reference to the new Invitee instance is provided in the new_invitee field.
|
40
|
+
attr_accessor :rescheduled
|
41
|
+
# @return [String, nil]
|
42
|
+
# Reference to old Invitee instance that got rescheduled.
|
43
|
+
attr_accessor :old_invitee
|
44
|
+
# @return [String, nil]
|
45
|
+
# Link to new invitee, after reschedule.
|
46
|
+
attr_accessor :new_invitee
|
47
|
+
# @return [String]
|
48
|
+
# Link to cancelling the event for the invitee.
|
49
|
+
attr_accessor :cancel_url
|
50
|
+
# @return [String]
|
51
|
+
# Link to rescheduling the event for the invitee.
|
52
|
+
attr_accessor :reschedule_url
|
37
53
|
# @return [Time]
|
38
54
|
# Moment when user record was first created.
|
39
55
|
attr_accessor :created_at
|
@@ -80,6 +80,35 @@ module Calendly
|
|
80
80
|
client.create_invitation uuid, email
|
81
81
|
end
|
82
82
|
|
83
|
+
#
|
84
|
+
# Returns all Scheduled Events associated with self.
|
85
|
+
#
|
86
|
+
# @param [Hash] opts the optional request parameters.
|
87
|
+
# @option opts [Integer] :count Number of rows to return.
|
88
|
+
# @option opts [String] :invitee_email Return events scheduled with the specified invitee email
|
89
|
+
# @option opts [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by.
|
90
|
+
# @option opts [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
|
91
|
+
# @option opts [String] :page_token Pass this to get the next portion of collection.
|
92
|
+
# @option opts [String] :sort Order results by the specified field and directin.
|
93
|
+
# Accepts comma-separated list of {field}:{direction} values.
|
94
|
+
# @option opts [String] :status Whether the scheduled event is active or canceled
|
95
|
+
# @return [Array<Calendly::Event>]
|
96
|
+
# @raise [Calendly::Error] if the uri is empty.
|
97
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
98
|
+
# @since 0.5.0
|
99
|
+
def scheduled_events(opts = {})
|
100
|
+
return @cached_scheduled_events if @cached_scheduled_events
|
101
|
+
|
102
|
+
request_proc = proc { |options| client.scheduled_events uri, options }
|
103
|
+
@cached_scheduled_events = auto_pagination request_proc, opts
|
104
|
+
end
|
105
|
+
|
106
|
+
# @since 0.5.0
|
107
|
+
def scheduled_events!(opts = {})
|
108
|
+
@cached_scheduled_events = nil
|
109
|
+
scheduled_events opts
|
110
|
+
end
|
111
|
+
|
83
112
|
#
|
84
113
|
# Get List of organization scope Webhooks associated with self.
|
85
114
|
#
|
data/lib/calendly/models/user.rb
CHANGED
@@ -116,7 +116,7 @@ module Calendly
|
|
116
116
|
def scheduled_events(opts = {})
|
117
117
|
return @cached_scheduled_events if @cached_scheduled_events
|
118
118
|
|
119
|
-
request_proc = proc { |options| client.
|
119
|
+
request_proc = proc { |options| client.scheduled_events_by_user uri, options }
|
120
120
|
@cached_scheduled_events = auto_pagination request_proc, opts
|
121
121
|
end
|
122
122
|
|
data/lib/calendly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Koshikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -154,7 +154,7 @@ metadata:
|
|
154
154
|
homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
|
155
155
|
source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
|
156
156
|
changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
|
157
|
-
documentation_uri: https://www.rubydoc.info/gems/calendly/0.
|
157
|
+
documentation_uri: https://www.rubydoc.info/gems/calendly/0.5.2
|
158
158
|
post_install_message:
|
159
159
|
rdoc_options: []
|
160
160
|
require_paths:
|