calendlyr 0.7.1 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e919a79ee8a607c497ff0e9b7a3dbf8e035d31c2c1687303806c5fd80de1f55
4
- data.tar.gz: adf1ff59d69fdcf9c6e34804b7d352d27e499a62765d488ee9acf9418ed997e3
3
+ metadata.gz: c57c6eee34f296883a41d1c78d7f9ab9f142768353c78068a91ed7a4f6ec33f8
4
+ data.tar.gz: b1adb963d1d9ec9b2529d2765b7ddc6c0ea2a92fb5a89b016154abbacdb0d7dd
5
5
  SHA512:
6
- metadata.gz: 7dbea6a806ad7cc8ce2e661d1af464d184d54cfbba44dae35c33d3e7a07e67c58a7f7fd8c6c33fc08b0663cef10d35fc69f442bc964b7eb0d28f6541137cbb49
7
- data.tar.gz: 12a946f4b07d17598560d3307e2c18acabc39714484b934af3aa46a764ea40e5a2cf7f8ec4cbc3ff291ab5f04264f82b873b24dec11390213d17f24e1169d93a
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
- ![example workflow](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)
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.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.1'
26
+ gem 'calendlyr', '0.7.3'
28
27
  ```
29
28
 
30
29
  And then execute:
@@ -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
@@ -50,7 +50,12 @@ module Calendlyr
50
50
  def handle_response(response)
51
51
  return true unless response.read_body
52
52
 
53
- body = JSON.parse(response.read_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
@@ -1,3 +1,3 @@
1
1
  module Calendlyr
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -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.1
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