restful_resource 2.2.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/circle.yml +1 -1
- data/lib/restful_resource/http_client.rb +7 -0
- data/lib/restful_resource/version.rb +1 -1
- data/spec/restful_resource/http_client_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec111ab5ac7ec4d10d07eaaff544481e7267280d
|
4
|
+
data.tar.gz: 97286bf61d3fce595bec163ecdacbb0fddaf2f54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82565fc5a04369d88a211c702e49f7bf95998a16fa00b39a64bcd97f598c4ccc2f68a6b4f0a90a82f85f98c59adb1205aa39c69fc17659311904e9b2a4f1ac6
|
7
|
+
data.tar.gz: 2b3c6af8446db0154e62f4b4809b020d8f30f1503f14d65bf989ae749feef95d0388c63a88ee36c55b08fe1b43bd478fcb43e6f990f2ae7947ab5552a2f36ab7
|
data/circle.yml
CHANGED
@@ -56,6 +56,12 @@ module RestfulResource
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
class TooManyRequests < RetryableError
|
60
|
+
def message
|
61
|
+
"HTTP 429: Too Many Requests"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
59
65
|
class ClientError < RetryableError
|
60
66
|
def message
|
61
67
|
"There was some client error"
|
@@ -228,6 +234,7 @@ module RestfulResource
|
|
228
234
|
when 404 then raise HttpClient::ResourceNotFound.new(request, response)
|
229
235
|
when 409 then raise HttpClient::Conflict.new(request, response)
|
230
236
|
when 422 then raise HttpClient::UnprocessableEntity.new(request, response)
|
237
|
+
when 429 then raise HttpClient::TooManyRequests.new(request, response)
|
231
238
|
when 502 then raise HttpClient::BadGateway.new(request, response)
|
232
239
|
when 503 then raise HttpClient::ServiceUnavailable.new(request, response)
|
233
240
|
else raise HttpClient::OtherHttpError.new(request, response)
|
@@ -81,6 +81,14 @@ RSpec.describe RestfulResource::HttpClient do
|
|
81
81
|
expect { http_client(connection).post('http://httpbin.org/status/422') }.to raise_error(RestfulResource::HttpClient::UnprocessableEntity)
|
82
82
|
end
|
83
83
|
|
84
|
+
it 'post should raise error 429' do
|
85
|
+
connection = faraday_connection do |stubs|
|
86
|
+
stubs.post('http://httpbin.org/status/429') { |env| [429, {}, nil] }
|
87
|
+
end
|
88
|
+
|
89
|
+
expect { http_client(connection).post('http://httpbin.org/status/429') }.to raise_error(RestfulResource::HttpClient::TooManyRequests)
|
90
|
+
end
|
91
|
+
|
84
92
|
it 'put should raise error 502' do
|
85
93
|
connection = faraday_connection do |stubs|
|
86
94
|
stubs.put('http://httpbin.org/status/502') { |env| [502, {}, nil] }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-06-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|