calendlyr 0.7.5 → 0.10.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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +9 -5
  3. data/.gitignore +2 -1
  4. data/CHANGELOG.md +60 -0
  5. data/README.md +31 -79
  6. data/calendlyr.gemspec +4 -5
  7. data/docs/resources/data_compliance.md +1 -1
  8. data/docs/resources/event_types/availability_schedule.md +28 -0
  9. data/docs/resources/event_types/event_type.md +18 -7
  10. data/docs/resources/events/cancellation.md +1 -1
  11. data/docs/resources/events/event.md +2 -2
  12. data/docs/resources/events/invitee.md +17 -0
  13. data/docs/resources/locations/location.md +16 -0
  14. data/docs/resources/organizations/organization.md +0 -9
  15. data/docs/resources/share.md +2 -9
  16. data/docs/resources/webhooks/invitee_payload.md +1 -1
  17. data/docs/resources/webhooks/payload.md +1 -1
  18. data/docs/resources/webhooks/subscription.md +1 -1
  19. data/lib/calendlyr/client.rb +6 -2
  20. data/lib/calendlyr/collection.rb +18 -3
  21. data/lib/calendlyr/error.rb +17 -26
  22. data/lib/calendlyr/object.rb +77 -14
  23. data/lib/calendlyr/objects/event_type.rb +0 -4
  24. data/lib/calendlyr/objects/event_types/availability_schedule.rb +8 -0
  25. data/lib/calendlyr/objects/events/invitee.rb +1 -1
  26. data/lib/calendlyr/objects/location.rb +4 -0
  27. data/lib/calendlyr/objects/organization.rb +0 -4
  28. data/lib/calendlyr/objects/share.rb +0 -5
  29. data/lib/calendlyr/resource.rb +34 -7
  30. data/lib/calendlyr/resources/event_types.rb +16 -7
  31. data/lib/calendlyr/resources/events.rb +5 -0
  32. data/lib/calendlyr/resources/locations.rb +8 -0
  33. data/lib/calendlyr/resources/webhooks.rb +0 -4
  34. data/lib/calendlyr/version.rb +1 -1
  35. data/lib/calendlyr.rb +4 -5
  36. data/test/calendlyr/client_test.rb +14 -0
  37. data/test/calendlyr/collection_test.rb +64 -0
  38. data/test/calendlyr/object_test.rb +32 -1
  39. data/test/calendlyr/objects/event_type_test.rb +0 -15
  40. data/test/calendlyr/objects/event_types/availability_schedule_test.rb +20 -0
  41. data/test/calendlyr/objects/events/cancellation_test.rb +1 -1
  42. data/test/calendlyr/objects/events/guest_test.rb +1 -1
  43. data/test/calendlyr/objects/events/invitee_no_show_test.rb +1 -1
  44. data/test/calendlyr/objects/events/invitee_test.rb +10 -3
  45. data/test/calendlyr/objects/location_test.rb +22 -0
  46. data/test/calendlyr/objects/organization_test.rb +0 -8
  47. data/test/calendlyr/objects/organizations/invitation_test.rb +1 -1
  48. data/test/calendlyr/objects/share_test.rb +3 -9
  49. data/test/calendlyr/resource_test.rb +170 -2
  50. data/test/calendlyr/resources/data_compliance_test.rb +1 -4
  51. data/test/calendlyr/resources/event_types_test.rb +48 -0
  52. data/test/calendlyr/resources/events_test.rb +19 -0
  53. data/test/calendlyr/resources/locations_test.rb +18 -0
  54. data/test/calendlyr/resources/webhooks_test.rb +0 -8
  55. data/test/fixtures/event_invitees/retrieve.json +11 -1
  56. data/test/fixtures/event_type_availability_schedules/list.json +17 -0
  57. data/test/fixtures/event_type_availability_schedules/update.json +3 -0
  58. data/test/fixtures/event_types/create.json +30 -0
  59. data/test/fixtures/event_types/update.json +30 -0
  60. data/test/fixtures/events/create_invitee.json +37 -0
  61. data/test/fixtures/events/retrieve.json +12 -2
  62. data/test/fixtures/locations/list.json +16 -0
  63. data/test/fixtures/objects/event.json +10 -2
  64. data/test/fixtures/objects/event_types/availability_schedule.json +6 -0
  65. data/test/fixtures/objects/location.json +5 -0
  66. data/test/test_helper.rb +9 -7
  67. metadata +32 -50
  68. data/docs/resources/event_types/available_time.md +0 -21
  69. data/docs/resources/event_types/membership.md +0 -29
  70. data/docs/resources/scheduling_link.md +0 -26
  71. data/lib/calendlyr/objects/event_types/available_time.rb +0 -4
  72. data/lib/calendlyr/objects/event_types/membership.rb +0 -11
  73. data/lib/calendlyr/objects/scheduling_link.rb +0 -9
  74. data/lib/calendlyr/resources/outgoing_communications.rb +0 -8
  75. data/lib/calendlyr/resources/scheduling_links.rb +0 -8
  76. data/test/calendlyr/objects/event_types/available_time_test.rb +0 -20
  77. data/test/calendlyr/objects/event_types/membership_test.rb +0 -32
  78. data/test/calendlyr/objects/scheduling_link_test.rb +0 -17
  79. data/test/calendlyr/resources/event_types/membership_test.rb +0 -22
  80. data/test/calendlyr/resources/outgoing_communications_test.rb +0 -16
  81. data/test/calendlyr/resources/scheduling_links_test.rb +0 -15
  82. data/test/fixtures/event_type_available_times/list.json +0 -22
  83. data/test/fixtures/objects/event_types/available_time.json +0 -6
  84. data/test/fixtures/objects/event_types/membership.json +0 -65
  85. data/test/fixtures/objects/scheduling_links/event_type.json +0 -5
  86. data/test/fixtures/outgoing_communications/list.json +0 -26
  87. data/test/fixtures/scheduling_links/create.json +0 -7
  88. data/test/fixtures/webhooks/sample.json +0 -105
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d69cdfb2373e6ecbed4936f15670331a83b20816bd77e9aec6c166e43d47cde3
4
- data.tar.gz: ebe3df79b6d23e1e6539d63c0bf447396aa80037304f765b04414cf4e862a745
3
+ metadata.gz: 201abcc548a1e1a59386fefc1416cf05e91dc28c83e7cc057c7a5c207eef4f1d
4
+ data.tar.gz: 94aee4dc1740d031eea51a32309225340178ee2ec59fdcf4987b7413eacb8bd2
5
5
  SHA512:
6
- metadata.gz: a3c733ada27c62a49fd5f2644ae2d0e6861c4c5e50b287b0e4173d7873a5e7f2cb83c37c3cde5509551bdea6c13b2d1c6469922c5a632076423c6f5aa8d26199
7
- data.tar.gz: b6554a78bffea8609e5871f1c16e617997bcba34e2c348b285e1b5d27140a22009d91674dece47e37513fe6e7155c035654a49abd7713e211c0a64881e29b44c
6
+ metadata.gz: 7837b5d47c2e989c5d2221e344269713427efd21639a8b5a23ff7a85e0a8baff2eebfa028469c1e17d1bb353eac2dfb5346747de63653d564c312d03cb3dd77a
7
+ data.tar.gz: d13ae93dd51ac622139c19c2bbd9e328a8dd2275c5a1fcce3b825a08291b33139831ddae74256a1a39a2d25f9d541bf5b6656ab8b293b54d717302812f0c7ec5
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby: ["2.7", "3.0", "3.2", "3.3"]
14
+ ruby: ["3.2", "3.3", "3.4", "4.0"]
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v4
@@ -27,7 +27,11 @@ jobs:
27
27
  run: bundle exec standardrb
28
28
 
29
29
  - name: Run tests
30
- run: |
31
- bundle exec rake test
32
- env:
33
- CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
30
+ run: bundle exec rake test
31
+
32
+ - name: Upload coverage
33
+ if: matrix.ruby == '3.4'
34
+ uses: codecov/codecov-action@v4
35
+ with:
36
+ token: ${{ secrets.CODECOV_TOKEN }}
37
+ files: coverage/.resultset.json
data/.gitignore CHANGED
@@ -22,4 +22,5 @@ tmp
22
22
  mkmf.log
23
23
  vendor
24
24
  .idea/
25
- bin/my_console
25
+ bin/my_console
26
+ .atl/*
data/CHANGELOG.md CHANGED
@@ -2,6 +2,66 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.10.0]
6
+
7
+ ### Added
8
+ * `client.data_compliance.delete_scheduled_event_data` — Remove scheduled events data within a time range (`POST /data_compliance/deletion/events`)
9
+ * `put_request` support in `Resource` base class for PUT HTTP verb
10
+ * `Collection` now includes `Enumerable` — use `each`, `map`, `select` directly on collections
11
+ * Configurable HTTP timeouts via `Client.new(token:, open_timeout:, read_timeout:)` (default 30s)
12
+ * Automatic retry with exponential backoff for 429 Too Many Requests (max 3 retries, respects `Retry-After` header)
13
+
14
+ ### Changed — Breaking
15
+ * **`Calendlyr::Object`** no longer inherits from `OpenStruct`. Replaced with a zero-dependency hash-backed class. Dynamic dot-access for all API fields is preserved. If you were relying on `OpenStruct`-specific methods (e.g., `marshal_dump`), this is a breaking change.
16
+ * Empty API responses (e.g., DELETE) now return `{}` instead of `true`
17
+ * Requires Ruby >= 3.2.0 (dropped support for Ruby 2.4–3.1)
18
+
19
+ ### Fixed
20
+ * **Security:** Removed `OpenSSL::SSL::VERIFY_NONE` — SSL connections now properly verify certificates
21
+ * **Security:** Bare `rescue` replaced with `rescue JSON::ParserError` — non-JSON errors are no longer silently swallowed
22
+ * `Invitee#cancel` now correctly uses the event UUID instead of the invitee UUID
23
+ * `CGI.parse` replaced with `URI.decode_www_form` for Ruby 4.0 compatibility
24
+ * Tautological test assertions (`assert` with string literal) replaced with `assert_equal`
25
+
26
+ ### Removed
27
+ * `codecov` gem dependency (deprecated since Feb 2022, incompatible with Ruby 4.0). Coverage uploads now use `codecov-action` in CI.
28
+
29
+ [0.10.0]: https://github.com/araluce/calendlyr/compare/v0.9.0...v0.10.0
30
+
31
+ ## [0.9.0]
32
+
33
+ ### Added
34
+ * `client.event_types.create` — Create standard event types (`POST /event_types`)
35
+ * `client.event_types.update` — Update existing event types (`PATCH /event_types/:uuid`)
36
+ * `client.event_types.list_availability_schedules` — List availability schedules for an event type (`GET /event_type_availability_schedules`)
37
+ * `client.event_types.update_availability_schedule` — Update availability schedules (`PATCH /event_type_availability_schedules`)
38
+ * `client.locations.list` — List host's connected locations: Zoom, Google Meet, etc. (`GET /locations`)
39
+ * `client.events.create_invitee` — Programmatically book events via the Scheduling API (`POST /invitees`)
40
+ * `patch_request` support in `Resource` base class for PATCH HTTP verb
41
+
42
+ ### Changed
43
+ * Updated `Event` fixtures with `buffered_start_time`, `buffered_end_time`, `meeting_notes_plain`, `meeting_notes_html`, and `cancellation` fields
44
+ * Updated `Invitee` fixtures with `no_show`, `reconfirmation`, `scheduling_method`, and `invitee_scheduled_by` fields
45
+
46
+ ### Removed — Breaking
47
+ * **`client.outgoing_communications`** — `OutgoingCommunicationsResource` removed (endpoint no longer in Calendly API docs)
48
+ * **`client.scheduling_links`** — `SchedulingLinksResource` and `SchedulingLink` object removed (endpoint no longer in Calendly API docs)
49
+ * **`client.webhooks.sample_webhook_data`** — Method removed (endpoint no longer in Calendly API docs)
50
+ * **`client.event_types.list_available_times`** — Method and `EventTypes::AvailableTime` object removed (endpoint no longer in Calendly API docs)
51
+ * **`client.event_types.list_memberships`** — Method and `EventTypes::Membership` object removed (endpoint no longer in Calendly API docs)
52
+ * **`EventType#available_times`** — Convenience method removed (delegates to removed `list_available_times`)
53
+ * **`Share#associated_scheduling_links`** — Method removed (depends on removed `SchedulingLink`)
54
+ * **`Organization#sample_webhook_data`** — Convenience method removed (delegates to removed `webhooks.sample_webhook_data`)
55
+
56
+ [0.9.0]: https://github.com/araluce/calendlyr/compare/v0.8.0...v0.9.0
57
+
58
+ ## [0.8.0]
59
+ * **Breaking:** All error classes (`BadRequest`, `NotFound`, `Unauthenticated`, `PermissionDenied`, `ExternalCalendarError`, `TooManyRequests`, `InternalServerError`) now inherit from `Calendlyr::Error` instead of `StandardError`. Code using `rescue Calendlyr::Error` will now catch all API errors.
60
+ * Fix: Response handling with empty body
61
+ * Fix: Some doc typos
62
+
63
+ [0.8.0]: https://github.com/araluce/calendlyr/compare/v0.7.5...v0.8.0
64
+
5
65
  ## [0.7.5]
6
66
  * Fix: Calendlyr::TooManyRequests was not included in autoloading list
7
67
  * Fix: Calendlyr::ExternalCalendarError typo in class name
data/README.md CHANGED
@@ -1,90 +1,48 @@
1
- [![](https://img.shields.io/github/license/araluce/calendlyr?kill_cache=1)](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
2
- [![](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg?kill_cache=1)](https://github.com/araluce/calendlyr/actions)
3
- [![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y&kill_cache=1)](https://codecov.io/gh/araluce/calendlyr)
4
- ![Gem Downloads (for specified version)](https://img.shields.io/gem/dt/calendlyr)
1
+ [![](https://img.shields.io/github/license/araluce/calendlyr)](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
2
+ [![](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)](https://github.com/araluce/calendlyr/actions)
3
+ [![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y)](https://codecov.io/gh/araluce/calendlyr)
4
+ ![Gem Downloads](https://img.shields.io/gem/dt/calendlyr)
5
5
 
6
- # Calendly API Rubygem
6
+ # Calendlyr
7
7
 
8
- Easy and comprehensive rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).
8
+ The simplest way to interact with [Calendly's API v2](https://developer.calendly.com/api-docs) in Ruby. No dependencies, no complexity — just a Personal Access Token and you're good to go.
9
9
 
10
- You just need a Personal Access Token.
10
+ ## Installation
11
11
 
12
- ## Dependencies
13
-
14
- No dependencies :tada:
15
-
16
- We understand the importance of not adding unwanted dependencies.
17
-
18
- ## 📚 Docs
19
-
20
- ### Installation
21
-
22
- Add this line to your application's Gemfile:
12
+ Add to your Gemfile:
23
13
 
24
14
  ```ruby
25
- gem 'calendlyr', '0.7.5'
15
+ gem "calendlyr"
26
16
  ```
27
17
 
28
- And then execute:
29
-
30
- $ bundle
18
+ Then run `bundle install`. That's it.
31
19
 
32
- Or install it yourself as:
20
+ ## Quick Start
33
21
 
34
- $ gem install calendlyr
22
+ ```ruby
23
+ client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
35
24
 
36
- ### Usage
25
+ # List your scheduled events
26
+ events = client.events.list(user: "https://api.calendly.com/users/YOUR_USER_UUID")
27
+ events.data
28
+ #=> [#<Calendlyr::Event>, #<Calendlyr::Event>, ...]
37
29
 
38
- To access the API, you'll need to create a `Calendlyr::Client` and provide your token. You can generate your Personal Access Token at [https://calendly.com/integrations/api_webhooks](https://calendly.com/integrations/api_webhooks)
30
+ # Access event details naturally
31
+ event = events.data.first
32
+ event.name #=> "30 Minute Meeting"
33
+ event.status #=> "active"
34
+ event.start_time #=> "2024-01-15T10:00:00.000000Z"
39
35
 
40
- ```ruby
41
- client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
36
+ # List invitees for an event
37
+ invitees = client.events.list_invitees(uuid: event.uuid)
38
+ invitees.data.first.email #=> "john@example.com"
42
39
  ```
43
40
 
44
- The client then provides access to all of the resources.
45
-
46
- ### Resources
47
-
48
- The gem is designed to closely mirror the Calendly API, making it easy to convert API examples into gem code
49
-
50
- Responses are created as objects, like `Calendlyr::Event`. Having types like `Calendlyr::User` is useful for understanding the type of object you're working with. These objects are built using `OpenStruct`, allowing you to access data in a Ruby-like way.
51
-
52
- * [Pagination](docs/resources/pagination.md)
53
- * **Activity Log**
54
- * [Calendlyr::ActivityLog](docs/resources/activity_log/list_activity_log_entries.md)
55
- * **Availabilities**
56
- * [Calendlyr::Availabilities::Rule](docs/resources/availabilities/availability_rule.md)
57
- * [Calendlyr::Availabilities::UserSchedule](docs/resources/availabilities/user_availability_schedule.md)
58
- * [Calendlyr::Availabilities::UserBusyTime](docs/resources/availabilities/user_busy_time.md)
59
- * [Data Compliance](docs/resources/data_compliance.md)
60
- * **Event Types**
61
- * [Calendlyr::EventType](docs/resources/event_types/event_type.md)
62
- * [Calendlyr::EventTypes::AvailableTime](docs/resources/event_types/available_time.md)
63
- * [Calendlyr::EventTypes::Membership](docs/resources/event_types/membership.md)
64
- * [Calendlyr::EventTypes::Profile](docs/resources/event_types/profile.md)
65
- * **Groups**
66
- * [Calendlyr::Group](docs/resources/groups/group.md)
67
- * [Calendlyr::Groups::Relationship](docs/resources/groups/relationship.md)
68
- * **Organizations**
69
- * [Calendlyr::Organization](docs/resources/organizations/organization.md)
70
- * [Calendlyr::Organizations::Invitation](docs/resources/organizations/invitation.md)
71
- * [Calendlyr::Organizations::Membership](docs/resources/organizations/membership.md)
72
- * **Routing Forms**
73
- * [Calendlyr::RoutingForm](docs/resources/routing_forms/routing_form.md)
74
- * [Calendlyr::RoutingForms::Submission](docs/resources/routing_forms/submission.md)
75
- * **Schedule Events**
76
- * [Calendlyr::Event](docs/resources/events/event.md)
77
- * [Calendlyr::Events::Cancellation](docs/resources/events/cancellation.md)
78
- * [Calendlyr::Events::Guest](docs/resources/events/guest.md)
79
- * [Calendlyr::Events::Invitee](docs/resources/events/invitee.md)
80
- * [Calendlyr::Events::InviteeNoShow](docs/resources/events/invitee_no_show.md)
81
- * [Scheduled Links](docs/resources/scheduling_link.md)
82
- * [Shares](docs/resources/share.md)
83
- * [Users](docs/resources/user.md)
84
- * **Webhooks**
85
- * [Calendlyr::Webhooks::Subscription](docs/resources/webhooks/subscription.md)
86
- * [Calendlyr::Webhooks::Payload](docs/resources/webhooks/payload.md)
87
- * [Calendlyr::Webhooks::InviteePayload](docs/resources/webhooks/invitee_payload.md)
41
+ The gem mirrors the Calendly API closely, so converting API examples into gem code is straightforward. Responses are wrapped in Ruby objects with dot-access for every field.
42
+
43
+ ## Documentation
44
+
45
+ For the full list of available resources and methods, check out the [API Reference](docs/resources/).
88
46
 
89
47
  ## Contributing
90
48
 
@@ -94,10 +52,4 @@ Responses are created as objects, like `Calendlyr::Event`. Having types like `Ca
94
52
  4. Push to the branch (`git push origin my-new-feature`)
95
53
  5. Create a new Pull Request
96
54
 
97
- When adding resources, update the list of resources in `lib/calendlyr`. Additionally, write a spec and include it in the list in the README
98
-
99
- ## Thanks
100
-
101
- Many thanks to[@markets](https://github.com/markets) (our behind-the-scenes contributor) for all the comments, insights, and tips on this Ruby gem project, and for helping me grow professionally day by day :raised_hands:
102
-
103
- Thanks also to [@excid3](https://github.com/excid3) and his [Vultr.rb](https://github.com/excid3/vultr.rb) rubygem project.
55
+ When adding resources, please write tests and update the [docs](docs/resources/).
data/calendlyr.gemspec CHANGED
@@ -10,17 +10,16 @@ Gem::Specification.new do |spec|
10
10
  spec.description = "Ruby bindings for Calendly API. Calendly APIs can be found here: https://calendly.stoplight.io/docs/api-docs/"
11
11
  spec.homepage = "https://github.com/araluce/calendlyr"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
14
14
  spec.metadata["homepage_uri"] = spec.homepage
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "rake", "~> 13.2"
21
20
  spec.add_development_dependency "minitest", "~> 5.25"
22
- spec.add_development_dependency "standard", "~> 1.37" # Max version that supports Ruby 2.7
23
- spec.add_development_dependency "webmock", "~> 3.23"
24
- spec.add_development_dependency "codecov", "~> 0.6"
21
+ spec.add_development_dependency "rake", "~> 13.2"
25
22
  spec.add_development_dependency "simplecov", "~> 0.21"
23
+ spec.add_development_dependency "standard", "~> 1.37"
24
+ spec.add_development_dependency "webmock", "~> 3.23"
26
25
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Delete Invitee Data
4
4
 
5
- Remove invitee data from all previously booked events in your organization..
5
+ Remove invitee data from all previously booked events in your organization.
6
6
  Visit official [API Doc](https://developer.calendly.com/api-docs/4cf896120a018-delete-invitee-data)
7
7
 
8
8
  ```ruby
@@ -0,0 +1,28 @@
1
+ # Availability Schedule Calendlyr::EventTypes::AvailabilitySchedule
2
+
3
+ Availability schedule object for event types.
4
+
5
+ ## Client requests
6
+
7
+ ### List
8
+
9
+ Returns a list of availability schedules for an event type.
10
+
11
+ ```ruby
12
+ client.event_types.list_availability_schedules(event_type_uuid: event_type_uuid)
13
+ #=> #<Calendlyr::Collection @data=[#<Calendlyr::EventTypes::AvailabilitySchedule>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
14
+ ```
15
+
16
+ ### Update
17
+
18
+ Updates availability schedules for an event type.
19
+
20
+ ```ruby
21
+ client.event_types.update_availability_schedule(
22
+ event_type_uuid: event_type_uuid,
23
+ availability_schedules: [
24
+ {start_time: "2023-10-27T09:00:00Z", end_time: "2023-10-27T12:00:00Z"}
25
+ ]
26
+ )
27
+ #=> {"message"=>"Availability schedules updated successfully."}
28
+ ```
@@ -31,6 +31,24 @@ client.event_types.list(organization: @organization)
31
31
  #=> #<Calendlyr::Collection @data=[#<Calendlyr::EventType>, ...], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
32
32
  ```
33
33
 
34
+ ### Create
35
+
36
+ Creates a new Event Type.
37
+
38
+ ```ruby
39
+ client.event_types.create(name: "30 Minute Meeting", duration: 30, pooling_type: "round_robin")
40
+ #=> #<Calendlyr::EventType>
41
+ ```
42
+
43
+ ### Update
44
+
45
+ Updates an Event Type.
46
+
47
+ ```ruby
48
+ client.event_types.update(uuid: @uuid, name: "Updated Meeting", duration: 45)
49
+ #=> #<Calendlyr::EventType>
50
+ ```
51
+
34
52
  ## Object methods
35
53
 
36
54
  ### Associated Profile
@@ -46,10 +64,3 @@ event_type.associated_profile
46
64
  event_type.create_share
47
65
  #=> #<Calendlyr::Share>
48
66
  ```
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
- ```
@@ -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 bussy")
16
+ client.events.cancel(uuid: event_uuid, reason: "I'm busy")
17
17
  #=> #<Calendlyr::Events::Cancellation>
18
18
  ```
@@ -41,7 +41,7 @@ Cancels specified event.
41
41
  Visit official [API Doc](https://developer.calendly.com/api-docs/afb2e9fe3a0a0-cancel-event)
42
42
 
43
43
  ```ruby
44
- client.events.cancel(uuid: event_uuid, reason: "I'm bussy")
44
+ client.events.cancel(uuid: event_uuid, reason: "I'm busy")
45
45
  #=> #<Calendlyr::Events::Cancellation>
46
46
  ```
47
47
 
@@ -57,6 +57,6 @@ event.memberships
57
57
  ### Cancel
58
58
 
59
59
  ```ruby
60
- event.cancel(reason: "I'm bussy")
60
+ event.cancel(reason: "I'm busy")
61
61
  #=> #<Calendlyr::Events::Cancellation>
62
62
  ```
@@ -26,3 +26,20 @@ 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
+ client.events.create_invitee(
36
+ event_type: event_type_uri,
37
+ start_time: "2019-08-07T06:05:04.321123Z",
38
+ invitee: {
39
+ name: "John Doe",
40
+ email: "test@example.com",
41
+ timezone: "America/New_York"
42
+ }
43
+ )
44
+ #=> #<Calendlyr::Events::Invitee>
45
+ ```
@@ -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
+ ```
@@ -103,15 +103,6 @@ organization.create_webhook(url:, url, events: events, scope: scope)
103
103
  #=> #<Calendlyr::Webhooks::Subscription>
104
104
  ```
105
105
 
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
106
  ### Invite user
116
107
 
117
108
  For the example bellow we will use only required parameters, but you can use any other parameter as well.
@@ -1,6 +1,6 @@
1
- # Share Calendlyr::Schare
1
+ # Share Calendlyr::Share
2
2
 
3
- Schare Object.
3
+ Share Object.
4
4
 
5
5
  Visit official [API Doc](https://developer.calendly.com/api-docs/0069948603238-share)
6
6
 
@@ -19,10 +19,3 @@ client.shares.create(create: event_type_uri, name: "15 minute meeting", duration
19
19
  ```
20
20
 
21
21
  ## Object methods
22
-
23
- ### Associated Scheduling Links
24
-
25
- ```ruby
26
- share.associated_scheduling_links
27
- #=> [#<Calendlyr::SchedulingLink>]
28
- ```
@@ -1,4 +1,4 @@
1
- # Webhook Invitee Payload Calendlyr::Wehooks::InviteePayload
1
+ # Webhooks Invitee Payload Calendlyr::Wehooks::InviteePayload
2
2
 
3
3
  The payload that is sent via Webhook when an invitee creates or schedules a meeting, and when an invitee cancels.
4
4
 
@@ -1,4 +1,4 @@
1
- # Webhook Payload Calendlyr::Wehooks::Payload
1
+ # Webhooks Payload Calendlyr::Wehooks::Payload
2
2
 
3
3
  Webhook Payload Object
4
4
 
@@ -1,4 +1,4 @@
1
- # Webhook Subscription Calendlyr::Wehooks::Subscription
1
+ # Webhooks Subscription Calendlyr::Wehooks::Subscription
2
2
 
3
3
  Webhook Subscription Object.
4
4
 
@@ -1,11 +1,15 @@
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
6
8
 
7
- def initialize(token:)
9
+ def initialize(token:, open_timeout: DEFAULT_OPEN_TIMEOUT, read_timeout: DEFAULT_READ_TIMEOUT)
8
10
  @token = token
11
+ @open_timeout = open_timeout
12
+ @read_timeout = read_timeout
9
13
  end
10
14
 
11
15
  def me(force_reload: false)
@@ -1,9 +1,10 @@
1
1
  require "uri"
2
- require "cgi"
3
2
 
4
3
  module Calendlyr
5
4
  class Collection
6
- attr_reader :data, :count, :next_page, :next_page_token, :client
5
+ include Enumerable
6
+
7
+ attr_reader :data, :next_page, :next_page_token, :client
7
8
 
8
9
  def self.from_response(response, type:, client:)
9
10
  new(
@@ -22,13 +23,27 @@ module Calendlyr
22
23
  @client = client
23
24
  end
24
25
 
26
+ def each(&)
27
+ data.each(&)
28
+ end
29
+
30
+ def count(*args, &block)
31
+ if block || args.any?
32
+ super
33
+ else
34
+ @count
35
+ end
36
+ end
37
+
25
38
  private
26
39
 
27
40
  def get_params(url)
28
41
  return {} unless url
29
42
 
30
43
  uri = URI.parse(url)
31
- CGI.parse(uri.query)
44
+ return {} unless uri.query
45
+
46
+ URI.decode_www_form(uri.query).to_h { |k, v| [k, [v]] }
32
47
  end
33
48
  end
34
49
  end
@@ -1,33 +1,23 @@
1
1
  module Calendlyr
2
2
  class Error < StandardError; end
3
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 ExternalCalendarError < StandardError; end
15
-
16
- class InternalServerError < StandardError; end
17
-
18
- class TooManyRequests < StandardError; end
4
+ class PaymentRequired < Error; end
5
+
6
+ ERROR_TYPES = {
7
+ "400" => "BadRequest",
8
+ "401" => "Unauthenticated",
9
+ "403" => "PermissionDenied",
10
+ "404" => "NotFound",
11
+ "424" => "ExternalCalendarError",
12
+ "429" => "TooManyRequests",
13
+ "500" => "InternalServerError"
14
+ }
15
+
16
+ ERROR_TYPES.values.each do |error_class|
17
+ Calendlyr.const_set(error_class, Class.new(Error))
18
+ end
19
19
 
20
20
  class ResponseErrorHandler
21
- ERROR_TYPES = {
22
- "400" => BadRequest,
23
- "401" => Unauthenticated,
24
- "403" => PermissionDenied,
25
- "404" => NotFound,
26
- "424" => ExternalCalendarError,
27
- "429" => TooManyRequests,
28
- "500" => InternalServerError
29
- }
30
-
31
21
  def initialize(code, body)
32
22
  @code = code
33
23
  @body = body
@@ -44,7 +34,8 @@ module Calendlyr
44
34
  def error_type
45
35
  return PaymentRequired if @code == "403" && @body["message"].include?("upgrade")
46
36
 
47
- ERROR_TYPES[@code]
37
+ klass = "Calendlyr::#{Calendlyr::ERROR_TYPES[@code]}"
38
+ Calendlyr.const_get(klass)
48
39
  end
49
40
 
50
41
  def too_many_requests_error