help_scout 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/help_scout/version.rb +1 -1
- data/lib/help_scout.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af9833c01bb362743f11ae7a37fded124b094a45
|
4
|
+
data.tar.gz: b00861cc5a4e1cb8b849b8d747316a538184310e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6622b14f0f9845f7d6370e6350e78063884a127c95dd91514fbc29b8401a0aee135a7ea828097bb89472d468ef45e81e37d1b4f6a650c55db64d7125d5145c6e
|
7
|
+
data.tar.gz: 7c3d739ff7256c65de60f029097264b24d257b392b4f6810d79fc1a82a4b653174f8b314cb0148b3ab796327eeeb385a7646a8636674fb16f9f814aef843c89e
|
data/.travis.yml
CHANGED
data/lib/help_scout/version.rb
CHANGED
data/lib/help_scout.rb
CHANGED
@@ -5,6 +5,7 @@ class HelpScout
|
|
5
5
|
class ValidationError < StandardError; end
|
6
6
|
class NotImplementedError < StandardError; end
|
7
7
|
class NotFoundError < StandardError; end
|
8
|
+
class TooManyRequestsError < StandardError; end
|
8
9
|
class InternalServerError < StandardError; end
|
9
10
|
|
10
11
|
# Status codes used by Help Scout, not all are implemented in this gem yet.
|
@@ -14,6 +15,7 @@ class HelpScout
|
|
14
15
|
HTTP_NO_CONTENT = 204
|
15
16
|
HTTP_BAD_REQUEST = 400
|
16
17
|
HTTP_NOT_FOUND = 404
|
18
|
+
HTTP_TOO_MANY_REQUESTS = 429
|
17
19
|
HTTP_INTERNAL_SERVER_ERROR = 500
|
18
20
|
|
19
21
|
attr_accessor :last_response
|
@@ -206,6 +208,10 @@ class HelpScout
|
|
206
208
|
raise NotFoundError
|
207
209
|
when HTTP_INTERNAL_SERVER_ERROR
|
208
210
|
raise InternalServerError
|
211
|
+
when HTTP_TOO_MANY_REQUESTS
|
212
|
+
retry_after = last_response.headers["Retry-After"]
|
213
|
+
error_message = "Rate limit of 200 RPM or 12 POST/PUT/DELETE requests per 5 seconds reached. Next request possible in #{retry_after} seconds."
|
214
|
+
raise TooManyRequestsError, error_message
|
209
215
|
else
|
210
216
|
raise NotImplementedError, "Help Scout returned something that is not implemented by the help_scout gem yet: #{@last_response.code}: #{@last_response.parsed_response["message"] if @last_response.parsed_response}"
|
211
217
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: help_scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Paagman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.5.1
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: HelpScout is an API client for Help Scout
|