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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/librb/interface.rb +66 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a4ba28ab92f56567a70857c565e48bffc95e8b5
4
- data.tar.gz: e1cbe2d01c35bcadd14084b78d1e96ec5037271c
3
+ metadata.gz: 65a3b11e8993e80451ad1001ff1f0c9c31fd6805
4
+ data.tar.gz: 4d436b5a56d8affe7c75e885f249be34b48311d0
5
5
  SHA512:
6
- metadata.gz: e6606fba477f54cc6f76f8cd384aef942c5840ad206380af8c3b00e0edfb8101839278188063f622da768c4597c5be6e0a26e6ca379bcd44de21556eb644aa48
7
- data.tar.gz: 6bfd931f12dc5e24b02f5227d9600c5b9b342d44485e1a47e5ed1a39b85c56fd21ebde19f24c4d075c968b1068ce7c7c153c089ff5e6922dca2c1c5372fb2911
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
- patch "/:ruleset_name/:sid" do
68
+ post "/:ruleset_name/events" do
35
69
  begin
36
70
  request.body.rewind
37
- state = JSON.parse request.body.read
38
- state["id"] = params["sid"]
39
- result = @@host.patch_state(params["ruleset_name"], state)
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.24
4
+ version: 0.34.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz