olive_branch 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/olive_branch/middleware.rb +13 -5
- 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: 3e65696dd80713050ce9baff9d3ae61288bedaa6
|
4
|
+
data.tar.gz: 2d258e82c9218d840c49fae82c042e84ed5a60b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d7b5ab67bbaf244a1eb87b0ecc59ead20465b37a46376f845dfafb93293f7a64eaae60efd36400fa6982f613315288a64b81d192a5f84ad392012f41832c1c
|
7
|
+
data.tar.gz: 0ae945f6a8c95e14bf18ef260469241a41d58dedee1ccf3c4a4dcca534198fab5caebbb5eaf2d3612fd31c0468cd017828665fe5331d79470c8c7a7cb64ba50f
|
@@ -21,9 +21,17 @@ module OliveBranch
|
|
21
21
|
end
|
22
22
|
|
23
23
|
if inflection == "camel"
|
24
|
-
new_response.
|
24
|
+
if new_response.is_a? Array
|
25
|
+
new_response.each { |o| o.deep_transform_keys! { |k| k.camelize(:lower)} }
|
26
|
+
else
|
27
|
+
new_response.deep_transform_keys! { |k| k.camelize(:lower) }
|
28
|
+
end
|
25
29
|
elsif inflection == "dash"
|
26
|
-
new_response.
|
30
|
+
if new_response.is_a? Array
|
31
|
+
new_response.each { |o| o.deep_transform_keys!(&:dasherize) }
|
32
|
+
else
|
33
|
+
new_response.deep_transform_keys!(&:dasherize)
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
37
|
body.replace(new_response.to_json)
|
@@ -33,15 +41,15 @@ module OliveBranch
|
|
33
41
|
end
|
34
42
|
|
35
43
|
def underscore_params(env)
|
36
|
-
if Rails::VERSION::MAJOR
|
37
|
-
env["action_dispatch.request.request_parameters"].deep_transform_keys!(&:underscore)
|
38
|
-
else
|
44
|
+
if defined?(Rails) && Rails::VERSION::MAJOR >= 5
|
39
45
|
request_body = JSON.parse(env['rack.input'].read)
|
40
46
|
request_body.deep_transform_keys!(&:underscore)
|
41
47
|
req = StringIO.new(request_body.to_json)
|
42
48
|
|
43
49
|
env['rack.input'] = req
|
44
50
|
env['CONTENT_LENGTH'] = req.length
|
51
|
+
else
|
52
|
+
env["action_dispatch.request.request_parameters"].deep_transform_keys!(&:underscore)
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|
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: 1.2.
|
4
|
+
version: 1.2.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: 2016-
|
12
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|