Categories: None [Edit]
jsonrpc2
== 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
Total
Ranking: 28,241 of 186,995
Downloads: 46,237
Daily
Ranking: 44,780 of 186,959
Downloads: 14
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|
Depends on
Rank | Downloads | Name |
---|---|---|
8 | 1,144,415,803 | rack |
13 | 1,097,942,948 | json |
25 | 965,104,095 | thor |
27 | 909,782,048 | rspec |
84 | 483,448,313 | puma |
89 | 440,742,123 | httpclient |
172 | 251,650,597 | pry-byebug |
937 | 47,848,881 | RedCloth |