RubyGems Navigation menu

jsonrpc2 0.3.0

Description

A Rack compatible JSON-RPC2 server domain specific language (DSL) - allows JSONRPC APIs to be defined as mountable Rack applications with inline documentation, authentication and type checking.

e.g.

class Calculator < JSONRPC2::Interface
  title "JSON-RPC2 Calculator"
  introduction "This interface allows basic maths calculations via JSON-RPC2"
  auth_with JSONRPC2::BasicAuth.new({'user' => 'secretword'})

  section 'Simple Ops' do
      desc 'Multiply two numbers'
      param 'a', 'Number', 'a'
      param 'b', 'Number', 'b'
      result 'Number', 'a * b'
      def mul args
        args['a'] * args['b']
      end

      desc 'Add numbers'
      example "Calculate 1 + 1 = 2", :params => { 'a' => 1, 'b' => 1}, :result => 2

      param 'a', 'Number', 'First number'
      param 'b', 'Number', 'Second number'
      optional 'c', 'Number', 'Third number'
      result 'Number', 'a + b + c'
      def sum args
        val = args['a'] + args['b']
        val += args['c'] if args['c']
        val
      end
  end
end

Gemfile:
=

安裝:
=

版本列表:

  1. 0.3.0 February 10, 2023 (132.0 KB)
  2. 0.2.0 April 14, 2022 (132.0 KB)
  3. 0.1.1 January 04, 2014 (127.5 KB)
  4. 0.1.0 January 04, 2014 (127.0 KB)
  5. 0.0.9 September 03, 2012 (94.5 KB)
顯示所有版本(共 13)

Runtime 相依性套件 (4):

httpclient >= 0
json >= 0
RedCloth >= 0
thor >= 0

Development 相依性套件 (4):

pry-byebug >= 0
puma >= 0
rack >= 0
rspec >= 0

擁有者:

推送者:

作者:

  • Geoff Youngs

SHA 256 總和檢查碼:

=

總下載次數 44,581

這個版本 2,679

版本发布:

授權:

Ruby 版本需求: >= 0

相關連結: