olive_branch 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b70147d89c1ed39a3d2622ace5dd0465cf0e859
4
- data.tar.gz: 8ddd953cdb4b3d83dcc8f76181c021d527dbd4f9
3
+ metadata.gz: dceab387f022f915de93bf296b35e04dd5aaa863
4
+ data.tar.gz: 9f2dab3860dfa40f418655971833f4cd3db8980d
5
5
  SHA512:
6
- metadata.gz: 5221720bceac61c7ab85c82723daf410edde7074c75727796caab89fb4df6af501bbaad7db6e78cb15a6afda97f2be33d8d93edc19fb6951dc104f0db4d036a8
7
- data.tar.gz: ebac93fa3b2b241525b270e6512b3b9acfaa78e6551718dd6f9cf756a34d7bdce982457a1d34684c3ecc94eced0a0cade3e33c85b8ff79532dfdf1200f30e877
6
+ metadata.gz: e669e8a4637b78ed651bc2b6ede1fb6dc87c6b644444d26bc0ac64e6730e7d11ca7172523577eac66a33f8270cbb8a09af3490ea978b16daf07fdf172a622408
7
+ data.tar.gz: 875fba805e072302b1002b0a6649b223fb4d3be86bedc2e93850066971ace30599b7727aa4d42a57feb331a09bf171a1a35316327920d0c5307be86ff931fe8a
data/README.md CHANGED
@@ -54,6 +54,12 @@ It is also possible to include a custom content type check in the same manner
54
54
  config.middleware.use OliveBranch::Middleware, content_type_check: -> (content_type) { content_type == "my/content-type" }
55
55
  ```
56
56
 
57
+ Finally, a default inflection can be specified so you don't have to include the `X-Key-Inflection` header on every request.
58
+
59
+ ```ruby
60
+ config.middleware.use OliveBranch::Middleware, inflection: 'camel'
61
+ ```
62
+
57
63
  * * *
58
64
 
59
65
  OliveBranch is released under the [MIT License](http://www.opensource.org/licenses/MIT). See MIT-LICENSE for further details.
@@ -43,10 +43,11 @@ module OliveBranch
43
43
  @camelize = args[:camelize] || Transformations.method(:camelize)
44
44
  @dasherize = args[:dasherize] || Transformations.method(:dasherize)
45
45
  @content_type_check = args[:content_type_check] || Checks.method(:content_type_check)
46
+ @default_inflection = args[:inflection]
46
47
  end
47
48
 
48
49
  def call(env)
49
- inflection = env["HTTP_X_KEY_INFLECTION"]
50
+ inflection = env["HTTP_X_KEY_INFLECTION"] || @default_inflection
50
51
 
51
52
  if inflection && @content_type_check.call(env["CONTENT_TYPE"])
52
53
  Transformations.underscore_params(env)
@@ -1,3 +1,3 @@
1
1
  module OliveBranch
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: olive_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Fatsi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-19 00:00:00.000000000 Z
12
+ date: 2017-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails