jsonrpc2 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/jsonrpc2.gemspec +31 -29
- data/lib/jsonrpc2/version.rb +1 -1
- metadata +31 -29
data/jsonrpc2.gemspec
CHANGED
@@ -5,39 +5,41 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["Geoff Youngs"]
|
6
6
|
gem.email = ["git@intersect-uk.co.uk"]
|
7
7
|
gem.description = <<-EOD
|
8
|
-
|
9
|
-
|
8
|
+
== Description
|
9
|
+
|
10
|
+
A Rack compatible JSON-RPC2 server domain specific language (DSL) - allows JSONRPC APIs to be
|
11
|
+
defined as mountable Rack applications with inline documentation, authentication and type checking.
|
10
12
|
|
11
13
|
e.g.
|
12
14
|
|
13
|
-
class Calculator < JSONRPC2::Interface
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
15
|
+
class Calculator < JSONRPC2::Interface
|
16
|
+
title "JSON-RPC2 Calculator"
|
17
|
+
introduction "This interface allows basic maths calculations via JSON-RPC2"
|
18
|
+
auth_with JSONRPC2::BasicAuth.new({'user' => 'secretword'})
|
19
|
+
|
20
|
+
section 'Simple Ops' do
|
21
|
+
desc 'Multiply two numbers'
|
22
|
+
param 'a', 'Number', 'a'
|
23
|
+
param 'b', 'Number', 'b'
|
24
|
+
result 'Number', 'a * b'
|
25
|
+
def mul args
|
26
|
+
args['a'] * args['b']
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Add numbers'
|
30
|
+
example "Calculate 1 + 1 = 2", :params => { 'a' => 1, 'b' => 1}, :result => 2
|
31
|
+
|
32
|
+
param 'a', 'Number', 'First number'
|
33
|
+
param 'b', 'Number', 'Second number'
|
34
|
+
optional 'c', 'Number', 'Third number'
|
35
|
+
result 'Number', 'a + b + c'
|
36
|
+
def sum args
|
37
|
+
val = args['a'] + args['b']
|
38
|
+
val += args['c'] if args['c']
|
39
|
+
val
|
40
|
+
end
|
41
|
+
end
|
39
42
|
end
|
40
|
-
end
|
41
43
|
|
42
44
|
EOD
|
43
45
|
gem.summary = %q{JSON-RPC2 server DSL}
|
data/lib/jsonrpc2/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonrpc2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Geoff Youngs
|
@@ -60,39 +60,41 @@ dependencies:
|
|
60
60
|
type: :development
|
61
61
|
version_requirements: *id003
|
62
62
|
description: |+
|
63
|
-
|
64
|
-
|
63
|
+
== Description
|
64
|
+
|
65
|
+
A Rack compatible JSON-RPC2 server domain specific language (DSL) - allows JSONRPC APIs to be
|
66
|
+
defined as mountable Rack applications with inline documentation, authentication and type checking.
|
65
67
|
|
66
68
|
e.g.
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
class Calculator < JSONRPC2::Interface
|
71
|
+
title "JSON-RPC2 Calculator"
|
72
|
+
introduction "This interface allows basic maths calculations via JSON-RPC2"
|
73
|
+
auth_with JSONRPC2::BasicAuth.new({'user' => 'secretword'})
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
section 'Simple Ops' do
|
76
|
+
desc 'Multiply two numbers'
|
77
|
+
param 'a', 'Number', 'a'
|
78
|
+
param 'b', 'Number', 'b'
|
79
|
+
result 'Number', 'a * b'
|
80
|
+
def mul args
|
81
|
+
args['a'] * args['b']
|
82
|
+
end
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
+
desc 'Add numbers'
|
85
|
+
example "Calculate 1 + 1 = 2", :params => { 'a' => 1, 'b' => 1}, :result => 2
|
84
86
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
param 'a', 'Number', 'First number'
|
88
|
+
param 'b', 'Number', 'Second number'
|
89
|
+
optional 'c', 'Number', 'Third number'
|
90
|
+
result 'Number', 'a + b + c'
|
91
|
+
def sum args
|
92
|
+
val = args['a'] + args['b']
|
93
|
+
val += args['c'] if args['c']
|
94
|
+
val
|
95
|
+
end
|
96
|
+
end
|
94
97
|
end
|
95
|
-
end
|
96
98
|
|
97
99
|
email:
|
98
100
|
- git@intersect-uk.co.uk
|