Skip to content

Repository files navigation

JSON API query parser

Gem VersionBuild StatusMaintainabilityTest Coverage

To be used for ruby projects that make use of JSON API

Installation

$ gem install json_api_query_parser

Or in the gemfile of the rails project

gem'json_api_query_parser'

Usage

Require the gem 'json_api_query_parser' into your application and use the 'parse_request' method to convert the request.url to an easy usable Hash.

require('json_api_query_parser')JsonApiQueryParser.parse_request("movies/5?include=actors,actors.agency&fields[movies]=title,year&fields[actors]=name&page[limit]=20")

Return data information

The Hash returned by the JsonApiQueryParser.parse_request will always be the same structure.

{:resource_type=>"movies",:identifier=>"5",:query_data=>{:include=>["actors","actors.agency"],:fields=>{:movies=>["title","year"],:actors=>["name"]},:page=>{"limit"=>"20"}}}

About

Parse JSON API endpoint and its query parameters to a usable Hash

Topics

Resources

Code of conduct

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages