Categories: None [Edit]

jsonrpc2

https://rubygems.org/gems/jsonrpc2
https://github.com/livelink/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: 29,471 of 196,619
Downloads: 49,817

Daily

Ranking: 94,289 of 196,594
Downloads: 2

Depended by

RankDownloadsName

Depends on

RankDownloadsName
91,378,848,486json
121,348,609,914rack
251,151,960,126thor
291,020,353,632rspec
79605,547,865puma
90537,202,032httpclient
190287,390,553pry-byebug
1,02150,678,935RedCloth

Owners

#GravatarHandle
1icon#44891
2iconknarewski