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.
-
Add this to your Gemfile and then
bundle install
:gem "olive_branch"
-
Add this to
config/applcation.rb
:config.middleware.use "OliveBranch::Middleware"
Include a X-Key-Inflection
header with values of camel
, dash
, or snake
in your JSON API requests.
For more examples, see our blog post.
OliveBranch is released under the MIT License. See MIT-LICENSE for further details.
Visit code.viget.com to see more projects from Viget.