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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0772a7b82da14fecdc3976b9cbc2a18cec54ca9e3eb2aaeedfc1df6e220d8cde
4
- data.tar.gz: 985654c6b08521739aeb8b027c17c7094a1c4e49b1e3dbb291f52747f7e261b5
3
+ metadata.gz: e9d08b30cddb6172f8941fa8c8841a6dacb46754187c8c2b03292298b92a0e0d
4
+ data.tar.gz: 3ba42d35d1d5e7cb9c97d7cb59eacfc32daea9e07581109bc5023309702d669b
5
5
  SHA512:
6
- metadata.gz: 92c7369f875233d12ccd063c47ce26c0be52f7443339aa73eccc648a69825ad27469a5ada5008c52f82ea504f98305b153705b0189f8da66e36fa6bf4354a364
7
- data.tar.gz: d6b41ea040f57e158e12ca3a83d63fc60d5aadce62d577e17830e1fb5c82a7d8aad6995a8dbcbf04a62a0078a7356e850e26bce23afacea9d379c221e1b69fb2
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 complete rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).
10
+ Easy and comprehensive rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).
10
11
 
11
- Just needed a Personal Access Token.
12
+ You just need a Personal Access Token.
12
13
 
13
14
  ## Dependencies
14
15
 
15
16
  No dependencies :tada:
16
17
 
17
- We know about the importance of not add dependencies that you don't want.
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.0'
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 pass in your token. You can generate your Personal Access Token at [https://calendly.com/integrations/api_webhooks](https://calendly.com/integrations/api_webhooks)
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 gives you access to each of the resources.
46
-
46
+ The client then provides access to all of the resources.
47
47
 
48
48
  ### Resources
49
49
 
50
- The gem maps as closely as we can to the Calendly API so you can easily convert API examples to gem code.
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 handy for understanding what type of object you're working with. They're built using OpenStruct so you can easily access data in a Ruby-ish way.
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, add to the list of resources in lib/calendlyr. Additionally, write a spec and add it to the list in the README.
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 contributor in the shadows) for all comments, details and tips for this rubygem project and for made me grow professionally in my day by day :raised_hands:
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, next_page_token: results.next_page_token)
19
+ client.me.events(count: 5, page_token: results.next_page_token)
20
20
  #=> Calendlyr::Collection
21
21
  ```
@@ -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
@@ -7,7 +7,7 @@ module Calendlyr
7
7
  class Resource
8
8
  attr_reader :client
9
9
 
10
- ERROR_CODES = %w[400 401 403 404 424 500]
10
+ ERROR_CODES = %w[400 401 403 404 424 429 500]
11
11
 
12
12
  def initialize(client)
13
13
  @client = client
@@ -1,3 +1,3 @@
1
1
  module Calendlyr
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -1,4 +1 @@
1
- {
2
- "title": "External Calendar Error",
3
- "message": "There is a problem accessing your calendar."
4
- }
1
+ {}
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "External Calendar Error",
3
+ "message": "There is a problem accessing your calendar."
4
+ }
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.0
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