calendly 0.12.0 → 0.14.0
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 +20 -0
- data/README.md +13 -1
- data/calendly.gemspec +1 -0
- data/lib/calendly/client.rb +64 -0
- data/lib/calendly/models/activity_log_entry.rb +50 -0
- data/lib/calendly/models/event_type.rb +14 -0
- data/lib/calendly/models/event_type_available_type.rb +33 -0
- data/lib/calendly/models/organization.rb +24 -0
- data/lib/calendly/models/routing_form.rb +1 -1
- data/lib/calendly/version.rb +1 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d543d9baf7e5b5670b90c64e9caef192f1ef4c04c77fe7fe7cd188e0f15f37
|
4
|
+
data.tar.gz: a438d7738b377173cefbc501099da081231ed4ffc51cb69425b8ddc569d03121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 178a1fcb7611cb0208b62240eb59b0da6db9a34f4a57cf146377e5f2cdb3119640cbbb20c9ce1ee452e22875a589a11cf2652629f2cb2a11a02f268565543344
|
7
|
+
data.tar.gz: 5a498df806931cf4aada531d804587ed601e05c14a1b0a52ee94ee13b6443a99290abb4b05c4d3f77a3e68ecda30f8c110ee076868c6d3522fb0612d053e2e38
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.14.0 - 2022-11-06
|
4
|
+
|
5
|
+
- supported Activity Log API. (#59, thanks to Calendly gave us a sample JSON file)
|
6
|
+
- `GET /activity_log_entries`
|
7
|
+
- changed were followings:
|
8
|
+
- Client
|
9
|
+
- (Add method) activity_log_entries
|
10
|
+
- Organization model
|
11
|
+
- (Add method) activity_log_entries
|
12
|
+
|
13
|
+
## 0.13.0 - 2022-08-03
|
14
|
+
|
15
|
+
- supported List Event Type Available Times API. (#57)
|
16
|
+
- `GET /event_type_available_times`
|
17
|
+
- changed were followings:
|
18
|
+
- Client
|
19
|
+
- (Add method) event_type_available_times
|
20
|
+
- EventType model
|
21
|
+
- (Add method) available_times
|
22
|
+
|
3
23
|
## 0.12.0 - 2022-07-16
|
4
24
|
|
5
25
|
- supported Routing Form APIs. (#55)
|
data/README.md
CHANGED
@@ -64,9 +64,21 @@ me.scheduling_url
|
|
64
64
|
#
|
65
65
|
event_types = me.event_types
|
66
66
|
# => [#<Calendly::EventType uuid="ET001", name="15 Minute Meeting", type="StandardEventType", slug="15min", active=true, kind="solo", scheduling_url="https://calendly.com/foobar/15min", ..>, #<Calendly::EventType uuid="ET002", name="30 Minute Meeting", type="StandardEventType", slug="30min", active=true, kind="solo", scheduling_url="https://calendly.com/foobar/30min", ..>]
|
67
|
-
|
67
|
+
|
68
|
+
event_type = event_types.first
|
69
|
+
event_type.scheduling_url
|
68
70
|
# => "https://calendly.com/foobar/15min"
|
69
71
|
|
72
|
+
#
|
73
|
+
# get available times for the event type
|
74
|
+
#
|
75
|
+
available_times = event_type.available_times
|
76
|
+
available_times.map(&:start_time)
|
77
|
+
# => [2022-08-04 01:00:00 UTC, 2022-08-04 01:15:00 UTC, 2022-08-04 01:30:00 UTC]
|
78
|
+
|
79
|
+
# you can specify the date range
|
80
|
+
event_type.available_times(start_time: '2022-08-04T10:30:00Z', end_time: '2022-08-05T10:30:00Z')
|
81
|
+
|
70
82
|
#
|
71
83
|
# get scheduled events
|
72
84
|
#
|
data/calendly.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'faraday', '>= 1.0.0', '< 3.0.0'
|
32
32
|
spec.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.4'
|
33
33
|
|
34
|
+
spec.add_development_dependency 'activesupport'
|
34
35
|
spec.add_development_dependency 'bundler'
|
35
36
|
spec.add_development_dependency 'codecov'
|
36
37
|
spec.add_development_dependency 'minitest'
|
data/lib/calendly/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'time'
|
3
4
|
require 'oauth2'
|
4
5
|
require 'calendly/loggable'
|
5
6
|
|
@@ -159,6 +160,35 @@ module Calendly
|
|
159
160
|
[ev_types, next_page_params(body)]
|
160
161
|
end
|
161
162
|
|
163
|
+
#
|
164
|
+
# Returns a list of available times for an event type within a specified date range.
|
165
|
+
# Date range can be no greater than 1 week (7 days).
|
166
|
+
#
|
167
|
+
# @param [String] event_type_uri The uri associated with the event type.
|
168
|
+
# @param [String] start_time Start time of the requested availability range.
|
169
|
+
# @param [String] end_time End time of the requested availability range.
|
170
|
+
# @return [Array<Calendly::EventTypeAvailableTime>] The set of available times for the event type matching the criteria.
|
171
|
+
# @raise [Calendly::Error] if the event_type_uri arg is empty.
|
172
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
173
|
+
# @since 0.13.0
|
174
|
+
def event_type_available_times(event_type_uri, start_time: nil, end_time: nil)
|
175
|
+
check_not_empty event_type_uri, 'event_type_uri'
|
176
|
+
|
177
|
+
start_time_buffer = 60 # For working around an invalid request which be caused by specifying a past time
|
178
|
+
max_date_range = 60 * 60 * 24 * 7 # 7 days
|
179
|
+
|
180
|
+
# If start_time is undefined, set it to now.
|
181
|
+
start_time ||= (Time.now + start_time_buffer).utc.iso8601
|
182
|
+
# If end_time is undefined, set it to in the max date range from start_time.
|
183
|
+
end_time ||= (Time.parse(start_time) + max_date_range).utc.iso8601
|
184
|
+
|
185
|
+
params = {event_type: event_type_uri, start_time: start_time, end_time: end_time}
|
186
|
+
body = request :get, 'event_type_available_times', params: params
|
187
|
+
|
188
|
+
items = body[:collection] || []
|
189
|
+
items.map { |item| EventTypeAvailableTime.new item, self }
|
190
|
+
end
|
191
|
+
|
162
192
|
#
|
163
193
|
# Returns a single Event by its URI.
|
164
194
|
#
|
@@ -370,6 +400,40 @@ module Calendly
|
|
370
400
|
true
|
371
401
|
end
|
372
402
|
|
403
|
+
#
|
404
|
+
# Returns a list of activity log entries.
|
405
|
+
#
|
406
|
+
# @param [String] org_uri Return activity log entries from the organization associated with this URI.
|
407
|
+
# @param [Hash] options the optional request parameters. Optional.
|
408
|
+
# @option options [Array<String>] :action The action(s) associated with the entries.
|
409
|
+
# @option options [Array<String>] :actor Return entries from the user(s) associated with the provided URIs.
|
410
|
+
# @option options [Integer] :count The number of rows to return.
|
411
|
+
# @option options [String] :max_occurred_at include entries that occurred prior to this time.
|
412
|
+
# @option options [String] :min_occurred_at Include entries that occurred after this time.
|
413
|
+
# @option options [Array<String>] :namespace The categories of the entries.
|
414
|
+
# @option options [String] :page_token The token to pass to get the next portion of the collection.
|
415
|
+
# @option options [String] :search_term Filters entries based on the search term.
|
416
|
+
# @option options [Array<String>] :sort Order results by the specified field and direction. List of {field}:{direction} values.
|
417
|
+
# @return [Array<Array<Calendly::ActivityLogEntry>, Hash, Hash>]
|
418
|
+
# - [Array<Calendly::ActivityLogEntry>] log_entries
|
419
|
+
# - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
|
420
|
+
# - [Hash] raw_response
|
421
|
+
# @raise [Calendly::Error] if the org_uri arg is empty.
|
422
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
423
|
+
# @since 0.14.0
|
424
|
+
def activity_log_entries(org_uri, options: nil)
|
425
|
+
check_not_empty org_uri, 'org_uri'
|
426
|
+
|
427
|
+
opts_keys = %i[action actor count max_occurred_at min_occurred_at namespace page_token search_term sort]
|
428
|
+
params = {organization: org_uri}
|
429
|
+
params = merge_options options, opts_keys, params
|
430
|
+
body = request :get, 'activity_log_entries', params: params
|
431
|
+
|
432
|
+
items = body[:collection] || []
|
433
|
+
log_entries = items.map { |item| ActivityLogEntry.new item, self }
|
434
|
+
[log_entries, next_page_params(body), body]
|
435
|
+
end
|
436
|
+
|
373
437
|
#
|
374
438
|
# Returns information about a user's organization membership
|
375
439
|
#
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Calendly
|
4
|
+
# Calendly's activity log entry model.
|
5
|
+
class ActivityLogEntry
|
6
|
+
include ModelUtils
|
7
|
+
UUID_RE = %r{\A#{Client::API_HOST}/activity_log_entries/(#{UUID_FORMAT})\z}.freeze
|
8
|
+
TIME_FIELDS = %i[occurred_at].freeze
|
9
|
+
|
10
|
+
def self.association
|
11
|
+
{
|
12
|
+
organization: Organization
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String]
|
17
|
+
# unique id of the ActivityLogEntry object.
|
18
|
+
attr_accessor :uuid
|
19
|
+
|
20
|
+
# @return [String]
|
21
|
+
# Canonical reference (unique identifier) for the activity log entry.
|
22
|
+
attr_accessor :uri
|
23
|
+
|
24
|
+
# @return [Time]
|
25
|
+
# The date and time of the entry.
|
26
|
+
attr_accessor :occurred_at
|
27
|
+
|
28
|
+
# @return [Hash]
|
29
|
+
# The Calendly actor that took the action creating the activity log entry.
|
30
|
+
attr_accessor :actor
|
31
|
+
|
32
|
+
# @return [Hash]
|
33
|
+
attr_accessor :details
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
attr_accessor :fully_qualified_name
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
# The category associated with the entry.
|
40
|
+
attr_accessor :namespace
|
41
|
+
|
42
|
+
# @return [String]
|
43
|
+
# The action associated with the entry.
|
44
|
+
attr_accessor :action
|
45
|
+
|
46
|
+
# @return [Organization]
|
47
|
+
# The organization associated with the entry.
|
48
|
+
attr_accessor :organization
|
49
|
+
end
|
50
|
+
end
|
@@ -118,6 +118,20 @@ module Calendly
|
|
118
118
|
client.event_type uuid
|
119
119
|
end
|
120
120
|
|
121
|
+
#
|
122
|
+
# Returns a list of available times for an event type within a specified date range.
|
123
|
+
# Date range can be no greater than 1 week (7 days).
|
124
|
+
#
|
125
|
+
# @param [String] start_time Start time of the requested availability range.
|
126
|
+
# @param [String] end_time End time of the requested availability range.
|
127
|
+
# @return [Array<Calendly::EventTypeAvailableTime>] The set of available times for the event type matching the criteria.
|
128
|
+
# @raise [Calendly::Error] if the uri is empty.
|
129
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
130
|
+
# @since 0.13.0
|
131
|
+
def available_times(start_time: nil, end_time: nil)
|
132
|
+
client.event_type_available_times uri, start_time: start_time, end_time: end_time
|
133
|
+
end
|
134
|
+
|
121
135
|
#
|
122
136
|
# Create an associated scheduling link.
|
123
137
|
#
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Calendly
|
4
|
+
# An available meeting time slot for the given event type.
|
5
|
+
class EventTypeAvailableTime
|
6
|
+
include ModelUtils
|
7
|
+
TIME_FIELDS = %i[start_time].freeze
|
8
|
+
|
9
|
+
# Indicates that the open time slot is "available".
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :status
|
12
|
+
|
13
|
+
# Total remaining invitees for this available time.
|
14
|
+
# For Group Event Type, more than one invitee can book in this available time.
|
15
|
+
# For all other Event Types, only one invitee can book in this available time.
|
16
|
+
# @return [Integer]
|
17
|
+
attr_accessor :invitees_remaining
|
18
|
+
|
19
|
+
# The moment the event was scheduled to start in UTC time.
|
20
|
+
# @return [Time]
|
21
|
+
attr_accessor :start_time
|
22
|
+
|
23
|
+
# The URL of the user’s scheduling site where invitees book this event type.
|
24
|
+
# @return [Time]
|
25
|
+
attr_accessor :scheduling_url
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def inspect_attributes
|
30
|
+
super + %i[start_time invitees_remaining]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -193,5 +193,29 @@ module Calendly
|
|
193
193
|
@cached_routing_forms = nil
|
194
194
|
routing_forms options: options
|
195
195
|
end
|
196
|
+
|
197
|
+
#
|
198
|
+
# Returns a list of activity log entries.
|
199
|
+
#
|
200
|
+
# @param [Hash] options the optional request parameters. Optional.
|
201
|
+
# @option options [Array<String>] :action The action(s) associated with the entries.
|
202
|
+
# @option options [Array<String>] :actor Return entries from the user(s) associated with the provided URIs.
|
203
|
+
# @option options [Integer] :count The number of rows to return.
|
204
|
+
# @option options [String] :max_occurred_at include entries that occurred prior to this time.
|
205
|
+
# @option options [String] :min_occurred_at Include entries that occurred after this time.
|
206
|
+
# @option options [Array<String>] :namespace The categories of the entries.
|
207
|
+
# @option options [String] :page_token The token to pass to get the next portion of the collection.
|
208
|
+
# @option options [String] :search_term Filters entries based on the search term.
|
209
|
+
# @option options [Array<String>] :sort Order results by the specified field and direction. List of {field}:{direction} values.
|
210
|
+
# @return [Array<Array<Calendly::ActivityLogEntry>, Hash, Hash>]
|
211
|
+
# - [Array<Calendly::ActivityLogEntry>] log_entries
|
212
|
+
# - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
|
213
|
+
# - [Hash] raw_response
|
214
|
+
# @raise [Calendly::Error] if the uri is empty.
|
215
|
+
# @raise [Calendly::ApiError] if the api returns error code.
|
216
|
+
# @since 0.14.0
|
217
|
+
def activity_log_entries(options: nil)
|
218
|
+
client.activity_log_entries uri, options: options
|
219
|
+
end
|
196
220
|
end
|
197
221
|
end
|
@@ -42,7 +42,7 @@ module Calendly
|
|
42
42
|
# The URI of the organization that's associated with the routing form.
|
43
43
|
attr_accessor :organization
|
44
44
|
|
45
|
-
# @return [Calendly::RoutingFormQuestion]
|
45
|
+
# @return [Array<Calendly::RoutingFormQuestion>]
|
46
46
|
# An ordered collection of Routing Form non-deleted questions.
|
47
47
|
attr_accessor :questions
|
48
48
|
|
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.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Koshikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -50,6 +50,20 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.4.4
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: activesupport
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: bundler
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,8 +188,10 @@ files:
|
|
174
188
|
- lib/calendly/configuration.rb
|
175
189
|
- lib/calendly/error.rb
|
176
190
|
- lib/calendly/loggable.rb
|
191
|
+
- lib/calendly/models/activity_log_entry.rb
|
177
192
|
- lib/calendly/models/event.rb
|
178
193
|
- lib/calendly/models/event_type.rb
|
194
|
+
- lib/calendly/models/event_type_available_type.rb
|
179
195
|
- lib/calendly/models/event_type_custom_question.rb
|
180
196
|
- lib/calendly/models/event_type_profile.rb
|
181
197
|
- lib/calendly/models/guest.rb
|
@@ -209,7 +225,7 @@ metadata:
|
|
209
225
|
homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
|
210
226
|
source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
|
211
227
|
changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
|
212
|
-
documentation_uri: https://www.rubydoc.info/gems/calendly/0.
|
228
|
+
documentation_uri: https://www.rubydoc.info/gems/calendly/0.14.0
|
213
229
|
post_install_message:
|
214
230
|
rdoc_options: []
|
215
231
|
require_paths:
|