durable_rules 0.34.24 → 0.34.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/librb/interface.rb +66 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a3b11e8993e80451ad1001ff1f0c9c31fd6805
|
4
|
+
data.tar.gz: 4d436b5a56d8affe7c75e885f249be34b48311d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df2fb88c7319a64326307b8637956ad7be52264bf5fa7f9c7ffa245adb454933078a4f15f3891f0348786bd0e4346aa5b887c1794b65e84989e90eedbba6ca12
|
7
|
+
data.tar.gz: 7e0fdf192e0fef72bcbd2e60493a8930b46fc469e89b7355a651158b58c6e0381fc2ec67e138f459ec9bbc6caf0fcafb34ece69ec01cbec60c74c2a508d545e0
|
data/librb/interface.rb
CHANGED
@@ -9,7 +9,7 @@ module Interface
|
|
9
9
|
@@host = value
|
10
10
|
end
|
11
11
|
|
12
|
-
get "/:ruleset_name/:sid" do
|
12
|
+
get "/:ruleset_name/state/:sid" do
|
13
13
|
begin
|
14
14
|
JSON.generate @@host.get_state(params["ruleset_name"], params["sid"])
|
15
15
|
rescue Exception => e
|
@@ -18,7 +18,41 @@ module Interface
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
post "/:ruleset_name/:sid" do
|
21
|
+
post "/:ruleset_name/state/:sid" do
|
22
|
+
begin
|
23
|
+
request.body.rewind
|
24
|
+
state = JSON.parse request.body.read
|
25
|
+
state["id"] = params["sid"]
|
26
|
+
result = @@host.patch_state(params["ruleset_name"], state)
|
27
|
+
JSON.generate({:outcome => result})
|
28
|
+
rescue Exception => e
|
29
|
+
status 500
|
30
|
+
e.to_s
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
get "/:ruleset_name/state" do
|
35
|
+
begin
|
36
|
+
JSON.generate @@host.get_state(params["ruleset_name"], "0")
|
37
|
+
rescue Exception => e
|
38
|
+
status 404
|
39
|
+
e.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
post "/:ruleset_name/state" do
|
44
|
+
begin
|
45
|
+
request.body.rewind
|
46
|
+
state = JSON.parse request.body.read
|
47
|
+
result = @@host.patch_state(params["ruleset_name"], state)
|
48
|
+
JSON.generate({:outcome => result})
|
49
|
+
rescue Exception => e
|
50
|
+
status 500
|
51
|
+
e.to_s
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
post "/:ruleset_name/events/:sid" do
|
22
56
|
begin
|
23
57
|
request.body.rewind
|
24
58
|
message = JSON.parse request.body.read
|
@@ -31,12 +65,36 @@ module Interface
|
|
31
65
|
end
|
32
66
|
end
|
33
67
|
|
34
|
-
|
68
|
+
post "/:ruleset_name/events" do
|
35
69
|
begin
|
36
70
|
request.body.rewind
|
37
|
-
|
38
|
-
|
39
|
-
|
71
|
+
message = JSON.parse request.body.read
|
72
|
+
result = @@host.post(params["ruleset_name"], message)
|
73
|
+
JSON.generate({:outcome => result})
|
74
|
+
rescue Exception => e
|
75
|
+
status 500
|
76
|
+
e.to_s
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
post "/:ruleset_name/fact/:sid" do
|
81
|
+
begin
|
82
|
+
request.body.rewind
|
83
|
+
message = JSON.parse request.body.read
|
84
|
+
message["sid"] = params["sid"]
|
85
|
+
result = @@host.assert(params["ruleset_name"], message)
|
86
|
+
JSON.generate({:outcome => result})
|
87
|
+
rescue Exception => e
|
88
|
+
status 500
|
89
|
+
e.to_s
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
post "/:ruleset_name/facts" do
|
94
|
+
begin
|
95
|
+
request.body.rewind
|
96
|
+
message = JSON.parse request.body.read
|
97
|
+
result = @@host.assert(params["ruleset_name"], message)
|
40
98
|
JSON.generate({:outcome => result})
|
41
99
|
rescue Exception => e
|
42
100
|
status 500
|
@@ -44,7 +102,7 @@ module Interface
|
|
44
102
|
end
|
45
103
|
end
|
46
104
|
|
47
|
-
get "/:ruleset_name" do
|
105
|
+
get "/:ruleset_name/definition" do
|
48
106
|
begin
|
49
107
|
@@host.get_ruleset(params["ruleset_name"]).to_json
|
50
108
|
rescue Exception => e
|
@@ -53,7 +111,7 @@ module Interface
|
|
53
111
|
end
|
54
112
|
end
|
55
113
|
|
56
|
-
post "/:ruleset_name" do
|
114
|
+
post "/:ruleset_name/definition" do
|
57
115
|
begin
|
58
116
|
request.body.rewind
|
59
117
|
@@host.set_ruleset params["ruleset_name"], JSON.parse(request.body.read)
|