restful_resource 2.2.0 → 2.2.1

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
  SHA1:
3
- metadata.gz: 78cdc6fe007f825644ca02011bd4331d3d5f2087
4
- data.tar.gz: dd4d619d9d2f4a0e020824de651f58a5f339cf84
3
+ metadata.gz: bde6cf5ec5aad431ca3e9d06e2fad1787d8060dd
4
+ data.tar.gz: 6d9a8f2062d2952df9b6d3f3fc1413d093469046
5
5
  SHA512:
6
- metadata.gz: 4876da8d8cd7a11501035d975e7511d1481d19c2f40a5423c9c10fbb5331ed963da3607461003677df03f8e138375584a8a9c86a0086a029f3365553f870befe
7
- data.tar.gz: eb793fe38f0e1fdddf30f49d695b5bd9cf05e92cc74a7ed16a8651d624655137d75480650b5662cbc01a37d2561f789daebc997b92da8e0b6354afb6a426245e
6
+ metadata.gz: 9a8f4f98f262ef51cf3219acacffc48b2cc1e74d453fa16f71bf224bd49b5238966b30bc9c435f0f76b7d8ea09a2491c259b6166b28edd230cfd6da319a78a56
7
+ data.tar.gz: 1e73b6228ba3143e96eec6f2d98ea2014d8061654f30fc34bdf48e8749c07479a1a40cccd5226cd2afc1f12aeb73412f70429224632772d003dc84bdea97a621
@@ -28,6 +28,8 @@ module RestfulResource
28
28
  end
29
29
  end
30
30
 
31
+ class Conflict < HttpError; end
32
+
31
33
  class RetryableError < HttpError; end
32
34
 
33
35
  class OtherHttpError < HttpError
@@ -208,6 +210,7 @@ module RestfulResource
208
210
  raise ClientError.new(request) unless response
209
211
  case response[:status]
210
212
  when 404 then raise HttpClient::ResourceNotFound.new(request, response)
213
+ when 409 then raise HttpClient::Conflict.new(request, response)
211
214
  when 422 then raise HttpClient::UnprocessableEntity.new(request, response)
212
215
  when 502 then raise HttpClient::BadGateway.new(request, response)
213
216
  when 503 then raise HttpClient::ServiceUnavailable.new(request, response)
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -57,6 +57,14 @@ RSpec.describe RestfulResource::HttpClient do
57
57
  expect(response.status).to eq 200
58
58
  end
59
59
 
60
+ it 'put should raise error 409' do
61
+ connection = faraday_connection do |stubs|
62
+ stubs.put('http://httpbin.org/status/409') { |env| [409, {}, nil] }
63
+ end
64
+
65
+ expect { http_client(connection).put('http://httpbin.org/status/409') }.to raise_error(RestfulResource::HttpClient::Conflict)
66
+ end
67
+
60
68
  it 'put should raise error 422' do
61
69
  connection = faraday_connection do |stubs|
62
70
  stubs.put('http://httpbin.org/status/422') { |env| [422, {}, 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.0
4
+ version: 2.2.1
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: 2017-10-26 00:00:00.000000000 Z
12
+ date: 2017-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler