olive_branch 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/olive_branch/middleware.rb +2 -1
- data/lib/olive_branch/version.rb +1 -1
- 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: dceab387f022f915de93bf296b35e04dd5aaa863
|
4
|
+
data.tar.gz: 9f2dab3860dfa40f418655971833f4cd3db8980d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/olive_branch/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|