olive_branch 2.1.4 → 2.1.5

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
  SHA256:
3
- metadata.gz: 3e39a8f70f61df011f30f51af0d4c57819ec0d905e59d90c59911915c5709e47
4
- data.tar.gz: f635a399ec1e1406e298f2787241b25b2878bdd2d8460f2fb3368d6fe069fb3c
3
+ metadata.gz: 30af0d59c0e8df679e1783b6cd3ce57d5c21798ecff3b667ac0f8fd8338d8574
4
+ data.tar.gz: d9351f2645900302d92b35a0d0ae3e74b76eac6896214afd78a28c2f622a6f6b
5
5
  SHA512:
6
- metadata.gz: 20b145eb4334cff4f2b2a1d009b5e353c9262bfcd944eef6f956f069163e95bdf4ac9fa49891f39011f4c94b4ff67b4cfa74dfb9f51e42dde26e27cc8741f686
7
- data.tar.gz: 33ddfa6fd29b2701a5505f7128454bd0dc553e76955db2be9adcd0852cae06f6709e285a5caf4d305c8609d8bec110dd3620d5edaa8a2429dbf7328da36dcfbc
6
+ metadata.gz: e4e60b68bacc722e63e6ea81d98879aa8b429c884380eee66603b991720feba73b87476da6c780430d83aea3ed706493d5691ee054c8ed8f5343cd36cd699bab
7
+ data.tar.gz: 9262f295bd14cb6babf280b6064be3ba0603497728e2bbd8d8ea782b5827d3652df381d7607991bbe9dc8c32edab41cefaef99caa566dd73014fe4cddfbbb332
data/README.md CHANGED
@@ -90,7 +90,11 @@ config.middleware.use OliveBranch::Middleware, exclude_response: -> (env) {
90
90
 
91
91
  ## Troubleshooting
92
92
 
93
- We've seen a few folks raise issues that inbound transformations are not taking place. This is often due to the fact that OliveBranch, by default, is only transforming keys when a request's Content-Type is `application/json`. If you would like to force inbound transformation on every request, you must define an override for the `content_type_check` functionality:
93
+ We've seen folks raise issues that inbound transformations are not taking place. This is often due to the fact that OliveBranch, by default, is only transforming keys when a request's Content-Type is `application/json`.
94
+
95
+ Note that your HTTP client library may suppress even a manually specified `Content-Type` header if the request body is empty (e.g. [Axios does this](https://github.com/axios/axios/issues/86)). This is a common gotcha for GET requests, the body of which are [often expected to be empty](https://stackoverflow.com/questions/978061/http-get-with-request-body) for reasons of caching. If you're seeing the middleware perform on POST or PATCH requests, but not GET requests, this may be your issue.
96
+
97
+ You may choose to force inbound transformation on every request by overriding the `content_type_check` functionality:
94
98
 
95
99
  ```ruby
96
100
  config.middleware.use OliveBranch::Middleware, content_type_check: -> (content_type) { true }
@@ -22,6 +22,10 @@ module OliveBranch
22
22
  end
23
23
  end
24
24
 
25
+ def pascalize(string)
26
+ string.underscore.camelize(:upper)
27
+ end
28
+
25
29
  def camelize(string)
26
30
  string.underscore.camelize(:lower)
27
31
  end
@@ -46,6 +50,7 @@ module OliveBranch
46
50
  @app = app
47
51
  @camelize = args[:camelize] || Transformations.method(:camelize)
48
52
  @dasherize = args[:dasherize] || Transformations.method(:dasherize)
53
+ @pascalize = args[:pascalize] || Transformations.method(:pascalize)
49
54
  @content_type_check = args[:content_type_check] || Checks.method(:content_type_check)
50
55
  @exclude_response = args[:exclude_response] || Checks.method(:default_exclude)
51
56
  @exclude_params = args[:exclude_params] || Checks.method(:default_exclude)
@@ -105,6 +110,8 @@ module OliveBranch
105
110
  @camelize
106
111
  elsif inflection == "dash"
107
112
  @dasherize
113
+ elsif inflection == 'pascal'
114
+ @pascalize
108
115
  else
109
116
  # probably misconfigured, do nothing
110
117
  -> (string) { string }
@@ -1,3 +1,3 @@
1
1
  module OliveBranch
2
- VERSION = '2.1.4'
2
+ VERSION = '2.1.5'
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: 2.1.4
4
+ version: 2.1.5
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: 2018-11-08 00:00:00.000000000 Z
12
+ date: 2019-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -95,20 +95,6 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: sqlite3
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
98
  description: Handle camel/snake/dash case conversion
113
99
  email:
114
100
  - eli.fatsi@viget.com
@@ -141,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
127
  - !ruby/object:Gem::Version
142
128
  version: '0'
143
129
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.6
130
+ rubygems_version: 3.0.1
146
131
  signing_key:
147
132
  specification_version: 4
148
133
  summary: Handle camel/snake/dash case conversion