api-blueprint 0.9.0 → 0.9.1

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: 61f08022e66a80930b38d402669208101268a8c1
4
- data.tar.gz: 42f56d78286f6b1f0af2ff56d35ae3987790326c
3
+ metadata.gz: 4f3b301a57079985d9709f72b0ad1dfe1310e78c
4
+ data.tar.gz: efd1ede63552fa9489d09b9f45b13cec682e85e2
5
5
  SHA512:
6
- metadata.gz: e47571b0c8cb9454b4a43e1a8220743d9878d547c55528c34e764912a387aa2373273f518e42476652a1c638666c7f0dd298450f86a2dd7fd65658b620d170c3
7
- data.tar.gz: b97f2796c2d0e3b100d051792b7cb50c4b93bd9fbfc5bc46ed17e61417c531d88a80a75d8b79749802d2638acdb3db8d68286ebb1714e174b38793b2a12040f2
6
+ metadata.gz: 0a5732ab57a0b4f02af8f37c2c82571ccd4a3072665272f9d42a6cf30081cb618e9a2f3d33f2900142dc727518f89cb296ec5db0454653564389198959a5a159
7
+ data.tar.gz: 9ff4723a7a24304da190b4540ff3e277e011faffda39d238da7a638403f59f78fcb8386fbdd4e17220caae358f5da4c6cca71679d2c95f9f42158bd6af903aef
data/README.md CHANGED
@@ -254,12 +254,13 @@ ApiBlueprint::Runner.new({
254
254
  })
255
255
  ```
256
256
 
257
- The `ApiBlueprint::Cache` class has a method to generate unique keys for the cache items by creating a checksum of the request headers and url. It doesn't include the body of the request in this checksum by default, and if you want to exclude more headers, you can do so using the `ignored_headers` setting on the Cache class. For example, to not include "X-Real-IP" and "X-Request-Id" headers, which would otherwise render the cache useless:
257
+ The `ApiBlueprint::Cache` class has a method to generate unique keys for the cache items by creating a checksum of the request headers and url. It doesn't include the body of the request in this checksum by default, and if you want to exclude headers, you can do so using the `ignored_headers` setting on the Cache class.
258
+
259
+ For example, to not include "X-Real-IP" and "X-Request-Id" headers, which would otherwise render the cache useless:
258
260
 
259
261
  ```ruby
260
262
  ApiBlueprint::Cache.configure do |config|
261
- # Using .concat here because the default is [:body] and you probably want to keep that
262
- config.ignored_headers.concat ["X-Real-IP", "X-Request-Id"]
263
+ config.ignored_headers = ["X-Real-IP", "X-Request-Id"]
263
264
  end
264
265
  ```
265
266
 
@@ -3,7 +3,7 @@ module ApiBlueprint
3
3
  extend Dry::Initializer
4
4
  extend Dry::Configurable
5
5
 
6
- setting :ignored_headers, [:body]
6
+ setting :ignored_headers, []
7
7
 
8
8
  option :key
9
9
 
@@ -21,7 +21,8 @@ module ApiBlueprint
21
21
 
22
22
  def generate_cache_key(klass, options)
23
23
  if options.is_a? Hash
24
- options = options.clone.with_indifferent_access.except *self.class.config.ignored_headers
24
+ options = options.clone.with_indifferent_access.except :body
25
+ options[:headers] = options[:headers].except *self.class.config.ignored_headers if options[:headers]
25
26
  end
26
27
 
27
28
  options_digest = Digest::MD5.hexdigest Marshal::dump(options.to_s.chars.sort.join)
@@ -1,3 +1,3 @@
1
1
  module ApiBlueprint
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-blueprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Timewell