routemaster-drain 3.3.0 → 3.4.0

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
- SHA1:
3
- metadata.gz: a0520ca5a0cdb1daad87055a37684ddf6bc80477
4
- data.tar.gz: 8cd339befc65768cb048fedd8484fde9db05e8e0
2
+ SHA256:
3
+ metadata.gz: 276a80759ce3d7e91723078a885714ae5878a29ac8a013e619274966075bdef8
4
+ data.tar.gz: 04b65e8136d765138f618dffd3121ff9c1e045b80cabf6da6af2073ca2ebe58f
5
5
  SHA512:
6
- metadata.gz: fc439ada70fc173308616b83490fea38d3c2705372fc29705aa9c3ae36b1b0bb309f73a64766a86e71e65d66b93b43b01b5bfe10b92101f9e749f48c604675b3
7
- data.tar.gz: f500448852c281cf3098e5eb6a3bc413be90d26aea533fedb19f99574e274027e81be48bf2b07064364fa8b939b0703018ea44116027bfd0260c9d3c56e1c1fb
6
+ metadata.gz: 90fe430dacad9cdac42c97998ccad99a73459237b486e23f0f0bb422399853b96a75d94a911690c1d8e98343370d68a5bd421a41cb0bbc4ff7312be7dd52af98
7
+ data.tar.gz: 1282d36973a326638171e6f9010d212802fc1babb30faef951386601a7e1136590abd1fd8afb609177c0584ef5509c220d5432a108b6e385a3a0bbb5de420c12
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 3.4.0 (2017-11-16)
2
+
3
+ Features:
4
+
5
+ - Raises error on 405 and 503
6
+
1
7
  ### 3.3.0 (2017-11-16)
2
8
 
3
9
  Features:
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '3.3.0'.freeze
3
+ VERSION = '3.4.0'.freeze
4
4
  end
5
5
  end
@@ -69,5 +69,17 @@ module Routemaster
69
69
  "Resource Throttling Error"
70
70
  end
71
71
  end
72
+
73
+ class MethodNotAllowed < BaseError
74
+ def message
75
+ "Method Not Allowed"
76
+ end
77
+ end
78
+
79
+ class ServiceNotAvailable < BaseError
80
+ def message
81
+ "Service Not Available"
82
+ end
83
+ end
72
84
  end
73
85
  end
@@ -9,11 +9,13 @@ module Routemaster
9
9
  (401..401) => Errors::UnauthorizedResourceAccess,
10
10
  (403..403) => Errors::UnauthorizedResourceAccess,
11
11
  (404..404) => Errors::ResourceNotFound,
12
+ (405..405) => Errors::MethodNotAllowed,
12
13
  (409..409) => Errors::ConflictResource,
13
14
  (412..412) => Errors::IncompatibleVersion,
14
15
  (413..413) => Errors::InvalidResource,
15
16
  (429..429) => Errors::ResourceThrottling,
16
- (407..500) => Errors::FatalResource
17
+ (407..500) => Errors::FatalResource,
18
+ (503..503) => Errors::ServiceNotAvailable
17
19
  }.freeze
18
20
 
19
21
  def on_complete(env)
@@ -21,7 +21,7 @@ describe Routemaster::APIClient do
21
21
  let(:port) { 8080 }
22
22
  let(:service) do
23
23
  TestServer.new(port) do |server|
24
- [400, 401, 403, 404, 409, 412, 413, 429, 500].each do |status_code|
24
+ [400, 401, 403, 404, 405, 409, 412, 413, 429, 500, 503].each do |status_code|
25
25
  server.mount_proc "/#{status_code}" do |req, res|
26
26
  res.status = status_code
27
27
  res.body = { field: 'test' }.to_json
@@ -139,6 +139,10 @@ describe Routemaster::APIClient do
139
139
  expect { perform.(host + '/403') }.to raise_error(Routemaster::Errors::UnauthorizedResourceAccess)
140
140
  end
141
141
 
142
+ it 'raises a MethodNotAllowed on 405' do
143
+ expect { perform.(host + '/405') }.to raise_error(Routemaster::Errors::MethodNotAllowed)
144
+ end
145
+
142
146
  it 'raises an ConflictResource on 409' do
143
147
  expect { perform.(host + '/409') }.to raise_error(Routemaster::Errors::ConflictResource)
144
148
  end
@@ -158,6 +162,10 @@ describe Routemaster::APIClient do
158
162
  it 'raises an FatalResource on 500' do
159
163
  expect { perform.(host + '/500') }.to raise_error(Routemaster::Errors::FatalResource)
160
164
  end
165
+
166
+ it 'raises a ServiceNotAvailable on 503' do
167
+ expect { perform.(host + '/503') }.to raise_error(Routemaster::Errors::ServiceNotAvailable)
168
+ end
161
169
  end
162
170
 
163
171
  describe '#get' do
@@ -7,6 +7,7 @@ module WEBrick
7
7
  module HTTPServlet
8
8
  class ProcHandler
9
9
  alias do_PATCH do_GET
10
+ alias do_DELETE do_GET
10
11
  end
11
12
  end
12
13
  end
@@ -25,7 +26,7 @@ class TestServer
25
26
  DocumentRoot: Dir.pwd,
26
27
  Logger: WEBrick::Log.new('/dev/null'),
27
28
  AccessLog: [nil, nil]
28
- ).tap do |server|
29
+ ).tap do |server|
29
30
  @setup.call(server)
30
31
  server.start
31
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routemaster-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2017-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
286
  version: '0'
287
287
  requirements: []
288
288
  rubyforge_project:
289
- rubygems_version: 2.6.11
289
+ rubygems_version: 2.7.0
290
290
  signing_key:
291
291
  specification_version: 4
292
292
  summary: Event receiver for the Routemaster bus