calendlyr 0.7.5 → 1.0.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/.github/workflows/ci.yml +9 -5
- data/.gitignore +3 -1
- data/CHANGELOG.md +98 -0
- data/README.md +209 -73
- data/calendlyr.gemspec +8 -6
- data/docs/resources/activity_log/list_activity_log_entries.md +2 -1
- data/docs/resources/availabilities/user_availability_schedule.md +3 -2
- data/docs/resources/availabilities/user_busy_time.md +3 -2
- data/docs/resources/data_compliance.md +1 -1
- data/docs/resources/event_types/availability_schedule.md +28 -0
- data/docs/resources/event_types/available_time.md +15 -11
- data/docs/resources/event_types/event_type.md +21 -9
- data/docs/resources/event_types/membership.md +15 -16
- data/docs/resources/events/cancellation.md +1 -1
- data/docs/resources/events/event.md +6 -5
- data/docs/resources/events/invitee.md +18 -0
- data/docs/resources/events/invitee_no_show.md +2 -1
- data/docs/resources/groups/group.md +2 -1
- data/docs/resources/locations/location.md +16 -0
- data/docs/resources/organizations/membership.md +3 -2
- data/docs/resources/organizations/organization.md +13 -9
- data/docs/resources/outgoing_communications/outgoing_communication.md +28 -0
- data/docs/resources/routing_forms/routing_form.md +2 -1
- data/docs/resources/routing_forms/submission.md +2 -1
- data/docs/resources/scheduling_links/scheduling_link.md +26 -0
- data/docs/resources/share.md +4 -10
- data/docs/resources/webhooks/invitee_payload.md +10 -16
- data/docs/resources/webhooks/payload.md +32 -3
- data/docs/resources/webhooks/sample.md +23 -0
- data/docs/resources/webhooks/subscription.md +10 -6
- data/lib/calendlyr/client.rb +7 -2
- data/lib/calendlyr/collection.rb +42 -9
- data/lib/calendlyr/configuration.rb +24 -0
- data/lib/calendlyr/error.rb +65 -27
- data/lib/calendlyr/object.rb +85 -13
- data/lib/calendlyr/objects/event_type.rb +0 -4
- data/lib/calendlyr/objects/event_types/availability_schedule.rb +8 -0
- data/lib/calendlyr/objects/event_types/available_time.rb +5 -1
- data/lib/calendlyr/objects/event_types/membership.rb +4 -7
- data/lib/calendlyr/objects/events/invitee.rb +1 -1
- data/lib/calendlyr/objects/location.rb +4 -0
- data/lib/calendlyr/objects/organization.rb +0 -4
- data/lib/calendlyr/objects/outgoing_communication.rb +6 -0
- data/lib/calendlyr/objects/scheduling_link.rb +2 -5
- data/lib/calendlyr/objects/share.rb +0 -5
- data/lib/calendlyr/objects/webhooks/payload.rb +30 -0
- data/lib/calendlyr/resource.rb +84 -12
- data/lib/calendlyr/resources/availability.rb +14 -2
- data/lib/calendlyr/resources/event_types.rb +45 -5
- data/lib/calendlyr/resources/events.rb +20 -2
- data/lib/calendlyr/resources/groups.rb +14 -2
- data/lib/calendlyr/resources/locations.rb +13 -0
- data/lib/calendlyr/resources/organizations.rb +25 -3
- data/lib/calendlyr/resources/outgoing_communications.rb +11 -3
- data/lib/calendlyr/resources/routing_forms.rb +14 -2
- data/lib/calendlyr/resources/scheduling_links.rb +5 -2
- data/lib/calendlyr/resources/shares.rb +1 -0
- data/lib/calendlyr/resources/webhooks.rb +11 -3
- data/lib/calendlyr/version.rb +1 -1
- data/lib/calendlyr/webhook.rb +105 -0
- data/lib/calendlyr.rb +50 -0
- data/logos/calendlyr.png +0 -0
- data/logos/calendlyr_bg_white.png +0 -0
- data/test/calendlyr/client_test.rb +29 -0
- data/test/calendlyr/collection_test.rb +168 -0
- data/test/calendlyr/configuration_test.rb +157 -0
- data/test/calendlyr/object_test.rb +82 -1
- data/test/calendlyr/objects/event_type_test.rb +0 -15
- data/test/calendlyr/objects/event_types/availability_schedule_test.rb +20 -0
- data/test/calendlyr/objects/events/cancellation_test.rb +1 -1
- data/test/calendlyr/objects/events/guest_test.rb +1 -1
- data/test/calendlyr/objects/events/invitee_no_show_test.rb +1 -1
- data/test/calendlyr/objects/events/invitee_test.rb +10 -3
- data/test/calendlyr/objects/location_test.rb +22 -0
- data/test/calendlyr/objects/organization_test.rb +0 -8
- data/test/calendlyr/objects/organizations/invitation_test.rb +1 -1
- data/test/calendlyr/objects/share_test.rb +3 -9
- data/test/calendlyr/objects/webhooks/payload_test.rb +15 -0
- data/test/calendlyr/resource_test.rb +456 -2
- data/test/calendlyr/resources/availabilities/user_busy_times_test.rb +26 -0
- data/test/calendlyr/resources/availabilities/user_schedules_test.rb +25 -0
- data/test/calendlyr/resources/data_compliance_test.rb +1 -4
- data/test/calendlyr/resources/event_types_test.rb +132 -0
- data/test/calendlyr/resources/events_test.rb +87 -0
- data/test/calendlyr/resources/groups_test.rb +54 -0
- data/test/calendlyr/resources/locations_test.rb +30 -0
- data/test/calendlyr/resources/organizations_test.rb +96 -2
- data/test/calendlyr/resources/outgoing_communications_test.rb +34 -8
- data/test/calendlyr/resources/routing_forms_test.rb +57 -0
- data/test/calendlyr/resources/scheduling_links_test.rb +31 -6
- data/test/calendlyr/resources/shares_test.rb +15 -0
- data/test/calendlyr/resources/webhooks_test.rb +63 -5
- data/test/calendlyr/webhook_test.rb +292 -0
- data/test/fixtures/activity_log/list_page2.json +30 -0
- data/test/fixtures/event_invitees/list_page2.json +35 -0
- data/test/fixtures/event_invitees/retrieve.json +11 -1
- data/test/fixtures/event_type_availability_schedules/list.json +17 -0
- data/test/fixtures/event_type_availability_schedules/update.json +3 -0
- data/test/fixtures/event_type_available_times/list.json +0 -12
- data/test/fixtures/event_type_memberships/list.json +43 -0
- data/test/fixtures/event_type_memberships/list_page2.json +33 -0
- data/test/fixtures/event_types/create.json +30 -0
- data/test/fixtures/event_types/list_page2.json +37 -0
- data/test/fixtures/event_types/update.json +30 -0
- data/test/fixtures/events/create_invitee.json +37 -0
- data/test/fixtures/events/list_page2.json +29 -0
- data/test/fixtures/events/retrieve.json +12 -2
- data/test/fixtures/group_relationships/list_page2.json +35 -0
- data/test/fixtures/groups/list_page2.json +16 -0
- data/test/fixtures/locations/list.json +16 -0
- data/test/fixtures/locations/list_page2.json +16 -0
- data/test/fixtures/objects/event.json +10 -2
- data/test/fixtures/objects/event_types/availability_schedule.json +6 -0
- data/test/fixtures/objects/location.json +5 -0
- data/test/fixtures/organizations/list_invitations_page2.json +18 -0
- data/test/fixtures/organizations/list_memberships_page2.json +26 -0
- data/test/fixtures/organizations/retrieve.json +11 -0
- data/test/fixtures/outgoing_communications/list.json +4 -6
- data/test/fixtures/outgoing_communications/list_page2.json +21 -0
- data/test/fixtures/routing_forms/list_page2.json +17 -0
- data/test/fixtures/routing_forms/list_routing_form_submission_page2.json +29 -0
- data/test/fixtures/user_availability_schedules/list_page1.json +16 -0
- data/test/fixtures/user_availability_schedules/list_page2.json +16 -0
- data/test/fixtures/user_busy_times/list_page1.json +18 -0
- data/test/fixtures/user_busy_times/list_page2.json +13 -0
- data/test/fixtures/webhooks/list_page2.json +23 -0
- data/test/fixtures/webhooks/sample.json +55 -94
- data/test/test_helper.rb +19 -7
- metadata +70 -27
- data/docs/resources/scheduling_link.md +0 -26
- data/test/calendlyr/objects/event_types/available_time_test.rb +0 -20
- data/test/calendlyr/objects/event_types/membership_test.rb +0 -32
- data/test/calendlyr/objects/scheduling_link_test.rb +0 -17
- data/test/calendlyr/resources/event_types/membership_test.rb +0 -22
- data/test/fixtures/objects/event_types/available_time.json +0 -6
- data/test/fixtures/objects/event_types/membership.json +0 -65
- data/test/fixtures/objects/scheduling_links/event_type.json +0 -5
|
@@ -24,13 +24,32 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/25a4ece03c1bc-l
|
|
|
24
24
|
|
|
25
25
|
For the examples bellow we will use only required parameters, but you can use any other parameter as well.
|
|
26
26
|
```ruby
|
|
27
|
-
|
|
27
|
+
# user: and organization: accept bare UUIDs or full Calendly URIs
|
|
28
|
+
client.event_types.list(user: "USER_UUID")
|
|
28
29
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventType>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
29
30
|
|
|
30
|
-
client.event_types.list(organization:
|
|
31
|
+
client.event_types.list(organization: "ORG_UUID")
|
|
31
32
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventType>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
32
33
|
```
|
|
33
34
|
|
|
35
|
+
### Create
|
|
36
|
+
|
|
37
|
+
Creates a new Event Type.
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
client.event_types.create(name: "30 Minute Meeting", duration: 30, pooling_type: "round_robin")
|
|
41
|
+
#=> #<Calendlyr::EventType>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Update
|
|
45
|
+
|
|
46
|
+
Updates an Event Type.
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
client.event_types.update(uuid: @uuid, name: "Updated Meeting", duration: 45)
|
|
50
|
+
#=> #<Calendlyr::EventType>
|
|
51
|
+
```
|
|
52
|
+
|
|
34
53
|
## Object methods
|
|
35
54
|
|
|
36
55
|
### Associated Profile
|
|
@@ -46,10 +65,3 @@ event_type.associated_profile
|
|
|
46
65
|
event_type.create_share
|
|
47
66
|
#=> #<Calendlyr::Share>
|
|
48
67
|
```
|
|
49
|
-
|
|
50
|
-
### Available Times
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
event_type.available_times(start_time: @start_time, end_time: @end_time, ...)
|
|
54
|
-
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventTypes::AvailableTime>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
55
|
-
```
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
# Membership (
|
|
1
|
+
# Event Type Membership (`Calendlyr::EventTypes::Membership`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Membership object for an Event Type.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Fetch list of event type hosts.
|
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Client requests
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
client.event_types.list_memberships(event_type, event_type)
|
|
12
|
-
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventTypes::Membership>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
13
|
-
```
|
|
9
|
+
### List
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Returns memberships for a specified Event Type.
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
18
14
|
|
|
19
15
|
```ruby
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
# event_type: accepts a bare UUID or full Calendly URI
|
|
17
|
+
client.event_types.list_memberships(event_type: "EVENT_TYPE_UUID")
|
|
18
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventTypes::Membership>, ...], ...>
|
|
22
19
|
```
|
|
23
20
|
|
|
24
|
-
###
|
|
21
|
+
### List All
|
|
22
|
+
|
|
23
|
+
Fetches every membership page and returns a flat Array.
|
|
25
24
|
|
|
26
25
|
```ruby
|
|
27
|
-
|
|
28
|
-
#=> [#<Calendlyr::
|
|
26
|
+
client.event_types.list_all_memberships(event_type: "EVENT_TYPE_UUID")
|
|
27
|
+
#=> [#<Calendlyr::EventTypes::Membership>, ...]
|
|
29
28
|
```
|
|
@@ -13,6 +13,6 @@ Cancels specified event.
|
|
|
13
13
|
Visit official [API Doc](https://developer.calendly.com/api-docs/afb2e9fe3a0a0-cancel-event)
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
client.events.cancel(uuid: event_uuid, reason: "I'm
|
|
16
|
+
client.events.cancel(uuid: event_uuid, reason: "I'm busy")
|
|
17
17
|
#=> #<Calendlyr::Events::Cancellation>
|
|
18
18
|
```
|
|
@@ -24,13 +24,14 @@ Returns a list of Events.
|
|
|
24
24
|
Visit official [API Doc](https://developer.calendly.com/api-docs/2d5ed9bbd2952-list-events)
|
|
25
25
|
|
|
26
26
|
```ruby
|
|
27
|
-
|
|
27
|
+
# You can pass bare UUIDs or full Calendly URIs for user:, organization:, and group:
|
|
28
|
+
client.events.list(organization: "ORG_UUID", user: "USER_UUID")
|
|
28
29
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Event>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
29
30
|
|
|
30
|
-
client.events.list(organization:
|
|
31
|
+
client.events.list(organization: "ORG_UUID", group: group)
|
|
31
32
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Event>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
32
33
|
|
|
33
|
-
client.events.list(user:
|
|
34
|
+
client.events.list(user: "USER_UUID")
|
|
34
35
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Event>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
35
36
|
```
|
|
36
37
|
|
|
@@ -41,7 +42,7 @@ Cancels specified event.
|
|
|
41
42
|
Visit official [API Doc](https://developer.calendly.com/api-docs/afb2e9fe3a0a0-cancel-event)
|
|
42
43
|
|
|
43
44
|
```ruby
|
|
44
|
-
client.events.cancel(uuid: event_uuid, reason: "I'm
|
|
45
|
+
client.events.cancel(uuid: event_uuid, reason: "I'm busy")
|
|
45
46
|
#=> #<Calendlyr::Events::Cancellation>
|
|
46
47
|
```
|
|
47
48
|
|
|
@@ -57,6 +58,6 @@ event.memberships
|
|
|
57
58
|
### Cancel
|
|
58
59
|
|
|
59
60
|
```ruby
|
|
60
|
-
event.cancel(reason: "I'm
|
|
61
|
+
event.cancel(reason: "I'm busy")
|
|
61
62
|
#=> #<Calendlyr::Events::Cancellation>
|
|
62
63
|
```
|
|
@@ -26,3 +26,21 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/eb8ee72701f99-l
|
|
|
26
26
|
client.events.list_invitees(uuid: uuid)
|
|
27
27
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Events::Invitee>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
28
28
|
```
|
|
29
|
+
|
|
30
|
+
### Create
|
|
31
|
+
|
|
32
|
+
Creates and schedules an Invitee.
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# event_type: accepts a bare UUID or full Calendly URI
|
|
36
|
+
client.events.create_invitee(
|
|
37
|
+
event_type: "EVENT_TYPE_UUID",
|
|
38
|
+
start_time: "2019-08-07T06:05:04.321123Z",
|
|
39
|
+
invitee: {
|
|
40
|
+
name: "John Doe",
|
|
41
|
+
email: "test@example.com",
|
|
42
|
+
timezone: "America/New_York"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
#=> #<Calendlyr::Events::Invitee>
|
|
46
|
+
```
|
|
@@ -24,7 +24,8 @@ Marks an Invitee as a No Show.
|
|
|
24
24
|
Visit official [API Doc](https://developer.calendly.com/api-docs/cebd8c3170790-create-invitee-no-show)
|
|
25
25
|
|
|
26
26
|
```ruby
|
|
27
|
-
|
|
27
|
+
# invitee: accepts a bare UUID or full Calendly URI
|
|
28
|
+
client.events.create_invitee_no_show(invitee: "INVITEE_UUID")
|
|
28
29
|
#=> #<Calendlyr::Events::InviteeNoShow>
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -24,7 +24,8 @@ Returns a list of groups.
|
|
|
24
24
|
Visit official [API Doc](https://developer.calendly.com/api-docs/6rb6dtdln74sy-list-groups)
|
|
25
25
|
|
|
26
26
|
```ruby
|
|
27
|
-
|
|
27
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
28
|
+
client.groups.list(organization: "ORG_UUID")
|
|
28
29
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Group>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Location Calendlyr::Location
|
|
2
|
+
|
|
3
|
+
Location object.
|
|
4
|
+
|
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
6
|
+
|
|
7
|
+
## Client requests
|
|
8
|
+
|
|
9
|
+
### List
|
|
10
|
+
|
|
11
|
+
Returns a list of locations.
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
client.locations.list
|
|
15
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Location>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
16
|
+
```
|
|
@@ -26,10 +26,11 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/eaed2e61a6bc3-l
|
|
|
26
26
|
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
|
-
|
|
29
|
+
# user: and organization: accept bare UUIDs or full Calendly URIs
|
|
30
|
+
client.organizations.list_memberships(user: "USER_UUID")
|
|
30
31
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Organizations::Membership>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
31
32
|
|
|
32
|
-
client.organizations.list_memberships(organization:
|
|
33
|
+
client.organizations.list_memberships(organization: "ORG_UUID")
|
|
33
34
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Organizations::Membership>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
34
35
|
```
|
|
35
36
|
|
|
@@ -13,6 +13,19 @@ organization = client.organization
|
|
|
13
13
|
#=> #<Calendlyr::Organization>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
## Client requests
|
|
17
|
+
|
|
18
|
+
### Retrieve
|
|
19
|
+
|
|
20
|
+
Returns information about a specified Organization.
|
|
21
|
+
|
|
22
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
client.organizations.retrieve(uuid: "ORG_UUID")
|
|
26
|
+
#=> #<Calendlyr::Organization>
|
|
27
|
+
```
|
|
28
|
+
|
|
16
29
|
## Object methods
|
|
17
30
|
|
|
18
31
|
### Activity Logs
|
|
@@ -103,15 +116,6 @@ organization.create_webhook(url:, url, events: events, scope: scope)
|
|
|
103
116
|
#=> #<Calendlyr::Webhooks::Subscription>
|
|
104
117
|
```
|
|
105
118
|
|
|
106
|
-
### Sample Webhook Data
|
|
107
|
-
|
|
108
|
-
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
|
109
|
-
|
|
110
|
-
```ruby
|
|
111
|
-
organization.sample_webhook_data(event: event, scope: scope)
|
|
112
|
-
#=> #<Calendlyr::Object>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
119
|
### Invite user
|
|
116
120
|
|
|
117
121
|
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Outgoing Communication (`Calendlyr::OutgoingCommunication`)
|
|
2
|
+
|
|
3
|
+
Outgoing communication object.
|
|
4
|
+
|
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
6
|
+
|
|
7
|
+
## Client requests
|
|
8
|
+
|
|
9
|
+
### List
|
|
10
|
+
|
|
11
|
+
Returns outgoing communications for a specified Organization.
|
|
12
|
+
|
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
17
|
+
client.outgoing_communications.list(organization: "ORG_UUID")
|
|
18
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::OutgoingCommunication>, ...], ...>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### List All
|
|
22
|
+
|
|
23
|
+
Fetches every page and returns a flat Array.
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
client.outgoing_communications.list_all(organization: "ORG_UUID")
|
|
27
|
+
#=> [#<Calendlyr::OutgoingCommunication>, ...]
|
|
28
|
+
```
|
|
@@ -26,7 +26,8 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/9fe7334bec6ad-l
|
|
|
26
26
|
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
|
-
|
|
29
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
30
|
+
client.routing_forms.list(organization: "ORG_UUID")
|
|
30
31
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::RoutingForm>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
31
32
|
```
|
|
32
33
|
|
|
@@ -26,7 +26,8 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/17db5cb915a57-l
|
|
|
26
26
|
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
|
-
|
|
29
|
+
# form: accepts a bare UUID or full Calendly URI
|
|
30
|
+
client.routing_forms.list_submissions(form: "ROUTING_FORM_UUID")
|
|
30
31
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::RoutingForms::Submission>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
31
32
|
```
|
|
32
33
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Scheduling Link (`Calendlyr::SchedulingLink`)
|
|
2
|
+
|
|
3
|
+
Scheduling link object.
|
|
4
|
+
|
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
6
|
+
|
|
7
|
+
## Client requests
|
|
8
|
+
|
|
9
|
+
### Create
|
|
10
|
+
|
|
11
|
+
Creates a scheduling link for an Event Type owner.
|
|
12
|
+
|
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
# owner: accepts a bare UUID or full Calendly URI
|
|
17
|
+
client.scheduling_links.create(owner: "EVENT_TYPE_UUID")
|
|
18
|
+
#=> #<Calendlyr::SchedulingLink>
|
|
19
|
+
|
|
20
|
+
client.scheduling_links.create(
|
|
21
|
+
owner: "EVENT_TYPE_UUID",
|
|
22
|
+
owner_type: "EventType",
|
|
23
|
+
max_event_count: 3
|
|
24
|
+
)
|
|
25
|
+
#=> #<Calendlyr::SchedulingLink>
|
|
26
|
+
```
|
data/docs/resources/share.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Share Calendlyr::
|
|
1
|
+
# Share Calendlyr::Share
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Share Object.
|
|
4
4
|
|
|
5
5
|
Visit official [API Doc](https://developer.calendly.com/api-docs/0069948603238-share)
|
|
6
6
|
|
|
@@ -14,15 +14,9 @@ Endpoint for our Customize Once and Share feature. This allows you to customize
|
|
|
14
14
|
Visit official [API Doc](https://developer.calendly.com/api-docs/fdcac06abfc8c-create-share)
|
|
15
15
|
|
|
16
16
|
```ruby
|
|
17
|
-
|
|
17
|
+
# event_type: accepts a bare UUID or full Calendly URI
|
|
18
|
+
client.shares.create(event_type: "EVENT_TYPE_UUID", name: "15 minute meeting", duration: ...)
|
|
18
19
|
#=> #<Calendlyr::Share>
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
## Object methods
|
|
22
|
-
|
|
23
|
-
### Associated Scheduling Links
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
share.associated_scheduling_links
|
|
27
|
-
#=> [#<Calendlyr::SchedulingLink>]
|
|
28
|
-
```
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Webhooks Invitee Payload (`Calendlyr::Webhooks::InviteePayload`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed payload wrapper used by `Calendlyr::Webhook.parse` when `event` is one of:
|
|
4
|
+
- `invitee.created`
|
|
5
|
+
- `invitee.canceled`
|
|
6
|
+
- `invitee_no_show.created`
|
|
7
|
+
- `invitee_no_show.deleted`
|
|
8
|
+
|
|
9
|
+
For other events, `parsed.payload` is returned as a generic `Calendlyr::Object`.
|
|
4
10
|
|
|
5
11
|
Visit official [API Doc](https://developer.calendly.com/api-docs/b92768854bc06-invitee-payload)
|
|
6
12
|
|
|
@@ -9,7 +15,7 @@ Visit official [API Doc](https://developer.calendly.com/api-docs/b92768854bc06-i
|
|
|
9
15
|
### Associated Event
|
|
10
16
|
|
|
11
17
|
```ruby
|
|
12
|
-
webhook_invitee_payload.
|
|
18
|
+
webhook_invitee_payload.associated_event
|
|
13
19
|
#=> #<Calendlyr::Event>
|
|
14
20
|
```
|
|
15
21
|
|
|
@@ -27,16 +33,4 @@ webhook_invitee_payload.associated_invitee_no_show
|
|
|
27
33
|
#=> #<Calendlyr::Events::InviteeNoShow>
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```ruby
|
|
33
|
-
webhook_subscription.active?
|
|
34
|
-
#=> true
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### disabled?
|
|
38
|
-
|
|
39
|
-
```ruby
|
|
40
|
-
webhook_subscription.disabled?
|
|
41
|
-
#=> false
|
|
42
|
-
```
|
|
36
|
+
`active?` / `disabled?` are methods on `Calendlyr::Webhooks::Subscription`, not on invitee payloads.
|
|
@@ -1,5 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Webhooks Payload (`Calendlyr::Webhooks::Payload`)
|
|
2
2
|
|
|
3
|
-
Webhook
|
|
3
|
+
`Calendlyr::Webhooks::Payload` is the object returned by `Calendlyr::Webhook.parse` after signature verification.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`Calendlyr::Webhook` expects:
|
|
6
|
+
- `payload:` raw request body string
|
|
7
|
+
- `signing_key:` your Calendly webhook signing key
|
|
8
|
+
- one signature header keyword: `signature_header:` (preferred) or `header:` (backward compatible)
|
|
9
|
+
|
|
10
|
+
`verify!` raises on invalid signature/timestamp, `valid?` returns boolean, and `parse` verifies first then parses JSON.
|
|
11
|
+
|
|
12
|
+
## Signed payload verification + parsing
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
payload = request.body.read
|
|
16
|
+
signature_header = request.get_header("HTTP_CALENDLY_WEBHOOK_SIGNATURE")
|
|
17
|
+
signing_key = ENV.fetch("CALENDLY_WEBHOOK_SIGNING_KEY")
|
|
18
|
+
|
|
19
|
+
Calendlyr::Webhook.verify!(payload: payload, signature_header: signature_header, signing_key: signing_key)
|
|
20
|
+
parsed = Calendlyr::Webhook.parse(payload: payload, signature_header: signature_header, signing_key: signing_key)
|
|
21
|
+
|
|
22
|
+
parsed.event
|
|
23
|
+
#=> "invitee.created"
|
|
24
|
+
|
|
25
|
+
parsed.payload
|
|
26
|
+
#=> #<Calendlyr::Webhooks::InviteePayload ...> for invitee.* events
|
|
27
|
+
#=> #<Calendlyr::Object ...> for unknown events
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> `Calendlyr::Webhook` (singular) handles signature verification.
|
|
31
|
+
> `Calendlyr::Webhooks` (plural) contains API resource objects and payload wrappers.
|
|
32
|
+
> Calendly's header is `Calendly-Webhook-Signature`; in Rack/Rails, read `HTTP_CALENDLY_WEBHOOK_SIGNATURE`.
|
|
33
|
+
|
|
34
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/69c58da556b61-webhook-payload).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Sample Webhook Data
|
|
2
|
+
|
|
3
|
+
Fetch sample webhook payload data for a given event, organization, and scope.
|
|
4
|
+
|
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
6
|
+
|
|
7
|
+
## Client requests
|
|
8
|
+
|
|
9
|
+
### Sample
|
|
10
|
+
|
|
11
|
+
Returns raw sample webhook data. The response shape varies by event type, so this method returns the raw response hash instead of a typed object.
|
|
12
|
+
|
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs)
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
17
|
+
client.webhooks.sample(
|
|
18
|
+
event: "invitee.created",
|
|
19
|
+
organization: "ORG_UUID",
|
|
20
|
+
scope: "organization"
|
|
21
|
+
)
|
|
22
|
+
#=> { "payload" => { ... } }
|
|
23
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Webhooks Subscription (`Calendlyr::Webhooks::Subscription`)
|
|
2
2
|
|
|
3
3
|
Webhook Subscription Object.
|
|
4
4
|
|
|
@@ -13,16 +13,19 @@ Create a Webhook Subscription for an Organization or User.
|
|
|
13
13
|
Visit official [API Doc](https://developer.calendly.com/api-docs/c1ddc06ce1f1b-create-webhook-subscription)
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
|
|
16
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
17
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: "ORG_UUID", scope: 'organization')
|
|
17
18
|
#=> #<Calendlyr::Webhooks::Subscription>
|
|
18
19
|
|
|
19
|
-
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization:
|
|
20
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: "ORG_UUID", user: "https://api.calendly.com/users/USER_UUID", scope: 'user')
|
|
20
21
|
#=> #<Calendlyr::Webhooks::Subscription>
|
|
21
22
|
|
|
22
|
-
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization:
|
|
23
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: "ORG_UUID", group: "https://api.calendly.com/groups/GROUP_UUID", scope: 'group')
|
|
23
24
|
#=> #<Calendlyr::Webhooks::Subscription>
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
`organization:` accepts either a bare UUID (`"ORG_UUID"`) or full URI. For `user:` and `group:`, pass the URI format shown above.
|
|
28
|
+
|
|
26
29
|
### Retrieve
|
|
27
30
|
|
|
28
31
|
Get a specified Webhook Subscription.
|
|
@@ -40,10 +43,11 @@ Get a list of Webhook Subscriptions for a specified Organization or User.
|
|
|
40
43
|
|
|
41
44
|
Visit official [API Doc](https://developer.calendly.com/api-docs/faac832d7c57d-list-webhook-subscriptions)
|
|
42
45
|
|
|
43
|
-
For the example
|
|
46
|
+
For the example below we use only required parameters, but you can pass other supported API parameters as needed.
|
|
44
47
|
|
|
45
48
|
```ruby
|
|
46
|
-
|
|
49
|
+
# organization: accepts a bare UUID or full Calendly URI
|
|
50
|
+
client.webhooks.list(organization: "ORG_UUID", scope: 'organization')
|
|
47
51
|
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Webhooks::Subscription>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
|
48
52
|
```
|
|
49
53
|
|
data/lib/calendlyr/client.rb
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
module Calendlyr
|
|
2
2
|
class Client
|
|
3
3
|
BASE_URL = "https://api.calendly.com"
|
|
4
|
+
DEFAULT_OPEN_TIMEOUT = 30
|
|
5
|
+
DEFAULT_READ_TIMEOUT = 30
|
|
4
6
|
|
|
5
|
-
attr_reader :token
|
|
7
|
+
attr_reader :token, :open_timeout, :read_timeout, :logger
|
|
6
8
|
|
|
7
|
-
def initialize(token:)
|
|
9
|
+
def initialize(token:, open_timeout: DEFAULT_OPEN_TIMEOUT, read_timeout: DEFAULT_READ_TIMEOUT, logger: nil)
|
|
8
10
|
@token = token
|
|
11
|
+
@open_timeout = open_timeout
|
|
12
|
+
@read_timeout = read_timeout
|
|
13
|
+
@logger = logger
|
|
9
14
|
end
|
|
10
15
|
|
|
11
16
|
def me(force_reload: false)
|
data/lib/calendlyr/collection.rb
CHANGED
|
@@ -1,25 +1,56 @@
|
|
|
1
1
|
require "uri"
|
|
2
|
-
require "cgi"
|
|
3
2
|
|
|
4
3
|
module Calendlyr
|
|
5
4
|
class Collection
|
|
6
|
-
|
|
5
|
+
include Enumerable
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
attr_reader :data, :next_page_url, :next_page_token, :client
|
|
8
|
+
|
|
9
|
+
def self.from_response(response, type:, client:, next_page_caller: nil)
|
|
9
10
|
new(
|
|
10
11
|
data: response["collection"].map { |attrs| type.new(attrs.merge(client: client)) },
|
|
11
12
|
count: response.dig("pagination", "count"),
|
|
12
|
-
|
|
13
|
-
client: client
|
|
13
|
+
next_page_url: response.dig("pagination", "next_page"),
|
|
14
|
+
client: client,
|
|
15
|
+
next_page_caller: next_page_caller
|
|
14
16
|
)
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
def initialize(data:, count:,
|
|
19
|
+
def initialize(data:, count:, next_page_url:, client:, next_page_caller: nil)
|
|
18
20
|
@data = data
|
|
19
21
|
@count = count
|
|
20
|
-
@
|
|
21
|
-
@next_page_token = get_params(
|
|
22
|
+
@next_page_url = next_page_url
|
|
23
|
+
@next_page_token = get_params(next_page_url)["page_token"]&.first
|
|
22
24
|
@client = client
|
|
25
|
+
@next_page_caller = next_page_caller
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def each(&)
|
|
29
|
+
data.each(&)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def count(*args, &block)
|
|
33
|
+
if block || args.any?
|
|
34
|
+
super
|
|
35
|
+
else
|
|
36
|
+
@count
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def next_page
|
|
41
|
+
return nil if @next_page_token.nil? || @next_page_caller.nil?
|
|
42
|
+
|
|
43
|
+
@next_page_caller.call(page_token: @next_page_token)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def auto_paginate
|
|
47
|
+
Enumerator.new do |yielder|
|
|
48
|
+
current = self
|
|
49
|
+
while current
|
|
50
|
+
current.data.each { |item| yielder << item }
|
|
51
|
+
current = current.next_page
|
|
52
|
+
end
|
|
53
|
+
end.lazy
|
|
23
54
|
end
|
|
24
55
|
|
|
25
56
|
private
|
|
@@ -28,7 +59,9 @@ module Calendlyr
|
|
|
28
59
|
return {} unless url
|
|
29
60
|
|
|
30
61
|
uri = URI.parse(url)
|
|
31
|
-
|
|
62
|
+
return {} unless uri.query
|
|
63
|
+
|
|
64
|
+
URI.decode_www_form(uri.query).to_h { |k, v| [k, [v]] }
|
|
32
65
|
end
|
|
33
66
|
end
|
|
34
67
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Calendlyr
|
|
2
|
+
class Configuration
|
|
3
|
+
attr_accessor :token, :open_timeout, :read_timeout, :logger
|
|
4
|
+
|
|
5
|
+
def initialize(token: nil, open_timeout: nil, read_timeout: nil, logger: nil)
|
|
6
|
+
@token = token
|
|
7
|
+
@open_timeout = open_timeout.nil? ? self.class.default_open_timeout : open_timeout
|
|
8
|
+
@read_timeout = read_timeout.nil? ? self.class.default_read_timeout : read_timeout
|
|
9
|
+
@logger = logger
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.default_open_timeout
|
|
13
|
+
Calendlyr::Client::DEFAULT_OPEN_TIMEOUT
|
|
14
|
+
rescue NameError
|
|
15
|
+
30
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.default_read_timeout
|
|
19
|
+
Calendlyr::Client::DEFAULT_READ_TIMEOUT
|
|
20
|
+
rescue NameError
|
|
21
|
+
30
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|