About

This is an implementation of JSON RPC 2.0 server

Using

To make your rails controller JSON RPC 2.0 callable, make next include:

class TestController < ActionController::Base
  include JSONServer

  def summ(left, right)
    return left+right
  end
end

In your config/routing.rb you will have to add

post 'json'     => 'test#index'

JSONServer will automaticaly check if posted json is valid JSON-RPC 2.0 request and and fire called method. if method is not found - propper error will be sent.

Batch request are handled.

Errors

You can raise standart errors, or JSONServer::Error with parameters :code, :message, :data, which will be set for correspoding fields :code defaults to -30000 if JSONServer::Error and to -32000 otherwise :message defaults to “Runtime Error”

TODO list

write tests