Format URL parameters like a query. It allows you to send operators and the same parameter twice on the same request.
For example:
http://domain.com/search?filters=age::ge(18)|age::le(25)
Add this line to your application's Gemfile:
gem 'query_params'
And then execute:
$ bundle
Or install it yourself as:
$ gem install query_params
# Only query params
URI::QueryParams.filters(["type = 1", "height <= 2", "age between 18 and 21", "status in(1,3,5)"])
# => "type::eq(1)|height::le(2)|age::bt(18,21)|status::in(1,3,5)"
# Complete URI
URI::QueryParams.build_uri(base_uri: "http://domain.com/search", q: "Mark", filters: ["age <= 18"])
# => "http://domain.com/search?q=Mark&filters=age::le(18)"
- Fork it ( https://github.com/willmiranda/query_params/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request