Skip to content

dzjuck/json-rpc2rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Json-Rpc To Rest

Middleware to make inner redirect for Json-Rpc requests.

Gem Version Build Status Coverage Status Code Climate Dependency Status

Installation

gem install json-rpc2rest

or add the following line to Gemfile:

gem 'json-rpc2rest'

and run bundle install from your shell.

After that add line to config/application.rb

config.middleware.use 'Json-Rpc2Rest'

Also you can specify field with method name

config.middleware.use 'Json-Rpc2Rest', field: 'requestMethod'

Default field is "method" as in specification.

Example

# config/application.rb
config.middleware.use 'JsonRpcToRest'

Post request to /api with params

{"method": "get_posts_list", "data": [], "id": 2}

will be processed as /api/get_posts_list with same params.

Tests

git clone https://github.com/dzjuck/json-rpc2rest.git
cd json-rpc2rest
bundle install
rspec

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Json-Rpc to Rest rack middleware

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages