cpee-resources 1.0.4 → 1.0.5
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.
- checksums.yaml +4 -4
- data/cpee-resources.gemspec +1 -1
- data/lib/cpee-resources/implementation.rb +15 -0
- data/lib/cpee-resources/implementation.xml +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c779e7c093de8fd15fc052eb3ffc79022eb27184dd6efe13a7b5176c87be9f41
|
|
4
|
+
data.tar.gz: ce0020d0765e0453d72be9159ddbe85cc049ea296849e2900165fad7315d0b48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a5c8e568f3106b06e867dcd1cdac805e945bae4d18a5b7866734cc8f62de856a93f10e39f9c86e2c4486533f8e44635785cc33c240db26254d3a12f75ec53c1
|
|
7
|
+
data.tar.gz: 183855b2718a0c60bb2a7e36bf565e26c011496578b4e2eb6040bb03cb37d228f8c809b94c786dd06da6e228b87c1ea5635adfe9e94451c7404e3f95dd6eed7f
|
data/cpee-resources.gemspec
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
# <http://www.gnu.org/licenses/>.
|
|
18
18
|
|
|
19
19
|
require 'json'
|
|
20
|
+
require 'fileutils'
|
|
20
21
|
require 'riddl/server'
|
|
21
22
|
|
|
22
23
|
module CPEE
|
|
@@ -182,6 +183,19 @@ module CPEE
|
|
|
182
183
|
Riddl::Parameter::Complex.new('exists','text/plain','Endpoint already exists.')
|
|
183
184
|
end
|
|
184
185
|
end #}}}
|
|
186
|
+
class DoDeleteEndpoint < Riddl::Implementation #{{{
|
|
187
|
+
def response
|
|
188
|
+
data = @a[1]
|
|
189
|
+
dir = File.join(data,@a[0],Riddl::Protocols::Utils::escape(@r[-1]))
|
|
190
|
+
if Dir.exist?(dir)
|
|
191
|
+
FileUtils.rm_r(dir)
|
|
192
|
+
nil
|
|
193
|
+
else
|
|
194
|
+
@status = 404
|
|
195
|
+
Riddl::Parameter::Complex.new('exists','text/plain',NOT_FOUND)
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end #}}}
|
|
185
199
|
class DoList < Riddl::Implementation #{{{
|
|
186
200
|
def response
|
|
187
201
|
data = @a[1]
|
|
@@ -269,6 +283,7 @@ module CPEE
|
|
|
269
283
|
run DoNewEndpoint, 'endpoints', opts[:data_dir] if post 'endpoint'
|
|
270
284
|
on resource do
|
|
271
285
|
run DoList, 'endpoints', opts[:data_dir], (-1..-1), true, %w{schema.rng symbol.svg properties.json descriptions}, %w{properties.json} if get
|
|
286
|
+
run DoDeleteEndpoint, 'endpoints', opts[:data_dir] if delete
|
|
272
287
|
on resource 'symbol.svg' do
|
|
273
288
|
run DoFile, 'endpoints', opts[:data_dir], (-2..-1), 'svg', 'image/svg+xml' if get
|
|
274
289
|
run DoPutEndpointFile, 'endpoints', opts[:data_dir], 'symbols' if put 'endpoint-symbol'
|