calendlyr 0.7.1 → 0.7.3
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 +6 -7
- data/lib/calendlyr/error.rb +14 -0
- data/lib/calendlyr/resource.rb +6 -1
- data/lib/calendlyr/version.rb +1 -1
- data/test/fixtures/resources/429.json +1 -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: c57c6eee34f296883a41d1c78d7f9ab9f142768353c78068a91ed7a4f6ec33f8
|
4
|
+
data.tar.gz: b1adb963d1d9ec9b2529d2765b7ddc6c0ea2a92fb5a89b016154abbacdb0d7dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db6766c86112dc3e944e3b6387bcd8e67b4c335804590d8cb7ef55081a874e0c572a647e9d9ce799ef1207434eeda482c6ca2ea12ba842ed20abe054d0e7ed67
|
7
|
+
data.tar.gz: 4b59f6ad76dd238775a010501c647c383a0dca86861b1dc417b460d5f899b6b5be2852a6d1102a20637739857d7277eca3cf88655c7a1350fe08d1cb91cee894
|
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.3]
|
6
|
+
* Fix: Prevent possible empty body response to fail
|
7
|
+
|
8
|
+
[0.7.3]: https://github.com/araluce/calendlyr/compare/v0.7.1...v0.7.3
|
9
|
+
|
5
10
|
## [0.7.1]
|
6
11
|
* Adding support for 429 responses from Calendly API
|
7
12
|
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
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
|
-
![
|
5
|
-
|
6
|
-
![Gem Downloads (for specified version)](https://img.shields.io/gem/dv/calendlyr/0.7.0)
|
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 Version](https://badge.fury.io/rb/calendlyr.svg?kill_cache=1)](https://badge.fury.io/rb/calendlyr)
|
5
|
+
![Gem Downloads (for specified version)](https://img.shields.io/gem/dv/calendlyr/0.7.3?kill_cache=1)
|
7
6
|
|
8
7
|
# Calendly API Rubygem
|
9
8
|
|
@@ -24,7 +23,7 @@ We understand the importance of not adding unwanted dependencies.
|
|
24
23
|
Add this line to your application's Gemfile:
|
25
24
|
|
26
25
|
```ruby
|
27
|
-
gem 'calendlyr', '0.7.
|
26
|
+
gem 'calendlyr', '0.7.3'
|
28
27
|
```
|
29
28
|
|
30
29
|
And then execute:
|
data/lib/calendlyr/error.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
module Calendlyr
|
2
2
|
class Error < StandardError; end
|
3
|
+
|
3
4
|
class PermissionDenied < StandardError; end
|
5
|
+
|
4
6
|
class BadRequest < StandardError; end
|
7
|
+
|
5
8
|
class PaymentRequired < StandardError; end
|
9
|
+
|
6
10
|
class Unauthenticated < StandardError; end
|
11
|
+
|
7
12
|
class NotFound < StandardError; end
|
13
|
+
|
8
14
|
class ExternalCalendarEror < StandardError; end
|
15
|
+
|
9
16
|
class InternalServerError < StandardError; end
|
17
|
+
|
10
18
|
class TooManyRequestsEror < StandardError; end
|
11
19
|
|
12
20
|
class ResponseErrorHandler
|
@@ -26,6 +34,8 @@ module Calendlyr
|
|
26
34
|
end
|
27
35
|
|
28
36
|
def error
|
37
|
+
return too_many_requests_error if @code == "429"
|
38
|
+
|
29
39
|
error_type.new("[Error #{@code}] #{@body["title"]}. #{@body["message"]}")
|
30
40
|
end
|
31
41
|
|
@@ -36,5 +46,9 @@ module Calendlyr
|
|
36
46
|
|
37
47
|
ERROR_TYPES[@code]
|
38
48
|
end
|
49
|
+
|
50
|
+
def too_many_requests_error
|
51
|
+
error_type.new("[Error #{@code}] Too many requests, please try again later.")
|
52
|
+
end
|
39
53
|
end
|
40
54
|
end
|
data/lib/calendlyr/resource.rb
CHANGED
@@ -50,7 +50,12 @@ module Calendlyr
|
|
50
50
|
def handle_response(response)
|
51
51
|
return true unless response.read_body
|
52
52
|
|
53
|
-
body =
|
53
|
+
body = begin
|
54
|
+
JSON.parse(response.read_body)
|
55
|
+
rescue
|
56
|
+
{}
|
57
|
+
end
|
58
|
+
|
54
59
|
if ERROR_CODES.include? response.code
|
55
60
|
raise ResponseErrorHandler.new(response.code, body).error
|
56
61
|
else
|
data/lib/calendlyr/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
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.3
|
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
|