calendlyr 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +7 -8
- data/CHANGELOG.md +2 -2
- data/README.md +46 -127
- data/calendlyr.gemspec +0 -1
- data/docs/resources/activity_log/list_activity_log_entries.md +34 -0
- data/docs/resources/availabilities/availability_rule.md +5 -0
- data/docs/resources/availabilities/user_availability_schedule.md +50 -0
- data/docs/resources/availabilities/user_busy_time.md +28 -0
- data/docs/resources/data_compliance.md +19 -0
- data/docs/resources/event_types/available_time.md +21 -0
- data/docs/resources/event_types/event_type.md +55 -0
- data/docs/resources/event_types/membership.md +29 -0
- data/docs/resources/event_types/profile.md +13 -0
- data/docs/resources/events/cancellation.md +18 -0
- data/docs/resources/events/event.md +62 -0
- data/docs/resources/events/guest.md +5 -0
- data/docs/resources/events/invitee.md +28 -0
- data/docs/resources/events/invitee_no_show.md +49 -0
- data/docs/resources/groups/group.md +56 -0
- data/docs/resources/groups/relationship.md +54 -0
- data/docs/resources/organizations/invitation.md +65 -0
- data/docs/resources/organizations/membership.md +58 -0
- data/docs/resources/organizations/organization.md +149 -0
- data/docs/resources/pagination.md +21 -0
- data/docs/resources/routing_forms/routing_form.md +48 -0
- data/docs/resources/routing_forms/submission.md +40 -0
- data/docs/resources/scheduling_link.md +26 -0
- data/docs/resources/share.md +28 -0
- data/docs/resources/user.md +111 -0
- data/docs/resources/webhooks/invitee_payload.md +42 -0
- data/docs/resources/webhooks/payload.md +5 -0
- data/docs/resources/webhooks/subscription.md +96 -0
- data/lib/calendlyr/client.rb +18 -2
- data/lib/calendlyr/collection.rb +2 -2
- data/lib/calendlyr/error.rb +42 -1
- data/lib/calendlyr/object.rb +6 -2
- data/lib/calendlyr/objects/activity_log.rb +11 -0
- data/lib/calendlyr/objects/availabilities/rule.rb +4 -0
- data/lib/calendlyr/objects/availabilities/user_busy_time.rb +7 -0
- data/lib/calendlyr/objects/availabilities/user_schedule.rb +13 -0
- data/lib/calendlyr/objects/event.rb +11 -0
- data/lib/calendlyr/objects/event_type.rb +15 -0
- data/lib/calendlyr/objects/event_types/available_time.rb +4 -0
- data/lib/calendlyr/objects/event_types/membership.rb +11 -0
- data/lib/calendlyr/objects/event_types/profile.rb +7 -0
- data/lib/calendlyr/objects/events/cancellation.rb +4 -0
- data/lib/calendlyr/objects/events/guest.rb +4 -0
- data/lib/calendlyr/objects/events/invitee.rb +11 -0
- data/lib/calendlyr/objects/events/invitee_no_show.rb +7 -0
- data/lib/calendlyr/objects/group.rb +15 -0
- data/lib/calendlyr/objects/groups/relationship.rb +15 -0
- data/lib/calendlyr/objects/organization.rb +67 -0
- data/lib/calendlyr/objects/organizations/invitation.rb +15 -0
- data/lib/calendlyr/objects/organizations/membership.rb +15 -0
- data/lib/calendlyr/objects/routing_form.rb +11 -0
- data/lib/calendlyr/objects/routing_forms/submission.rb +7 -0
- data/lib/calendlyr/objects/scheduling_link.rb +9 -0
- data/lib/calendlyr/objects/share.rb +9 -0
- data/lib/calendlyr/objects/user.rb +31 -0
- data/lib/calendlyr/objects/webhooks/invitee_payload.rb +15 -0
- data/lib/calendlyr/objects/webhooks/payload.rb +4 -0
- data/lib/calendlyr/objects/webhooks/subscription.rb +23 -0
- data/lib/calendlyr/resource.rb +2 -2
- data/lib/calendlyr/resources/availability.rb +19 -0
- data/lib/calendlyr/resources/data_compliance.rb +4 -0
- data/lib/calendlyr/resources/event.rb +40 -0
- data/lib/calendlyr/resources/event_type.rb +28 -0
- data/lib/calendlyr/resources/group.rb +22 -0
- data/lib/calendlyr/resources/organization.rb +40 -0
- data/lib/calendlyr/resources/outgoing_communication.rb +8 -0
- data/lib/calendlyr/resources/routing_form.rb +22 -0
- data/lib/calendlyr/resources/{scheduling_links.rb → scheduling_link.rb} +2 -2
- data/lib/calendlyr/resources/share.rb +8 -0
- data/lib/calendlyr/resources/user.rb +11 -0
- data/lib/calendlyr/resources/webhook.rb +25 -0
- data/lib/calendlyr/version.rb +1 -1
- data/lib/calendlyr.rb +70 -18
- data/test/calendlyr/objects/activity_log_test.rb +26 -0
- data/test/calendlyr/objects/availabilities/rule_test.rb +24 -0
- data/test/calendlyr/objects/availabilities/user_busy_time_test.rb +21 -0
- data/test/calendlyr/objects/availabilities/user_schedule_test.rb +26 -0
- data/test/calendlyr/objects/event_test.rb +32 -0
- data/test/calendlyr/objects/event_type_test.rb +43 -0
- data/test/calendlyr/objects/event_types/available_time_test.rb +20 -0
- data/test/calendlyr/objects/event_types/membership_test.rb +32 -0
- data/test/calendlyr/objects/event_types/profile_test.rb +23 -0
- data/test/calendlyr/objects/events/cancellation_test.rb +16 -0
- data/test/calendlyr/objects/events/guest_test.rb +16 -0
- data/test/calendlyr/objects/events/invitee_no_show_test.rb +23 -0
- data/test/calendlyr/objects/events/invitee_test.rb +35 -0
- data/test/calendlyr/objects/group_test.rb +40 -0
- data/test/calendlyr/objects/groups/relationship_test.rb +43 -0
- data/test/calendlyr/objects/organization_test.rb +157 -0
- data/test/calendlyr/objects/organizations/invitation_test.rb +34 -0
- data/test/calendlyr/objects/organizations/membership_test.rb +38 -0
- data/test/calendlyr/objects/routing_form_test.rb +26 -0
- data/test/calendlyr/objects/routing_forms/submission_test.rb +22 -0
- data/test/calendlyr/objects/scheduling_link_test.rb +17 -0
- data/test/calendlyr/objects/share_test.rb +19 -0
- data/test/calendlyr/objects/user_test.rb +81 -0
- data/test/calendlyr/objects/webhooks/invite_payload_test.rb +42 -0
- data/test/calendlyr/objects/webhooks/payload_test.rb +16 -0
- data/test/calendlyr/objects/webhooks/subscription_test.rb +42 -0
- data/test/calendlyr/resource_test.rb +12 -3
- data/test/calendlyr/resources/availabilities/user_busy_times_test.rb +31 -0
- data/test/calendlyr/resources/availabilities/user_schedules_test.rb +37 -0
- data/test/calendlyr/resources/data_compliance_test.rb +11 -0
- data/test/calendlyr/resources/event_types/membership_test.rb +22 -0
- data/test/calendlyr/resources/event_types_test.rb +55 -10
- data/test/calendlyr/resources/events/invitee_test.rb +31 -0
- data/test/calendlyr/resources/events_test.rb +22 -10
- data/test/calendlyr/resources/groups_test.rb +26 -0
- data/test/calendlyr/resources/organizations_test.rb +36 -100
- data/test/calendlyr/resources/outgoing_communications_test.rb +16 -0
- data/test/calendlyr/resources/scheduling_links_test.rb +1 -1
- data/test/calendlyr/resources/users_test.rb +9 -33
- data/test/calendlyr/resources/webhooks_test.rb +22 -13
- data/test/fixtures/activity_log/list.json +38 -0
- data/test/fixtures/availabilities/user_busy_times_list.json +39 -0
- data/test/fixtures/availabilities/user_schedules_list.json +93 -0
- data/test/fixtures/availabilities/user_schedules_retrieve.json +22 -0
- data/test/fixtures/data_compliance/delete_scheduled_event_data.json +1 -0
- data/test/fixtures/event_invitees/list.json +6 -6
- data/test/fixtures/event_invitees/retrieve.json +3 -3
- data/test/fixtures/event_type_available_times/list.json +22 -0
- data/test/fixtures/event_type_hosts/list.json +76 -0
- data/test/fixtures/event_types/create_one_off.json +45 -0
- data/test/fixtures/event_types/list.json +18 -4
- data/test/fixtures/event_types/retrieve.json +13 -2
- data/test/fixtures/events/cancel_invitee.json +8 -0
- data/test/fixtures/events/create_invitee_no_show.json +7 -0
- data/test/fixtures/events/delete_invitee_no_show.json +1 -0
- data/test/fixtures/events/retrieve_invitee_no_show.json +7 -0
- data/test/fixtures/group_relationships/list.json +83 -0
- data/test/fixtures/group_relationships/retrieve.json +29 -0
- data/test/fixtures/groups/list.json +19 -0
- data/test/fixtures/groups/retrieve.json +9 -0
- data/test/fixtures/objects/activity_log.json +24 -0
- data/test/fixtures/objects/availabilities/rule.json +10 -0
- data/test/fixtures/objects/availabilities/user_busy_time.json +10 -0
- data/test/fixtures/objects/availabilities/user_schedule.json +69 -0
- data/test/fixtures/objects/availability_rule.json +10 -0
- data/test/fixtures/objects/event.json +36 -0
- data/test/fixtures/objects/event_type.json +91 -0
- data/test/fixtures/objects/event_type_host.json +65 -0
- data/test/fixtures/objects/event_types/available_time.json +6 -0
- data/test/fixtures/objects/event_types/membership.json +65 -0
- data/test/fixtures/objects/event_types/profile.json +5 -0
- data/test/fixtures/objects/events/cancellation.json +6 -0
- data/test/fixtures/objects/events/guest.json +5 -0
- data/test/fixtures/objects/events/invitee.json +46 -0
- data/test/fixtures/objects/events/invitee_no_show.json +5 -0
- data/test/fixtures/objects/group.json +7 -0
- data/test/fixtures/objects/groups/relationship.json +27 -0
- data/test/fixtures/objects/organization.json +8 -0
- data/test/fixtures/objects/organizations/invitation.json +10 -0
- data/test/fixtures/objects/organizations/membership.json +18 -0
- data/test/fixtures/objects/routing_form.json +28 -0
- data/test/fixtures/objects/routing_forms/submission.json +27 -0
- data/test/fixtures/objects/scheduling_links/event_type.json +5 -0
- data/test/fixtures/objects/share.json +43 -0
- data/test/fixtures/objects/user.json +13 -0
- data/test/fixtures/objects/webhooks/invite_payload.json +83 -0
- data/test/fixtures/objects/webhooks/payload.json +66 -0
- data/test/fixtures/objects/webhooks/subscription.json +15 -0
- data/test/fixtures/organization_memberships/list.json +29 -0
- data/test/fixtures/organization_memberships/retrieve.json +20 -0
- data/test/fixtures/organizations/list_invitations.json +4 -4
- data/test/fixtures/organizations/list_memberships.json +12 -9
- data/test/fixtures/organizations/retrieve_invitation.json +3 -3
- data/test/fixtures/organizations/retrieve_membership.json +3 -3
- data/test/fixtures/outgoing_communications/list.json +26 -0
- data/test/fixtures/resources/401.json +2 -2
- data/test/fixtures/resources/403.json +1 -1
- data/test/fixtures/resources/403_payment_required.json +4 -0
- data/test/fixtures/resources/424.json +4 -0
- data/test/fixtures/routing_forms/list.json +39 -0
- data/test/fixtures/routing_forms/list_routing_form_submission.json +38 -0
- data/test/fixtures/routing_forms/retrieve.json +30 -0
- data/test/fixtures/routing_forms/retrieve_routing_form_submission.json +29 -0
- data/test/fixtures/shares/create.json +45 -0
- data/test/fixtures/user_availability_schedules/list.json +93 -0
- data/test/fixtures/user_availability_schedules/retrieve.json +22 -0
- data/test/fixtures/user_busy_times/list.json +39 -0
- data/test/fixtures/users/reload.json +5 -4
- data/test/fixtures/users/retrieve.json +5 -4
- data/test/fixtures/webhooks/create.json +4 -4
- data/test/fixtures/webhooks/list.json +4 -4
- data/test/fixtures/webhooks/retrieve.json +4 -4
- data/test/fixtures/webhooks/sample.json +105 -0
- metadata +159 -62
- data/lib/calendlyr/objects/event_invitees.rb +0 -4
- data/lib/calendlyr/objects/event_types.rb +0 -4
- data/lib/calendlyr/objects/events.rb +0 -4
- data/lib/calendlyr/objects/invitations.rb +0 -11
- data/lib/calendlyr/objects/memberships.rb +0 -7
- data/lib/calendlyr/objects/organizations.rb +0 -35
- data/lib/calendlyr/objects/scheduling_links.rb +0 -4
- data/lib/calendlyr/objects/users.rb +0 -19
- data/lib/calendlyr/objects/webhooks.rb +0 -11
- data/lib/calendlyr/resources/event_invitees.rb +0 -12
- data/lib/calendlyr/resources/event_types.rb +0 -12
- data/lib/calendlyr/resources/events.rb +0 -12
- data/lib/calendlyr/resources/organizations.rb +0 -33
- data/lib/calendlyr/resources/users.rb +0 -11
- data/lib/calendlyr/resources/webhooks.rb +0 -21
- data/test/calendlyr/resources/event_invitees_test.rb +0 -29
- data/test/fixtures/resources/409.json +0 -4
@@ -0,0 +1,111 @@
|
|
1
|
+
# User Calendlyr::User
|
2
|
+
|
3
|
+
Information about the user.
|
4
|
+
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/647961f90c0dd-user)
|
6
|
+
|
7
|
+
## Client requests
|
8
|
+
|
9
|
+
### Retrieve
|
10
|
+
|
11
|
+
Returns information about a specified User.
|
12
|
+
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/ff9832c5a6640-get-user)
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
client.users.retrieve(uuid: user_uuid)
|
17
|
+
#=> #<Calendlyr::User>
|
18
|
+
```
|
19
|
+
|
20
|
+
### Me
|
21
|
+
|
22
|
+
Returns basic information about your user account.
|
23
|
+
|
24
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/005832c83aeae-get-current-user)
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
client.users.me
|
28
|
+
#=> #<Calendlyr::User>
|
29
|
+
```
|
30
|
+
|
31
|
+
#### Easy access
|
32
|
+
|
33
|
+
Probably you need to make many calls through `client.me`, so we decided to not make calls for every `client.me` reference by memoizing it the first time.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
client.me # makes a call and memoize the response
|
37
|
+
client.me # no call, value memoized
|
38
|
+
```
|
39
|
+
|
40
|
+
#### Force reload
|
41
|
+
|
42
|
+
However, if you need to reload the content of `me` you can `force_relaod` to force a new call.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
client.me(force_reload: true) # makes a new call and update memoized value
|
46
|
+
```
|
47
|
+
|
48
|
+
## Object methods
|
49
|
+
|
50
|
+
### Associated Organization
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
user.associated_organization
|
54
|
+
#=> #<Calendlyr::Organization>
|
55
|
+
```
|
56
|
+
|
57
|
+
### Availability Schedules
|
58
|
+
|
59
|
+
For the example bellow we will use not parameters, but you can use the allowed parameters in Calendly docs.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
user.availability_schedules
|
63
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Availabilities::UserSchedule>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
64
|
+
```
|
65
|
+
|
66
|
+
### Memberships
|
67
|
+
|
68
|
+
Based on your user organization
|
69
|
+
|
70
|
+
For the example bellow we will use not parameters, but you can use the allowed parameters in Calendly docs.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
user.memberships
|
74
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Organizations::Membership>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
75
|
+
```
|
76
|
+
|
77
|
+
### Organization Membership
|
78
|
+
|
79
|
+
Based on your user organization
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
user.membership(uuid: membership_uuid)
|
83
|
+
#=> #<Calendlyr::Organizations::Membership>
|
84
|
+
```
|
85
|
+
|
86
|
+
### Event Types
|
87
|
+
|
88
|
+
For the example bellow we will use not parameters, but you can use the allowed parameters in Calendly docs.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
user.event_types
|
92
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::EventType>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
93
|
+
```
|
94
|
+
|
95
|
+
### Events
|
96
|
+
|
97
|
+
For the example bellow we will use not parameters, but you can use the allowed parameters in Calendly docs.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
user.events
|
101
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Event>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
102
|
+
```
|
103
|
+
|
104
|
+
### Busy Times
|
105
|
+
|
106
|
+
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
user.busy_times(start_time: start_time, end_time: end_time)
|
110
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Availabilities::UserBusyTime>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
111
|
+
```
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Webhook Invitee Payload Calendlyr::Wehooks::InviteePayload
|
2
|
+
|
3
|
+
The payload that is sent via Webhook when an invitee creates or schedules a meeting, and when an invitee cancels.
|
4
|
+
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/b92768854bc06-invitee-payload)
|
6
|
+
|
7
|
+
## Object methods
|
8
|
+
|
9
|
+
### Associated Event
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
webhook_invitee_payload.associated_organization
|
13
|
+
#=> #<Calendlyr::Event>
|
14
|
+
```
|
15
|
+
|
16
|
+
### Associated Routing Form Submission
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
webhook_invitee_payload.associated_routing_form_submission
|
20
|
+
#=> #<Calendlyr::RoutingForms::Submission>
|
21
|
+
```
|
22
|
+
|
23
|
+
### Associated Invitee No Show
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
webhook_invitee_payload.associated_invitee_no_show
|
27
|
+
#=> #<Calendlyr::Events::InviteeNoShow>
|
28
|
+
```
|
29
|
+
|
30
|
+
### active?
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
webhook_subscription.active?
|
34
|
+
#=> true
|
35
|
+
```
|
36
|
+
|
37
|
+
### disabled?
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
webhook_subscription.disabled?
|
41
|
+
#=> false
|
42
|
+
```
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# Webhook Subscription Calendlyr::Wehooks::Subscription
|
2
|
+
|
3
|
+
Webhook Subscription Object.
|
4
|
+
|
5
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/9950e4dff7351-webhook-subscription)
|
6
|
+
|
7
|
+
## Client requests
|
8
|
+
|
9
|
+
### Create
|
10
|
+
|
11
|
+
Create a Webhook Subscription for an Organization or User.
|
12
|
+
|
13
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/c1ddc06ce1f1b-create-webhook-subscription)
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: organization_uri, scope: 'organization')
|
17
|
+
#=> #<Calendlyr::Webhooks::Subscription>
|
18
|
+
|
19
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: organization_uri, user: user_uri, scope: 'user')
|
20
|
+
#=> #<Calendlyr::Webhooks::Subscription>
|
21
|
+
|
22
|
+
client.webhooks.create(url: 'https://example.com/webhook', events: ['invitee.created'], organization: organization_uri, group: group_uri, scope: 'group')
|
23
|
+
#=> #<Calendlyr::Webhooks::Subscription>
|
24
|
+
```
|
25
|
+
|
26
|
+
### Retrieve
|
27
|
+
|
28
|
+
Get a specified Webhook Subscription.
|
29
|
+
|
30
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/4d800dc2cb119-get-webhook-subscription)
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
client.webhooks.retrieve(webhook_uuid: webhook_uuid)
|
34
|
+
#=> #<Calendlyr::Webhooks::Subscription>
|
35
|
+
```
|
36
|
+
|
37
|
+
### List
|
38
|
+
|
39
|
+
Get a list of Webhook Subscriptions for a specified Organization or User.
|
40
|
+
|
41
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/faac832d7c57d-list-webhook-subscriptions)
|
42
|
+
|
43
|
+
For the example bellow we will use only required parameters, but you can use any other parameter as well.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
client.webhooks.list(organization: organization_uri, scope: 'organization')
|
47
|
+
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Webhooks::Subscription>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
|
48
|
+
```
|
49
|
+
|
50
|
+
### Delete
|
51
|
+
|
52
|
+
Delete a Webhook Subscription.
|
53
|
+
|
54
|
+
Visit official [API Doc](https://developer.calendly.com/api-docs/565b97f62dafe-delete-webhook-subscription)
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
client.webhooks.delete(webhook_uuid: webhook_uuid)
|
58
|
+
#=>
|
59
|
+
```
|
60
|
+
|
61
|
+
## Object methods
|
62
|
+
|
63
|
+
### Associated Organization
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
webhook_subscription.associated_organization
|
67
|
+
#=> #<Calendlyr::Organization>
|
68
|
+
```
|
69
|
+
|
70
|
+
### Associated User
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
webhook_subscription.associated_user
|
74
|
+
#=> #<Calendlyr::User>
|
75
|
+
```
|
76
|
+
|
77
|
+
### Associated Creator
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
webhook_subscription.associated_creator
|
81
|
+
#=> #<Calendlyr::User>
|
82
|
+
```
|
83
|
+
|
84
|
+
### active?
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
webhook_subscription.active?
|
88
|
+
#=> true
|
89
|
+
```
|
90
|
+
|
91
|
+
### disabled?
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
webhook_subscription.disabled?
|
95
|
+
#=> false
|
96
|
+
```
|
data/lib/calendlyr/client.rb
CHANGED
@@ -8,6 +8,10 @@ module Calendlyr
|
|
8
8
|
@token = token
|
9
9
|
end
|
10
10
|
|
11
|
+
def availability
|
12
|
+
AvailabilityResource.new(self)
|
13
|
+
end
|
14
|
+
|
11
15
|
def me(force_reload: false)
|
12
16
|
@me = nil if force_reload
|
13
17
|
@me ||= users.me
|
@@ -33,14 +37,26 @@ module Calendlyr
|
|
33
37
|
EventResource.new(self)
|
34
38
|
end
|
35
39
|
|
36
|
-
def
|
37
|
-
|
40
|
+
def groups
|
41
|
+
GroupResource.new(self)
|
42
|
+
end
|
43
|
+
|
44
|
+
def outgoing_communications
|
45
|
+
OutgoingCommunicationResource.new(self)
|
46
|
+
end
|
47
|
+
|
48
|
+
def routing_forms
|
49
|
+
RoutingFormResource.new(self)
|
38
50
|
end
|
39
51
|
|
40
52
|
def scheduling_links
|
41
53
|
SchedulingLinkResource.new(self)
|
42
54
|
end
|
43
55
|
|
56
|
+
def shares
|
57
|
+
ShareResource.new(self)
|
58
|
+
end
|
59
|
+
|
44
60
|
def webhooks
|
45
61
|
WebhookResource.new(self)
|
46
62
|
end
|
data/lib/calendlyr/collection.rb
CHANGED
@@ -5,9 +5,9 @@ module Calendlyr
|
|
5
5
|
class Collection
|
6
6
|
attr_reader :data, :count, :next_page, :next_page_token, :client
|
7
7
|
|
8
|
-
def self.from_response(response,
|
8
|
+
def self.from_response(response, type:, client:)
|
9
9
|
new(
|
10
|
-
data: response[
|
10
|
+
data: response["collection"].map { |attrs| type.new(attrs.merge(client: client)) },
|
11
11
|
count: response.dig("pagination", "count"),
|
12
12
|
next_page: response.dig("pagination", "next_page"),
|
13
13
|
client: client
|
data/lib/calendlyr/error.rb
CHANGED
@@ -1,4 +1,45 @@
|
|
1
1
|
module Calendlyr
|
2
|
-
class Error < StandardError
|
2
|
+
class Error < StandardError; end
|
3
|
+
|
4
|
+
class PermissionDenied < StandardError; end
|
5
|
+
|
6
|
+
class BadRequest < StandardError; end
|
7
|
+
|
8
|
+
class PaymentRequired < StandardError; end
|
9
|
+
|
10
|
+
class Unauthenticated < StandardError; end
|
11
|
+
|
12
|
+
class NotFound < StandardError; end
|
13
|
+
|
14
|
+
class ExternalCalendarEror < StandardError; end
|
15
|
+
|
16
|
+
class InternalServerError < StandardError; end
|
17
|
+
|
18
|
+
class ResponseErrorHandler
|
19
|
+
ERROR_TYPES = {
|
20
|
+
"400" => BadRequest,
|
21
|
+
"401" => Unauthenticated,
|
22
|
+
"403" => PermissionDenied,
|
23
|
+
"404" => NotFound,
|
24
|
+
"424" => ExternalCalendarEror,
|
25
|
+
"500" => InternalServerError
|
26
|
+
}
|
27
|
+
|
28
|
+
def initialize(code, body)
|
29
|
+
@code = code
|
30
|
+
@body = body
|
31
|
+
end
|
32
|
+
|
33
|
+
def error
|
34
|
+
error_type.new("[Error #{@code}] #{@body["title"]}. #{@body["message"]}")
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def error_type
|
40
|
+
return PaymentRequired if @code == "403" && @body["message"].include?("upgrade")
|
41
|
+
|
42
|
+
ERROR_TYPES[@code]
|
43
|
+
end
|
3
44
|
end
|
4
45
|
end
|
data/lib/calendlyr/object.rb
CHANGED
@@ -2,8 +2,12 @@ require "ostruct"
|
|
2
2
|
|
3
3
|
module Calendlyr
|
4
4
|
class Object < OpenStruct
|
5
|
+
def self.get_slug(path)
|
6
|
+
path.split("/").last
|
7
|
+
end
|
8
|
+
|
5
9
|
def initialize(attributes)
|
6
|
-
super
|
10
|
+
super(to_ostruct(attributes.merge(uuid: extract_uuid(attributes))))
|
7
11
|
end
|
8
12
|
|
9
13
|
def to_ostruct(obj)
|
@@ -21,7 +25,7 @@ module Calendlyr
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def get_slug(path)
|
24
|
-
|
28
|
+
Calendlyr::Object.get_slug(path)
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Availabilities::UserSchedule < Object
|
3
|
+
def associated_user
|
4
|
+
client.users.retrieve(uuid: get_slug(user))
|
5
|
+
end
|
6
|
+
|
7
|
+
def availability_rules
|
8
|
+
rules.map do |rule|
|
9
|
+
Availabilities::Rule.new(rule.to_h.merge(client: client))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class EventType < Object
|
3
|
+
def associated_profile
|
4
|
+
EventTypes::Profile.new(profile.to_h.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_share(**params)
|
8
|
+
client.shares.create(**params.merge(event_type: uri))
|
9
|
+
end
|
10
|
+
|
11
|
+
def available_times(start_time:, end_time:, **params)
|
12
|
+
client.event_types.list_available_times(**params.merge(event_type: uri, start_time: start_time, end_time: end_time))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Group < Object
|
3
|
+
def associated_organization
|
4
|
+
Organization.new({"uri" => organization}.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def events(**params)
|
8
|
+
client.events.list(**params.merge(group: uri))
|
9
|
+
end
|
10
|
+
|
11
|
+
def group_relationships(**params)
|
12
|
+
client.groups.list_relationships(**params.merge(group: uri))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Groups::Relationship < Object
|
3
|
+
def associated_organization
|
4
|
+
Organization.new({"uri" => organization}.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def associated_group
|
8
|
+
client.groups.retrieve(uuid: get_slug(group))
|
9
|
+
end
|
10
|
+
|
11
|
+
def associated_owner
|
12
|
+
client.organizations.retrieve_membership(uuid: get_slug(owner.uri))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Organization < Object
|
3
|
+
def activity_logs(**params)
|
4
|
+
client.organizations.activity_log(**params.merge(organization: uri))
|
5
|
+
end
|
6
|
+
|
7
|
+
def events(**params)
|
8
|
+
client.events.list(**params.merge(organization: uri))
|
9
|
+
end
|
10
|
+
|
11
|
+
def event_types(**params)
|
12
|
+
client.event_types.list(**params.merge(organization: uri))
|
13
|
+
end
|
14
|
+
|
15
|
+
def routing_forms(**params)
|
16
|
+
client.routing_forms.list(**params.merge(organization: uri))
|
17
|
+
end
|
18
|
+
|
19
|
+
# Groups
|
20
|
+
def groups(**params)
|
21
|
+
client.groups.list(**params.merge(organization: uri))
|
22
|
+
end
|
23
|
+
|
24
|
+
def group_relationships(**params)
|
25
|
+
client.groups.list_relationships(**params.merge(organization: uri))
|
26
|
+
end
|
27
|
+
|
28
|
+
# Memberships
|
29
|
+
def memberships(**params)
|
30
|
+
client.organizations.list_memberships(**params.merge(organization: uri))
|
31
|
+
end
|
32
|
+
|
33
|
+
def membership(uuid:)
|
34
|
+
client.organizations.retrieve_membership(uuid: uuid)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Webhooks
|
38
|
+
def webhooks(scope:, **params)
|
39
|
+
client.webhooks.list(**params.merge(organization: uri, scope: scope))
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_webhook(url:, events:, scope:, **params)
|
43
|
+
client.webhooks.create(**params.merge(organization: uri, url: url, events: events, scope: scope))
|
44
|
+
end
|
45
|
+
|
46
|
+
def sample_webhook_data(event:, scope:, **params)
|
47
|
+
client.webhooks.sample_webhook_data(event: event, scope: scope, organization: uri, **params)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Invitations
|
51
|
+
def invite_user(email:, **params)
|
52
|
+
client.organizations.invite(**params.merge(organization_uuid: uuid, email: email))
|
53
|
+
end
|
54
|
+
|
55
|
+
def invitations(**params)
|
56
|
+
client.organizations.list_invitations(**params.merge(uuid: uuid))
|
57
|
+
end
|
58
|
+
|
59
|
+
def invitation(invitation_uuid:)
|
60
|
+
client.organizations.retrieve_invitation(org_uuid: uuid, uuid: invitation_uuid)
|
61
|
+
end
|
62
|
+
|
63
|
+
def revoke_invitation(invitation_uuid:)
|
64
|
+
client.organizations.revoke_invitation(org_uuid: uuid, uuid: invitation_uuid)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Organizations::Invitation < Object
|
3
|
+
def associated_organization
|
4
|
+
Organization.new({"uri" => organization}.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def associated_user
|
8
|
+
client.users.retrieve(uuid: get_slug(user))
|
9
|
+
end
|
10
|
+
|
11
|
+
def revoke
|
12
|
+
associated_organization.revoke_invitation(invitation_uuid: uuid)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class Organizations::Membership < Object
|
3
|
+
def associated_organization
|
4
|
+
Organization.new({"uri" => organization}.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def associated_user
|
8
|
+
client.users.retrieve(uuid: get_slug(user.uri))
|
9
|
+
end
|
10
|
+
|
11
|
+
def group_relationships(**params)
|
12
|
+
client.groups.list_relationships(**params.merge(owner: uri))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Calendlyr
|
2
|
+
class RoutingForm < Object
|
3
|
+
def associated_organization
|
4
|
+
Organization.new({"uri" => organization}.merge(client: client))
|
5
|
+
end
|
6
|
+
|
7
|
+
def submissions(**params)
|
8
|
+
client.routing_forms.list_submissions(**params.merge(form: uri))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|