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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1003430e098e5da7f06c8b10bf05e5fbaad73609
4
- data.tar.gz: fd1d42c19334bf3afcce7da25e36affc58ce1836
3
+ metadata.gz: 3e65696dd80713050ce9baff9d3ae61288bedaa6
4
+ data.tar.gz: 2d258e82c9218d840c49fae82c042e84ed5a60b3
5
5
  SHA512:
6
- metadata.gz: 33354c35884b50bf2a270b23e9f0ab465fb96b20114254cb01d661102b1c64cf93b1bbfcf0a17ea77425a732dd21a10d0d6e13630f401a2d9bda13257c7787f9
7
- data.tar.gz: 86dbfc19f6350351ba615e242c9235f42eed5d78217894118028a3dcaa1195352732822687483b395cc5a5b71c13f398b8e1acd6a43e103c2c938d10290a54de
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.deep_transform_keys! { |k| k.camelize(:lower) }
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.deep_transform_keys!(&:dasherize)
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 < 5
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
@@ -1,3 +1,3 @@
1
1
  module OliveBranch
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.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: 1.2.0
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-10-10 00:00:00.000000000 Z
12
+ date: 2016-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails