olive_branch 1.2.3 → 2.0.0
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/README.md +2 -1
- data/lib/olive_branch/middleware.rb +5 -12
- 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: b54d1b0e0db59e223cf8720ae8b1c886c8f687b6
|
|
4
|
+
data.tar.gz: 77114b9066d6498f3497c46c684d1b86fc406f77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d226a63c03330548194f7f0783873ea1b4468084f8655a629b36dc786b2a6f447cef0b56d6c3121c61ee62271de049c8846bcc406ab5523f42d62d37288d272
|
|
7
|
+
data.tar.gz: 92c3514964ad7b19fd31f0b5bef62dddb4f45a69face9446bb758c3ea0612cace7e466b3481736f1a4b635d06f63c894a1c6d0d1843050d88170f9114783ea84
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# OliveBranch
|
|
2
2
|
|
|
3
3
|
[](https://codeclimate.com/github/vigetlabs/olive_branch)
|
|
4
|
+
[](https://travis-ci.org/vigetlabs/olive_branch)
|
|
4
5
|
|
|
5
6
|
This gem lets your API users pass in and receive camelCased or dash-cased keys, while your Rails app receives and produces snake_cased ones.
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@ This gem lets your API users pass in and receive camelCased or dash-cased keys,
|
|
|
12
13
|
|
|
13
14
|
2. Add this to `config/applcation.rb`:
|
|
14
15
|
|
|
15
|
-
config.middleware.use
|
|
16
|
+
config.middleware.use OliveBranch::Middleware
|
|
16
17
|
|
|
17
18
|
## Use
|
|
18
19
|
|
|
@@ -40,19 +40,12 @@ module OliveBranch
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def underscore_params(env)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
request_body.deep_transform_keys!(&:underscore)
|
|
47
|
-
req = StringIO.new(request_body.to_json)
|
|
43
|
+
req = ActionDispatch::Request.new(env)
|
|
44
|
+
req.request_parameters
|
|
45
|
+
req.query_parameters
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
rescue JSON::ParserError
|
|
52
|
-
end
|
|
53
|
-
else
|
|
54
|
-
env["action_dispatch.request.request_parameters"].deep_transform_keys!(&:underscore)
|
|
55
|
-
end
|
|
47
|
+
env["action_dispatch.request.request_parameters"].deep_transform_keys!(&:underscore)
|
|
48
|
+
env["action_dispatch.request.query_parameters"].deep_transform_keys!(&:underscore)
|
|
56
49
|
end
|
|
57
50
|
end
|
|
58
51
|
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:
|
|
4
|
+
version: 2.0.0
|
|
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-09-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|