routemaster-drain 3.6.1 → 3.6.2
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 +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +11 -1
- data/lib/routemaster/cache.rb +2 -2
- data/lib/routemaster/drain.rb +1 -1
- data/spec/routemaster/cache_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3767d797098f45ef97ab1109e2adc72e02db4fc8
|
|
4
|
+
data.tar.gz: 9efed3541d15645fabc5ec362eea53ff25509237
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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(
|
|
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')
|
data/lib/routemaster/cache.rb
CHANGED
|
@@ -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
|
data/lib/routemaster/drain.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
11
|
+
date: 2018-10-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|