calendlyr 0.3.3

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +34 -0
  3. data/.gitignore +25 -0
  4. data/CHANGELOG.md +32 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +159 -0
  8. data/Rakefile +10 -0
  9. data/bin/console +13 -0
  10. data/bin/setup +8 -0
  11. data/bin/test +6 -0
  12. data/calendly.gemspec +27 -0
  13. data/lib/calendly/client.rb +57 -0
  14. data/lib/calendly/collection.rb +31 -0
  15. data/lib/calendly/error.rb +4 -0
  16. data/lib/calendly/object.rb +27 -0
  17. data/lib/calendly/objects/event_invitees.rb +4 -0
  18. data/lib/calendly/objects/event_types.rb +4 -0
  19. data/lib/calendly/objects/events.rb +4 -0
  20. data/lib/calendly/objects/invitations.rb +11 -0
  21. data/lib/calendly/objects/memberships.rb +7 -0
  22. data/lib/calendly/objects/organizations.rb +27 -0
  23. data/lib/calendly/objects/scheduling_links.rb +4 -0
  24. data/lib/calendly/objects/users.rb +19 -0
  25. data/lib/calendly/objects/webhooks.rb +11 -0
  26. data/lib/calendly/resource.rb +73 -0
  27. data/lib/calendly/resources/data_compliance.rb +7 -0
  28. data/lib/calendly/resources/event_invitees.rb +12 -0
  29. data/lib/calendly/resources/event_types.rb +12 -0
  30. data/lib/calendly/resources/events.rb +12 -0
  31. data/lib/calendly/resources/organizations.rb +33 -0
  32. data/lib/calendly/resources/scheduling_links.rb +8 -0
  33. data/lib/calendly/resources/users.rb +11 -0
  34. data/lib/calendly/resources/webhooks.rb +21 -0
  35. data/lib/calendly/version.rb +3 -0
  36. data/lib/calendly.rb +35 -0
  37. data/test/calendly/client_test.rb +8 -0
  38. data/test/calendly/object_test.rb +21 -0
  39. data/test/calendly/resources/data_compliance.rb +13 -0
  40. data/test/calendly/resources/event_invitees_test.rb +29 -0
  41. data/test/calendly/resources/event_types_test.rb +31 -0
  42. data/test/calendly/resources/events_test.rb +29 -0
  43. data/test/calendly/resources/organizations_test.rb +140 -0
  44. data/test/calendly/resources/scheduling_links.rb +12 -0
  45. data/test/calendly/resources/users_test.rb +79 -0
  46. data/test/calendly/resources/webhooks_test.rb +42 -0
  47. data/test/calendly_test.rb +7 -0
  48. data/test/fixtures/data_compliance/delete_invitee_data.json +1 -0
  49. data/test/fixtures/event_invitees/list.json +58 -0
  50. data/test/fixtures/event_invitees/retrieve.json +38 -0
  51. data/test/fixtures/event_types/list.json +88 -0
  52. data/test/fixtures/event_types/retrieve.json +82 -0
  53. data/test/fixtures/events/list.json +39 -0
  54. data/test/fixtures/events/retrieve.json +33 -0
  55. data/test/fixtures/organizations/invite.json +9 -0
  56. data/test/fixtures/organizations/list_invitations.json +18 -0
  57. data/test/fixtures/organizations/list_memberships.json +26 -0
  58. data/test/fixtures/organizations/remove_user.json +1 -0
  59. data/test/fixtures/organizations/retrieve_invitation.json +12 -0
  60. data/test/fixtures/organizations/retrieve_membership.json +20 -0
  61. data/test/fixtures/organizations/revoke_invitation.json +1 -0
  62. data/test/fixtures/scheduling_links/create.json +7 -0
  63. data/test/fixtures/users/retrieve.json +14 -0
  64. data/test/fixtures/webhooks/create.json +17 -0
  65. data/test/fixtures/webhooks/delete.json +1 -0
  66. data/test/fixtures/webhooks/list.json +23 -0
  67. data/test/fixtures/webhooks/retrieve.json +17 -0
  68. data/test/test_helper.rb +27 -0
  69. metadata +230 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "cancel_url": "https://calendly.com/cancellations/AAAAAAAAAAAAAAAA",
3
+ "created_at": "2020-01-01T20:30:00Z",
4
+ "email": "email@example.com",
5
+ "reschedule_url": "https://calendly.com/reschedulings/AAAAAAAAAAAAAAAA",
6
+ "event": "https://api.calendly.com/scheduled_events/ABCDABCDABCDABCD",
7
+ "name": "John Doe",
8
+ "status": "active",
9
+ "timezone": "America/New_York",
10
+ "updated_at": "2020-01-01T20:30:00Z",
11
+ "uri": "https://api.calendly.com/api/v2/scheduled_events/ABCDABCDABCDABCD/invitees/ABCDABCDABCDABCD",
12
+ "questions_and_answers": [
13
+ {
14
+ "answer": "radio button answer",
15
+ "position": 0,
16
+ "question": "Question with Radio Buttons answer type"
17
+ },
18
+ {
19
+ "answer": "Multiple line\nAnswer",
20
+ "position": 1,
21
+ "question": "Question with Multiple Lines answer type"
22
+ },
23
+ {
24
+ "answer": "Answer 1\nAnswer 2\nAnswer 3",
25
+ "position": 2,
26
+ "question": "Question with Checkboxes answer type"
27
+ }
28
+ ],
29
+ "canceled": false,
30
+ "payment": {
31
+ "external_id": "ch_AAAAAAAAAAAAAAAAAAAAAAAA",
32
+ "provider": "stripe",
33
+ "amount": 1234.56,
34
+ "currency": "USD",
35
+ "terms": "sample terms of payment (up to 1,024 characters)",
36
+ "successful": true
37
+ }
38
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "collection": [
3
+ {
4
+ "uri": "https://api.calendly.com/event_types/AAAAAAAAAAAAAAAA",
5
+ "name": "15 Minute Meeting",
6
+ "active": true,
7
+ "slug": "acmesales",
8
+ "scheduling_url": "https://calendly.com/acmesales",
9
+ "duration": 30,
10
+ "kind": "solo",
11
+ "pooling_type": "round_robin",
12
+ "type": "StandardEventType",
13
+ "color": "#fff200",
14
+ "created_at": "2019-01-02T03:04:05.678Z",
15
+ "updated_at": "2019-08-07T06:05:04.321Z",
16
+ "internal_note": "Internal note",
17
+ "description_plain": "15 Minute Meeting",
18
+ "description_html": "<p>15 Minute Meeting</p>",
19
+ "profile": {
20
+ "type": "User",
21
+ "name": "Tamara Jones",
22
+ "owner": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
23
+ },
24
+ "secret": true,
25
+ "custom_questions": [
26
+ {
27
+ "name": "Company Name",
28
+ "type": "string",
29
+ "position": 0,
30
+ "enabled": true,
31
+ "required": true,
32
+ "answer_choices": [],
33
+ "include_other": false
34
+ },
35
+ {
36
+ "name": "What would you like to discuss?",
37
+ "type": "text",
38
+ "position": 0,
39
+ "enabled": true,
40
+ "required": true,
41
+ "answer_choices": [],
42
+ "include_other": false
43
+ },
44
+ {
45
+ "name": "Number of employees",
46
+ "answer_choices": [
47
+ "1",
48
+ "2-10",
49
+ "11-20",
50
+ "20+"
51
+ ],
52
+ "enabled": true,
53
+ "include_other": true,
54
+ "position": 2,
55
+ "required": false,
56
+ "type": "single_select"
57
+ },
58
+ {
59
+ "name": "Multi-Select Question",
60
+ "answer_choices": [
61
+ "Answer 1",
62
+ "Answer 2",
63
+ "Answer 3",
64
+ "Answer 4"
65
+ ],
66
+ "enabled": true,
67
+ "include_other": true,
68
+ "position": 2,
69
+ "required": false,
70
+ "type": "multi_select"
71
+ },
72
+ {
73
+ "name": "Phone Number",
74
+ "type": "phone_number",
75
+ "position": 0,
76
+ "enabled": true,
77
+ "required": true,
78
+ "answer_choices": [],
79
+ "include_other": false
80
+ }
81
+ ]
82
+ }
83
+ ],
84
+ "pagination": {
85
+ "count": 1,
86
+ "next_page": "https://api.calendly.com/event_types?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
87
+ }
88
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/event_types/AAAAAAAAAAAAAAAA",
4
+ "name": "15 Minute Meeting",
5
+ "active": true,
6
+ "slug": "acmesales",
7
+ "scheduling_url": "https://calendly.com/acmesales",
8
+ "duration": 30,
9
+ "kind": "solo",
10
+ "pooling_type": "round_robin",
11
+ "type": "StandardEventType",
12
+ "color": "#fff200",
13
+ "created_at": "2019-01-02T03:04:05.678Z",
14
+ "updated_at": "2019-08-07T06:05:04.321Z",
15
+ "internal_note": "Internal note",
16
+ "description_plain": "15 Minute Meeting",
17
+ "description_html": "<p>15 Minute Meeting</p>",
18
+ "profile": {
19
+ "type": "User",
20
+ "name": "Tamara Jones",
21
+ "owner": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
22
+ },
23
+ "secret": true,
24
+ "custom_questions": [
25
+ {
26
+ "name": "Company Name",
27
+ "type": "string",
28
+ "position": 0,
29
+ "enabled": true,
30
+ "required": true,
31
+ "answer_choices": [],
32
+ "include_other": false
33
+ },
34
+ {
35
+ "name": "What would you like to discuss?",
36
+ "type": "text",
37
+ "position": 0,
38
+ "enabled": true,
39
+ "required": true,
40
+ "answer_choices": [],
41
+ "include_other": false
42
+ },
43
+ {
44
+ "name": "Number of employees",
45
+ "answer_choices": [
46
+ "1",
47
+ "2-10",
48
+ "11-20",
49
+ "20+"
50
+ ],
51
+ "enabled": true,
52
+ "include_other": true,
53
+ "position": 2,
54
+ "required": false,
55
+ "type": "single_select"
56
+ },
57
+ {
58
+ "name": "Multi-Select Question",
59
+ "answer_choices": [
60
+ "Answer 1",
61
+ "Answer 2",
62
+ "Answer 3",
63
+ "Answer 4"
64
+ ],
65
+ "enabled": true,
66
+ "include_other": true,
67
+ "position": 2,
68
+ "required": false,
69
+ "type": "multi_select"
70
+ },
71
+ {
72
+ "name": "Phone Number",
73
+ "type": "phone_number",
74
+ "position": 0,
75
+ "enabled": true,
76
+ "required": true,
77
+ "answer_choices": [],
78
+ "include_other": false
79
+ }
80
+ ]
81
+ }
82
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "collection": [
3
+ {
4
+ "uri": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2",
5
+ "name": "15 Minute Meeting",
6
+ "status": "active",
7
+ "start_time": "2019-08-24T14:15:22Z",
8
+ "end_time": "2019-08-24T14:15:22Z",
9
+ "event_type": "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
10
+ "location": {
11
+ "type": "physical",
12
+ "location": "Calendly Office"
13
+ },
14
+ "invitees_counter": {
15
+ "total": 0,
16
+ "active": 0,
17
+ "limit": 0
18
+ },
19
+ "created_at": "2019-01-02T03:04:05.678Z",
20
+ "updated_at": "2019-01-02T03:04:05.678Z",
21
+ "event_memberships": [
22
+ {
23
+ "user": "https://api.calendly.com/users/GBGBDCAADAEDCRZ2"
24
+ }
25
+ ],
26
+ "event_guests": [
27
+ {
28
+ "email": "user@example.com",
29
+ "created_at": "2019-08-24T14:15:22Z",
30
+ "updated_at": "2019-08-24T14:15:22Z"
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "pagination": {
36
+ "count": 1,
37
+ "next_page": "https://api.calendly.com/scheduled_events?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
38
+ }
39
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2",
4
+ "name": "15 Minute Meeting",
5
+ "status": "active",
6
+ "start_time": "2019-08-24T14:15:22Z",
7
+ "end_time": "2019-08-24T14:15:22Z",
8
+ "event_type": "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
9
+ "location": {
10
+ "type": "physical",
11
+ "location": "Calendly Office"
12
+ },
13
+ "invitees_counter": {
14
+ "total": 0,
15
+ "active": 0,
16
+ "limit": 0
17
+ },
18
+ "created_at": "2019-01-02T03:04:05.678Z",
19
+ "updated_at": "2019-01-02T03:04:05.678Z",
20
+ "event_memberships": [
21
+ {
22
+ "user": "https://api.calendly.com/users/GBGBDCAADAEDCRZ2"
23
+ }
24
+ ],
25
+ "event_guests": [
26
+ {
27
+ "email": "user@example.com",
28
+ "created_at": "2019-08-24T14:15:22Z",
29
+ "updated_at": "2019-08-24T14:15:22Z"
30
+ }
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "created_at": "2020-01-01T20:30:00Z",
3
+ "email": "email@example.com",
4
+ "last_sent_at": "2020-01-01T20:30:00Z",
5
+ "organization": "https://api.calendly.com/organizations/ABCDABCDABCDABCD",
6
+ "status": "pending",
7
+ "updated_at": "2020-01-01T20:30:00Z",
8
+ "uri": "https://api.calendly.com/organizations/ABCDABCDABCDABCD/invitations/DCBADCBADCBADCBA"
9
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "collection": [
3
+ {
4
+ "uri": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA/invitations",
5
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
6
+ "email": "test@example.com",
7
+ "status": "accepted",
8
+ "created_at": "2019-08-07T06:05:04.321Z",
9
+ "updated_at": "2019-01-02T03:04:05.678Z",
10
+ "last_sent_at": "2019-01-02T03:04:05.678Z",
11
+ "user": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
12
+ }
13
+ ],
14
+ "pagination": {
15
+ "count": 1,
16
+ "next_page": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA/invitations?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
17
+ }
18
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "collection": [
3
+ {
4
+ "uri": "https://api.calendly.com/organization_memberships/AAAAAAAAAAAAAAAA",
5
+ "role": "admin",
6
+ "user": {
7
+ "uri": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
8
+ "name": "John Doe",
9
+ "slug": "acmesales",
10
+ "email": "test@example.com",
11
+ "scheduling_url": "https://calendly.com/acmesales",
12
+ "timezone": "America/New York",
13
+ "avatar_url": "https://01234567890.cloudfront.net/uploads/user/avatar/0123456/a1b2c3d4.png",
14
+ "created_at": "2019-01-02T03:04:05.678Z",
15
+ "updated_at": "2019-08-07T06:05:04.321Z"
16
+ },
17
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
18
+ "updated_at": "2019-08-07T06:05:04.321Z",
19
+ "created_at": "2019-01-02T03:04:05.678Z"
20
+ }
21
+ ],
22
+ "pagination": {
23
+ "count": 1,
24
+ "next_page": "https://api.calendly.com/organization_memberships/AAAAAAAAAAAAAAAA?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA/invitations",
4
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
5
+ "email": "test@example.com",
6
+ "status": "accepted",
7
+ "created_at": "2019-08-07T06:05:04.321Z",
8
+ "updated_at": "2019-01-02T03:04:05.678Z",
9
+ "last_sent_at": "2019-01-02T03:04:05.678Z",
10
+ "user": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
11
+ }
12
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/organization_memberships/AAAAAAAAAAAAAAAA",
4
+ "role": "admin",
5
+ "user": {
6
+ "uri": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
7
+ "name": "John Doe",
8
+ "slug": "acmesales",
9
+ "email": "test@example.com",
10
+ "scheduling_url": "https://calendly.com/acmesales",
11
+ "timezone": "America/New York",
12
+ "avatar_url": "https://01234567890.cloudfront.net/uploads/user/avatar/0123456/a1b2c3d4.png",
13
+ "created_at": "2019-01-02T03:04:05.678Z",
14
+ "updated_at": "2019-08-07T06:05:04.321Z"
15
+ },
16
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
17
+ "updated_at": "2019-08-07T06:05:04.321Z",
18
+ "created_at": "2019-01-02T03:04:05.678Z"
19
+ }
20
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "resource": {
3
+ "booking_url": "https://calendly.com/d/abcd-brv8/15-minute-meeting",
4
+ "owner": "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
5
+ "owner_type": "EventType"
6
+ }
7
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
4
+ "name": "John Doe",
5
+ "slug": "acmesales",
6
+ "email": "test@example.com",
7
+ "scheduling_url": "https://calendly.com/acmesales",
8
+ "timezone": "America/New York",
9
+ "avatar_url": "https://01234567890.cloudfront.net/uploads/user/avatar/0123456/a1b2c3d4.png",
10
+ "created_at": "2019-01-02T03:04:05.678Z",
11
+ "updated_at": "2019-08-07T06:05:04.321Z",
12
+ "current_organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA"
13
+ }
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/webhook_subscriptions/AAAAAAAAAAAAAAAA",
4
+ "callback_url": "https://blah.foo/bar",
5
+ "created_at": "2019-08-24T14:15:22Z",
6
+ "updated_at": "2019-08-24T14:15:22Z",
7
+ "retry_started_at": "2019-08-24T14:15:22Z",
8
+ "state": "active",
9
+ "events": [
10
+ "invitee.created"
11
+ ],
12
+ "scope": "user",
13
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
14
+ "user": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
15
+ "creator": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,23 @@
1
+ {
2
+ "collection": [
3
+ {
4
+ "uri": "https://api.calendly.com/webhook_subscriptions/AAAAAAAAAAAAAAAA",
5
+ "callback_url": "https://blah.foo/bar",
6
+ "created_at": "2019-08-24T14:15:22Z",
7
+ "updated_at": "2019-08-24T14:15:22Z",
8
+ "retry_started_at": "2019-08-24T14:15:22Z",
9
+ "state": "active",
10
+ "events": [
11
+ "invitee.created"
12
+ ],
13
+ "scope": "user",
14
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
15
+ "user": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
16
+ "creator": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
17
+ }
18
+ ],
19
+ "pagination": {
20
+ "count": 1,
21
+ "next_page": "https://api.calendly.com/webhook_subscriptions?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
22
+ }
23
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "resource": {
3
+ "uri": "https://api.calendly.com/webhook_subscriptions/AAAAAAAAAAAAAAAA",
4
+ "callback_url": "https://blah.foo/bar",
5
+ "created_at": "2019-08-24T14:15:22Z",
6
+ "updated_at": "2019-08-24T14:15:22Z",
7
+ "retry_started_at": "2019-08-24T14:15:22Z",
8
+ "state": "active",
9
+ "events": [
10
+ "invitee.created"
11
+ ],
12
+ "scope": "user",
13
+ "organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA",
14
+ "user": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
15
+ "creator": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA"
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
+
3
+ require "simplecov"
4
+ SimpleCov.start
5
+ if ENV["CI"] == "true"
6
+ require "codecov"
7
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
+ end
9
+ require "calendly"
10
+ require "minitest/autorun"
11
+ require "webmock/minitest"
12
+
13
+ class Minitest::Test
14
+ def client
15
+ Calendly::Client.new(api_key: "fake")
16
+ end
17
+
18
+ def fixture_file(fixture)
19
+ File.read("test/fixtures/#{fixture}.json")
20
+ end
21
+
22
+ def stub(path:, method: :get, body: {}, response: {})
23
+ stub_req = stub_request(method, "#{Calendly::Client::BASE_URL}/#{path}")
24
+ stub_req.with(body: body) if [:post, :put, :patch].include?(method)
25
+ stub_req.to_return(**response)
26
+ end
27
+ end