No commit activity in last 3 years
No release in over 3 years
Rack Middleware to reduce size of json payload - Allows clients consuming json apis to select attributes within payload
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 0.10
~> 0.6
~> 10.4
~> 3.2
 Project Readme

Rack Adequate Json

Rack Middleware to reduce size of json payload - Allows clients consuming json api to select attributes within payload

Gem Version

Installation

Add this line to your application's Gemfile:

gem 'rack-adequate-json' , require: 'rack/adequate_json'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-adequate-json

Configure

Rails

#config/application.rb
module AppName
  class Application < Rails::Application
    # Middleware options
    # root: the root key for the json payload     , default: nil
    # target_param: query param of filter fields  , default: 'fields'
    config.middleware.use 'Rack::AdequateJson' , { root: 'data' }
  end
end

Sinatra

require 'rack/adequate_json'

class AppName < Sinatra::Base
  configure do
    # Middleware options
    # root: the root key for the json payload     , default: nil
    # target_param: query param of filter fields  , default: 'fields'
    use Rack::AdequateJson , { root: 'data' , target_param: 'select' }
  end
end

Contributing

  1. Fork it ( http://github.com//rack-adequate-json/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request