harlantwood / olive_branch

Handle camel/snake/dash case conversion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OliveBranch

Code Climate

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.

Install

  1. Add this to your Gemfile and then bundle install:

     gem "olive_branch"
    
  2. Add this to config/applcation.rb:

     config.middleware.use "OliveBranch::Middleware"
    

Use

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.


Code At Viget

Visit code.viget.com to see more projects from Viget.

About

Handle camel/snake/dash case conversion

License:MIT License


Languages

Language:Ruby 100.0%