routemaster-drain 3.6.2 → 3.6.3

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: 3767d797098f45ef97ab1109e2adc72e02db4fc8
4
- data.tar.gz: 9efed3541d15645fabc5ec362eea53ff25509237
3
+ metadata.gz: 68cd91502559ade561ad65e6440cd1609134a380
4
+ data.tar.gz: d9c8c31b7d24f5d56f831b49a42bcf1e09c86a43
5
5
  SHA512:
6
- metadata.gz: 858c27a01bf3d3d0117d40956be50e63535fa07df173d8c43047e6feb3caf214c88b057c888e3bf61a794076db7d740020137faeef7b8425e9469e8361b29c3e
7
- data.tar.gz: 9c261c1b13f3a0629efe44a04ae2896a30480d3552b82f9df226e87bb5c94649d00e1b893d0952f30a04787e89e24b6946992e4e1f945161ff026bc7b15422c4
6
+ metadata.gz: 9250edbe5107293bab6a4b5ec81eaa61b6e35483223c2af4548b1dce04afc7948c010092fb3dd831b11947ce463700702a1586228f3c110d2c7407bdbb535b4f
7
+ data.tar.gz: 8ed05bfc0b1cc2d39353612f18a3f123c13298c222cf77c25ba9873e43eb9f8002091e5eb5a0e8e4f25f4286947b56fa6e36182418fa4e8ad3f9c67a4087126a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  _A description of your awesome changes here!_
4
4
 
5
+ ### 3.6.3 (2018-10-17)
6
+
7
+ Bug fix:
8
+
9
+ - Allow all middleware classes to be initialised in the same format
10
+
5
11
  ### 3.6.2 (2018-10-11)
6
12
 
7
13
  Features:
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '3.6.2'.freeze
3
+ VERSION = '3.6.3'.freeze
4
4
  end
5
5
  end
@@ -16,10 +16,10 @@ module Routemaster
16
16
  class Authenticate
17
17
  include Wisper::Publisher
18
18
 
19
- # @param uuid [Enumerable] a set of accepted authentication tokens
20
- def initialize(app, uuid: nil, **_)
19
+ # options[:uuid] [Enumerable] a set of accepted authentication tokens
20
+ def initialize(app, options = {})
21
21
  @app = app
22
- @uuid = uuid || Config.drain_tokens
22
+ @uuid = options.fetch(:uuid) { Config.drain_tokens }
23
23
 
24
24
  unless @uuid.kind_of?(String) || @uuid.kind_of?(Enumerable)
25
25
  raise ArgumentError, ':uuid must be a String or Enumerable'
@@ -7,11 +7,11 @@ require 'routemaster/event_index'
7
7
  module Routemaster
8
8
  module Middleware
9
9
  class Cache
10
- def initialize(app, cache:nil, client:nil, queue:nil, **_)
10
+ def initialize(app, options = {})
11
11
  @app = app
12
- @cache = cache || Routemaster::Cache.new
13
- @client = client || Routemaster::Jobs::Client.new
14
- @queue = queue || Config.queue_name
12
+ @cache = options.fetch(:cache) { Routemaster::Cache.new }
13
+ @client = options.fetch(:client) { Routemaster::Jobs::Client.new }
14
+ @queue = options.fetch(:queue) { Config.queue_name }
15
15
  end
16
16
 
17
17
  def call(env)
@@ -11,9 +11,9 @@ module Routemaster
11
11
  # The dirty map is passed as `:map` to the constructor and must respond to
12
12
  # `#mark` (like `Routemaster::Dirty::Map`).
13
13
  class Dirty
14
- def initialize(app, dirty_map: nil, **_)
14
+ def initialize(app, options = {})
15
15
  @app = app
16
- @map = dirty_map || Routemaster::Dirty::Map.new
16
+ @map = options.fetch(:dirty_map) { Routemaster::Dirty::Map.new }
17
17
  end
18
18
 
19
19
  def call(env)
@@ -3,9 +3,9 @@ require 'routemaster/cache'
3
3
  module Routemaster
4
4
  module Middleware
5
5
  class ExpireCache
6
- def initialize(app, cache:nil, **_)
6
+ def initialize(app, options = {})
7
7
  @app = app
8
- @cache = cache || Routemaster::Cache.new
8
+ @cache = options.fetch(:cache) { Routemaster::Cache.new }
9
9
  end
10
10
 
11
11
  def call(env)
@@ -7,11 +7,11 @@ module Routemaster
7
7
  #
8
8
  # Will use `Routemaster::Dirty::Filter` by default.
9
9
  class Filter
10
- # @param filter [Routemaster::Dirty::Filter] an event filter (optional;
10
+ # options[:filter] [Routemaster::Dirty::Filter] an event filter (optional;
11
11
  # will be created using the `redis` and `expiry` options if not provided)
12
- def initialize(app, filter:nil, **_)
12
+ def initialize(app, options = {})
13
13
  @app = app
14
- @filter = filter || Routemaster::Dirty::Filter.new
14
+ @filter = options.fetch(:filter) { Routemaster::Dirty::Filter.new }
15
15
  end
16
16
 
17
17
  def call(env)
@@ -3,10 +3,10 @@ module Routemaster
3
3
  class Metrics
4
4
  INTERACTION_KEY = 'api_client'.freeze
5
5
 
6
- def initialize(app, client: nil, source_peer: nil)
6
+ def initialize(app, options = {})
7
7
  @app = app
8
- @client = client
9
- @source_peer = source_peer
8
+ @client = options[:client]
9
+ @source_peer = options[:source_peer]
10
10
  end
11
11
 
12
12
  def call(request_env)
@@ -10,7 +10,7 @@ module Routemaster
10
10
  # Lower middlewares (or the app) can access the parsed payload as a hash
11
11
  # in +env['routemaster.payload']+
12
12
  class Parse
13
- def initialize(app)
13
+ def initialize(app, _options = {})
14
14
  @app = app
15
15
  end
16
16
 
@@ -10,11 +10,11 @@ module Routemaster
10
10
  VERSION_REGEX = /application\/json;v=(?<version>\S*)/
11
11
  RESPONSE_CACHING_OPT_HEADER = 'X-routemaster_drain.opt_cache'.freeze
12
12
 
13
- def initialize(app, cache: Config.cache_redis, listener: nil)
13
+ def initialize(app, options = {})
14
14
  @app = app
15
- @cache = cache
15
+ @cache = options.fetch(:cache) { Config.cache_redis }
16
16
  @expiry = Config.cache_expiry
17
- @listener = listener
17
+ @listener = options[:listener]
18
18
  end
19
19
 
20
20
  def call(env)
@@ -2,7 +2,7 @@ module Routemaster
2
2
  module Middleware
3
3
  # Rejects all requests but POST to the root path
4
4
  class RootPostOnly
5
- def initialize(app)
5
+ def initialize(app, _options = {})
6
6
  @app = app
7
7
  end
8
8
 
@@ -6,9 +6,9 @@ module Routemaster
6
6
  #
7
7
  # Topic handlers are initialized with the full event payload and must respond to `#call`
8
8
  class Siphon
9
- def initialize(app, siphon_events: nil)
9
+ def initialize(app, options = {})
10
10
  @app = app
11
- @processors = siphon_events || {}
11
+ @processors = options.fetch(:siphon_events) { {} }
12
12
  end
13
13
 
14
14
  def call(env)
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.6.2
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-11 00:00:00.000000000 Z
11
+ date: 2018-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable