calendlyr 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +12 -12
- data/docs/resources/pagination.md +1 -1
- data/lib/calendlyr/error.rb +8 -7
- data/lib/calendlyr/resource.rb +1 -1
- data/lib/calendlyr/version.rb +1 -1
- data/test/fixtures/resources/424.json +1 -4
- data/test/fixtures/resources/429.json +4 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d08b30cddb6172f8941fa8c8841a6dacb46754187c8c2b03292298b92a0e0d
|
4
|
+
data.tar.gz: 3ba42d35d1d5e7cb9c97d7cb59eacfc32daea9e07581109bc5023309702d669b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b624f9496806b7058589d2775424b7a7f117c0679c484c5178be7b7a185ce6ca60bb6717d740ce57e6177f399ae5eb13bd35c0858ef0b71abefa452d3a56d40
|
7
|
+
data.tar.gz: 027d776e027168addd7e5d13330eb3a5a88cf7c7aa41c3f8703afe88d215c0d654871935cb679067fe90e266d925745f39100a79276f57c7bca4673e970877d3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.7.1]
|
6
|
+
* Adding support for 429 responses from Calendly API
|
7
|
+
|
8
|
+
[0.7.1]: https://github.com/araluce/calendlyr/compare/v0.7.0...v0.7.1
|
9
|
+
|
5
10
|
## [0.7.0]
|
6
11
|
* First real usable release :tada:
|
7
12
|
|
data/README.md
CHANGED
@@ -3,18 +3,19 @@
|
|
3
3
|
[![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y)](https://codecov.io/gh/araluce/calendlyr)
|
4
4
|
![example workflow](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/calendlyr.svg)](https://badge.fury.io/rb/calendlyr)
|
6
|
+
![Gem Downloads (for specified version)](https://img.shields.io/gem/dv/calendlyr/0.7.2)
|
6
7
|
|
7
8
|
# Calendly API Rubygem
|
8
9
|
|
9
|
-
Easy and
|
10
|
+
Easy and comprehensive rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).
|
10
11
|
|
11
|
-
|
12
|
+
You just need a Personal Access Token.
|
12
13
|
|
13
14
|
## Dependencies
|
14
15
|
|
15
16
|
No dependencies :tada:
|
16
17
|
|
17
|
-
We
|
18
|
+
We understand the importance of not adding unwanted dependencies.
|
18
19
|
|
19
20
|
## 📚 Docs
|
20
21
|
|
@@ -23,7 +24,7 @@ We know about the importance of not add dependencies that you don't want.
|
|
23
24
|
Add this line to your application's Gemfile:
|
24
25
|
|
25
26
|
```ruby
|
26
|
-
gem 'calendlyr', '0.7.
|
27
|
+
gem 'calendlyr', '0.7.2'
|
27
28
|
```
|
28
29
|
|
29
30
|
And then execute:
|
@@ -36,20 +37,19 @@ Or install it yourself as:
|
|
36
37
|
|
37
38
|
### Usage
|
38
39
|
|
39
|
-
To access the API, you'll need to create a `Calendlyr::Client` and
|
40
|
+
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)
|
40
41
|
|
41
42
|
```ruby
|
42
43
|
client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
|
43
44
|
```
|
44
45
|
|
45
|
-
The client then
|
46
|
-
|
46
|
+
The client then provides access to all of the resources.
|
47
47
|
|
48
48
|
### Resources
|
49
49
|
|
50
|
-
The gem
|
50
|
+
The gem is designed to closely mirror the Calendly API, making it easy to convert API examples into gem code
|
51
51
|
|
52
|
-
Responses are created as objects like `Calendlyr::Event`. Having types like `Calendlyr::User` is
|
52
|
+
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.
|
53
53
|
|
54
54
|
* [Pagination](docs/resources/pagination.md)
|
55
55
|
* **Activity Log**
|
@@ -96,10 +96,10 @@ Responses are created as objects like `Calendlyr::Event`. Having types like `Cal
|
|
96
96
|
4. Push to the branch (`git push origin my-new-feature`)
|
97
97
|
5. Create a new Pull Request
|
98
98
|
|
99
|
-
When adding resources,
|
99
|
+
When adding resources, update the list of resources in `lib/calendlyr`. Additionally, write a spec and include it in the list in the README
|
100
100
|
|
101
101
|
## Thanks
|
102
102
|
|
103
|
-
Many thanks [@markets](https://github.com/markets) (our
|
103
|
+
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:
|
104
104
|
|
105
|
-
Thanks [@excid3](https://github.com/excid3) and his [Vultr.rb](https://github.com/excid3/vultr.rb) rubygem project.
|
105
|
+
Thanks also to [@excid3](https://github.com/excid3) and his [Vultr.rb](https://github.com/excid3/vultr.rb) rubygem project.
|
@@ -16,6 +16,6 @@ results.next_page_token
|
|
16
16
|
#=> "KfKBetd7bS0wsFINjYky9mp8ZJXv76aL"
|
17
17
|
|
18
18
|
# Retrieve the next page
|
19
|
-
client.me.events(count: 5,
|
19
|
+
client.me.events(count: 5, page_token: results.next_page_token)
|
20
20
|
#=> Calendlyr::Collection
|
21
21
|
```
|
data/lib/calendlyr/error.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
module Calendlyr
|
2
2
|
class Error < StandardError; end
|
3
|
-
|
4
3
|
class PermissionDenied < StandardError; end
|
5
|
-
|
6
4
|
class BadRequest < StandardError; end
|
7
|
-
|
8
5
|
class PaymentRequired < StandardError; end
|
9
|
-
|
10
6
|
class Unauthenticated < StandardError; end
|
11
|
-
|
12
7
|
class NotFound < StandardError; end
|
13
|
-
|
14
8
|
class ExternalCalendarEror < StandardError; end
|
15
|
-
|
16
9
|
class InternalServerError < StandardError; end
|
10
|
+
class TooManyRequestsEror < StandardError; end
|
17
11
|
|
18
12
|
class ResponseErrorHandler
|
19
13
|
ERROR_TYPES = {
|
@@ -22,6 +16,7 @@ module Calendlyr
|
|
22
16
|
"403" => PermissionDenied,
|
23
17
|
"404" => NotFound,
|
24
18
|
"424" => ExternalCalendarEror,
|
19
|
+
"429" => TooManyRequestsEror,
|
25
20
|
"500" => InternalServerError
|
26
21
|
}
|
27
22
|
|
@@ -31,6 +26,8 @@ module Calendlyr
|
|
31
26
|
end
|
32
27
|
|
33
28
|
def error
|
29
|
+
return too_many_requests_error if @code == "429"
|
30
|
+
|
34
31
|
error_type.new("[Error #{@code}] #{@body["title"]}. #{@body["message"]}")
|
35
32
|
end
|
36
33
|
|
@@ -41,5 +38,9 @@ module Calendlyr
|
|
41
38
|
|
42
39
|
ERROR_TYPES[@code]
|
43
40
|
end
|
41
|
+
|
42
|
+
def too_many_requests_error
|
43
|
+
error_type.new("[Error #{@code}] Too many requests, please try again later.")
|
44
|
+
end
|
44
45
|
end
|
45
46
|
end
|
data/lib/calendlyr/resource.rb
CHANGED
data/lib/calendlyr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendlyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- araluce
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- test/fixtures/resources/403_payment_required.json
|
299
299
|
- test/fixtures/resources/404.json
|
300
300
|
- test/fixtures/resources/424.json
|
301
|
+
- test/fixtures/resources/429.json
|
301
302
|
- test/fixtures/resources/500.json
|
302
303
|
- test/fixtures/routing_forms/list.json
|
303
304
|
- test/fixtures/routing_forms/list_routing_form_submission.json
|