olive_branch 1.2.3 → 2.0.0

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: 9e2e9bbfdd7b38cd05072fa906a2eb22c4b4abfd
4
- data.tar.gz: 0ba21cac9581c7d30a60c5379f0e8bcdab98af16
3
+ metadata.gz: b54d1b0e0db59e223cf8720ae8b1c886c8f687b6
4
+ data.tar.gz: 77114b9066d6498f3497c46c684d1b86fc406f77
5
5
  SHA512:
6
- metadata.gz: 7bea10e191c9e84977835f4b079cb0e822157312c31d66c7a2c1275e7a8721bf5a14c7bfd543fb33ca60b0db8db4e0f9da0ac80110054c5c82cbf6877a1f5726
7
- data.tar.gz: 9ef36f76c3a6ee448943e7801a84f37a6520d0db86684d39ee772666caecbb43520ea4644b9e62a2d14882c3397c0b99fdc7cd4ed0c15829b8eaa06832de6037
6
+ metadata.gz: 6d226a63c03330548194f7f0783873ea1b4468084f8655a629b36dc786b2a6f447cef0b56d6c3121c61ee62271de049c8846bcc406ab5523f42d62d37288d272
7
+ data.tar.gz: 92c3514964ad7b19fd31f0b5bef62dddb4f45a69face9446bb758c3ea0612cace7e466b3481736f1a4b635d06f63c894a1c6d0d1843050d88170f9114783ea84
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # OliveBranch
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/vigetlabs/olive_branch.png)](https://codeclimate.com/github/vigetlabs/olive_branch)
4
+ [![Build Status](https://travis-ci.org/vigetlabs/olive_branch.svg?branch=master)](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 "OliveBranch::Middleware"
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
- if defined?(Rails) && Rails::VERSION::MAJOR >= 5
44
- begin
45
- request_body = JSON.parse(env['rack.input'].read)
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
- env['rack.input'] = req
50
- env['CONTENT_LENGTH'] = req.length
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
@@ -1,3 +1,3 @@
1
1
  module OliveBranch
2
- VERSION = '1.2.3'
2
+ VERSION = '2.0.0'
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: 1.2.3
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-03-28 00:00:00.000000000 Z
12
+ date: 2017-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails