routemaster-drain 3.6.1 → 3.6.2

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: 1961fe701af902402b83e7eaa4a76fb54bf06f93
4
- data.tar.gz: ae8913a88b7f1da4379ee03f0900ec0e5b896f65
3
+ metadata.gz: 3767d797098f45ef97ab1109e2adc72e02db4fc8
4
+ data.tar.gz: 9efed3541d15645fabc5ec362eea53ff25509237
5
5
  SHA512:
6
- metadata.gz: d851f45539fc6af2e302ffc9497a0e18f71c6c261254bd0f7681d8a8996da2fd9b96659019f8d3c3012cc79a692c0d903d31d3ed2e50236fdc6fd13405baeba7
7
- data.tar.gz: 44aff14e7d23468f10a3214a31e6ee3920401421629230f2b7d19461b43f93a54573441895d2d3d06d041220cd554c3a1b90074447afa5eec0514d37dd91f297
6
+ metadata.gz: 858c27a01bf3d3d0117d40956be50e63535fa07df173d8c43047e6feb3caf214c88b057c888e3bf61a794076db7d740020137faeef7b8425e9469e8361b29c3e
7
+ data.tar.gz: 9c261c1b13f3a0629efe44a04ae2896a30480d3552b82f9df226e87bb5c94649d00e1b893d0952f30a04787e89e24b6946992e4e1f945161ff026bc7b15422c4
data/CHANGELOG.md CHANGED
@@ -2,11 +2,18 @@
2
2
 
3
3
  _A description of your awesome changes here!_
4
4
 
5
+ ### 3.6.2 (2018-10-11)
6
+
7
+ Features:
8
+
9
+ - `Routemaster::Cache` can be be given initialisation options to merge into the
10
+ default ones for creating a `Routemaster::APIClient` instance (#82)
11
+
5
12
  ### 3.6.1 (2018-10-09)
6
13
 
7
14
  Features:
8
15
 
9
- - Clients can now set User Agent when placing requests
16
+ - Clients can now set User Agent when placing requests (#80) - details in README
10
17
 
11
18
  ### 3.6.0 (2018-07-23)
12
19
 
data/README.md CHANGED
@@ -257,6 +257,13 @@ See
257
257
  [rubydoc](http://rubydoc.info/github/deliveroo/routemaster-drain/Routemaster/Cache)
258
258
  for more details on `Cache`.
259
259
 
260
+ If you need to provide configure the `APIClient` used by `Routemaster::Cache`, you can
261
+ configure it using `client_options`:
262
+
263
+ ```ruby
264
+ $cache = Routemaster::Cache.new(client_options: {source_peer: "<your user agent>"})
265
+ ```
266
+
260
267
  ### Expire Cache data for all notified resources
261
268
 
262
269
  You may wish to maintain a coherent cache, but don't need the cache to be warmed
@@ -282,7 +289,10 @@ Example:
282
289
  require 'routemaster/fetcher'
283
290
  require 'routemaster/responses/hateoas_response'
284
291
 
285
- client = Routemaster::APIClient.new(response_class: Routemaster::Responses::HateoasResponse)
292
+ client = Routemaster::APIClient.new(
293
+ response_class: Routemaster::Responses::HateoasResponse,
294
+ source_peer: "<your user agent>"
295
+ )
286
296
 
287
297
  response = client.discover('https://identity.deliveroo.com.dev')
288
298
  session_create_response = response.sessions.create(email: 'test@test.com', password: 'sup3rs3cr3t')
@@ -18,9 +18,9 @@ module Routemaster
18
18
  class Cache
19
19
  include Wisper::Publisher
20
20
 
21
- def initialize(redis: nil, client: nil)
21
+ def initialize(redis: nil, client: nil, client_options: {})
22
22
  @redis = redis || Config.cache_redis
23
- @client = client || APIClient.new(listener: self)
23
+ @client = client || APIClient.new(client_options.merge(listener: self))
24
24
  end
25
25
 
26
26
  # Bust the cache for a given URL
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '3.6.1'.freeze
3
+ VERSION = '3.6.2'.freeze
4
4
  end
5
5
  end
@@ -62,6 +62,19 @@ module Routemaster
62
62
  perform.status
63
63
  end
64
64
  end
65
+
66
+ context 'with source_peer client option' do
67
+ let(:options) { {} }
68
+ subject { described_class.new(client_options: {source_peer: 'test-peer'}) }
69
+
70
+ it 'calls get on the api client with given user agent' do
71
+ perform.status
72
+
73
+ assert_requested(:get, url) do |req|
74
+ expect(req.headers).to include('User-Agent' => 'test-peer' )
75
+ end
76
+ end
77
+ end
65
78
  end
66
79
 
67
80
  describe '#get' do
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.1
4
+ version: 3.6.2
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-09 00:00:00.000000000 Z
11
+ date: 2018-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable