garage_client 2.1.5 → 2.1.6
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
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 876435ec94b293955088ff468b9f15eda5a5f08d
|
|
4
|
+
data.tar.gz: 2aa489fb0250350d47c86c6751950d1db5a36743
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7acdb469b6d4493aab2e86669c55c05f2209eea17c03eb9ef7dfc954f871ba8a7d7ed0beb94a451bef03e53a2bffee5480e48efde848c0da50afda07001bebe
|
|
7
|
+
data.tar.gz: e772d7c35be9afa30b6d04cab2abb3df81808e5429cccd1b9f48aa18662d143ba160ea60c560199aebe8bbd9cda1525b65f43103689ffc2437d5c15f58e98740
|
data/CHANGELOG.md
CHANGED
data/lib/garage_client/error.rb
CHANGED
|
@@ -27,6 +27,8 @@ module GarageClient
|
|
|
27
27
|
class Conflict < Error; end
|
|
28
28
|
class UnsupportedMediaType < Error; end
|
|
29
29
|
class UnprocessableEntity < Error; end
|
|
30
|
+
class ClientError < Error; end
|
|
31
|
+
class ServerError < Error; end
|
|
30
32
|
|
|
31
33
|
# Remote Server
|
|
32
34
|
class InternalServerError < Error; end
|
|
@@ -4,6 +4,9 @@ require 'faraday_middleware'
|
|
|
4
4
|
module GarageClient
|
|
5
5
|
class Response
|
|
6
6
|
class RaiseHttpException < Faraday::Response::Middleware
|
|
7
|
+
ClientErrorStatuses = 400...500
|
|
8
|
+
ServerErrorStatuses = 500...600
|
|
9
|
+
|
|
7
10
|
def call(env)
|
|
8
11
|
@app.call(env).on_complete do |response|
|
|
9
12
|
resp = response
|
|
@@ -28,6 +31,10 @@ module GarageClient
|
|
|
28
31
|
raise GarageClient::InternalServerError.new(resp)
|
|
29
32
|
when 503
|
|
30
33
|
raise GarageClient::ServiceUnavailable.new(resp)
|
|
34
|
+
when ClientErrorStatuses
|
|
35
|
+
raise GarageClient::ClientError.new(resp)
|
|
36
|
+
when ServerErrorStatuses
|
|
37
|
+
raise GarageClient::ServerError.new(resp)
|
|
31
38
|
end
|
|
32
39
|
end
|
|
33
40
|
end
|
|
@@ -437,6 +437,13 @@ describe Faraday::Response do
|
|
|
437
437
|
422 => GarageClient::UnprocessableEntity,
|
|
438
438
|
500 => GarageClient::InternalServerError,
|
|
439
439
|
503 => GarageClient::ServiceUnavailable,
|
|
440
|
+
|
|
441
|
+
402 => GarageClient::ClientError,
|
|
442
|
+
405 => GarageClient::ClientError,
|
|
443
|
+
407 => GarageClient::ClientError,
|
|
444
|
+
408 => GarageClient::ClientError,
|
|
445
|
+
502 => GarageClient::ServerError,
|
|
446
|
+
504 => GarageClient::ServerError,
|
|
440
447
|
}.each do |status, exception|
|
|
441
448
|
context "when HTTP status is #{status}" do
|
|
442
449
|
before do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: garage_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cookpad Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
243
243
|
version: '0'
|
|
244
244
|
requirements: []
|
|
245
245
|
rubyforge_project:
|
|
246
|
-
rubygems_version: 2.5.1
|
|
246
|
+
rubygems_version: 2.4.5.1
|
|
247
247
|
signing_key:
|
|
248
248
|
specification_version: 4
|
|
249
249
|
summary: Ruby client library for the Garage API
|