riddl 0.129 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +1 -0
- data/{INSTALL → INSTALL.md} +6 -4
- data/examples/properties/server.properties.xml +1 -1
- data/examples/recursive/description.xml +20 -0
- data/examples/recursive/riddlcheck +1 -0
- data/examples/recursive/server.rb +38 -0
- data/examples/sse/sample.html +1 -1
- data/examples/sse/server.rb +18 -9
- data/examples/websocket/client.rb +7 -5
- data/examples/websocket/client.sh +9 -0
- data/lib/ruby/riddl/client.rb +7 -5
- data/lib/ruby/riddl/ns/common-patterns/properties/1.0/properties.schema.xsl +1 -1
- data/lib/ruby/riddl/ns/description/1.0/description.rng +13 -1
- data/lib/ruby/riddl/utils/oauth2-helper.rb +4 -4
- data/ns/common-patterns/properties/1.0/properties.schema.xsl +1 -1
- data/ns/description/1.0/description.rng +13 -1
- data/riddl.gemspec +2 -2
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1165e53ea063eba2efa24ca6185499ac1b53883d5dc7304c1a38459a2a46689d
|
4
|
+
data.tar.gz: 6db6f0a89532c7b821ab7028ecd471177441a68922b7c7c82502264fd6568d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb2fd41778924d8dd9d7c7958aa84302bebe855730d7cc1577ac9fba069dd2246b8ef774e6a19e89196db18d9d1149535ad6d0559a39fd16e354f932f07d063
|
7
|
+
data.tar.gz: 3bcc2e81831a7c771925796f1c0123f92b0d31337fcf69687937793e1e27984bade37c4560c92f6f6be46f42e6e49265cb01f5bb87d58caeedaf132fd6dbe4b2
|
data/AUTHORS
CHANGED
data/{INSTALL → INSTALL.md}
RENAMED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
## Ubuntu & Debian
|
2
2
|
|
3
|
+
```bash
|
3
4
|
sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev ruby-dev build-essential ruby ruby
|
4
|
-
|
5
|
+
gem --user install pkg/riddl.gem
|
6
|
+
```
|
5
7
|
|
6
8
|
If "pkg/riddl.gem" not exists, then create it with "rake gem".
|
7
9
|
|
8
|
-
|
10
|
+
## Others
|
9
11
|
|
10
12
|
find out yourself
|
11
13
|
|
12
|
-
|
14
|
+
## Gem Dependencies
|
13
15
|
|
14
16
|
You don't need to care about them, as they will be automatically installed
|
15
17
|
during the installation of the riddl.gem. Here is a list of them just in case
|
@@ -11,6 +11,6 @@
|
|
11
11
|
</endpoints>
|
12
12
|
<handlerwrapper>Test</handlerwrapper>
|
13
13
|
<description>lala</description>
|
14
|
-
<state changed="
|
14
|
+
<state changed="2024-02-09T15:08:51+01:00">running</state>
|
15
15
|
<transformation>xxx</transformation>
|
16
16
|
</properties>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
2
|
+
|
3
|
+
<message name="test">
|
4
|
+
<parameter name="test" mimetype="text/plain"/>
|
5
|
+
</message>
|
6
|
+
<message name="sub">
|
7
|
+
<parameter name="sub" mimetype="text/plain"/>
|
8
|
+
</message>
|
9
|
+
|
10
|
+
<resource>
|
11
|
+
<get out="test"/>
|
12
|
+
<resource relative="hello" recursive="true">
|
13
|
+
<get out="test"/>
|
14
|
+
<resource relative="sub">
|
15
|
+
<get out="test"/>
|
16
|
+
</resource>
|
17
|
+
</resource>
|
18
|
+
</resource>
|
19
|
+
|
20
|
+
</description>
|
@@ -0,0 +1 @@
|
|
1
|
+
/home/mangler/Projects/riddl/tools/riddlcheck
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'pp'
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
|
4
|
+
|
5
|
+
class Test < Riddl::Implementation
|
6
|
+
def response
|
7
|
+
Riddl::Parameter::Complex.new("test","text/plain") do
|
8
|
+
<<-END
|
9
|
+
hello #{@r.length}
|
10
|
+
END
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Sub < Riddl::Implementation
|
16
|
+
def response
|
17
|
+
Riddl::Parameter::Complex.new("sub","text/plain") do
|
18
|
+
<<-END
|
19
|
+
sub #{@r.length}
|
20
|
+
END
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
Riddl::Server.new(File.dirname(__FILE__) + '/description.xml', :port => 9001, :bind => '::') do
|
27
|
+
accessible_description true
|
28
|
+
|
29
|
+
on resource do
|
30
|
+
run Test if get
|
31
|
+
on resource "hello" do
|
32
|
+
run Test if get
|
33
|
+
on resource "sub" do
|
34
|
+
run Sub if get
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end.loop!
|
data/examples/sse/sample.html
CHANGED
data/examples/sse/server.rb
CHANGED
@@ -4,32 +4,41 @@ require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server'
|
|
4
4
|
|
5
5
|
class Bar < Riddl::Implementation
|
6
6
|
def response
|
7
|
+
$connections.each do |c|
|
8
|
+
c.send('some data')
|
9
|
+
end
|
7
10
|
Riddl::Parameter::Complex.new("return","text/plain","hello world")
|
8
11
|
end
|
9
12
|
end
|
10
13
|
|
14
|
+
$connections = []
|
15
|
+
|
11
16
|
class Echo < Riddl::SSEImplementation
|
12
17
|
def onopen
|
13
|
-
|
14
|
-
|
18
|
+
# if true (or any object for that matter) is returned, then 200 is sent
|
19
|
+
# if false (or nil) is returned 404, the sse is denied
|
15
20
|
puts "Connection established"
|
16
|
-
|
17
|
-
1.upto 10 do |i|
|
18
|
-
send("oasch #{i}")
|
19
|
-
sleep 1
|
20
|
-
end
|
21
|
-
close
|
22
|
-
end
|
21
|
+
$connections << self
|
23
22
|
end
|
24
23
|
|
25
24
|
def onclose
|
26
25
|
puts "Connection closed"
|
26
|
+
$connections.delete(self)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
Riddl::Server.new(File.dirname(__FILE__) + '/description.xml', :port => 9292) do
|
31
31
|
cross_site_xhr true
|
32
32
|
|
33
|
+
parallel do
|
34
|
+
loop do
|
35
|
+
$connections.each do |c|
|
36
|
+
c.send('heartbeat')
|
37
|
+
end
|
38
|
+
sleep 15
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
33
42
|
on resource do
|
34
43
|
run Bar if get
|
35
44
|
run Bar if get 'rrrr'
|
@@ -6,17 +6,18 @@ ep = Riddl::Client.interface('http://localhost:9292/',File.join(__dir__,'/descri
|
|
6
6
|
test = ep.resource('/')
|
7
7
|
|
8
8
|
test.ws do |conn|
|
9
|
-
conn.on :open do
|
10
|
-
### called on connection
|
11
|
-
conn.send "Hello world"
|
12
|
-
conn.send "done"
|
13
|
-
end
|
14
9
|
|
15
10
|
conn.on :error do |e|
|
16
11
|
### called on error
|
17
12
|
puts "Got error: #{e}"
|
18
13
|
end
|
19
14
|
|
15
|
+
conn.on :open do
|
16
|
+
### called on connection
|
17
|
+
conn.send "Hello world"
|
18
|
+
conn.send "done"
|
19
|
+
end
|
20
|
+
|
20
21
|
conn.on :message do |msg|
|
21
22
|
### called when server responds
|
22
23
|
puts "<#{msg.data}>"
|
@@ -30,4 +31,5 @@ test.ws do |conn|
|
|
30
31
|
puts "gone"
|
31
32
|
EM::stop_event_loop
|
32
33
|
end
|
34
|
+
|
33
35
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
curl --include \
|
2
|
+
--no-buffer \
|
3
|
+
--header "Connection: Upgrade" \
|
4
|
+
--header "Upgrade: websocket" \
|
5
|
+
--header "Host: localhost:9292" \
|
6
|
+
--header "Origin: http://localhost:9292" \
|
7
|
+
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
|
8
|
+
--header "Sec-WebSocket-Version: 13" \
|
9
|
+
http://localhost:9292/
|
data/lib/ruby/riddl/client.rb
CHANGED
@@ -151,8 +151,10 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
151
151
|
attr_reader :rpath
|
152
152
|
|
153
153
|
def ws(&blk) #{{{
|
154
|
-
EM.run
|
155
|
-
|
154
|
+
EM.run {
|
155
|
+
url = (@base + @rpath).sub(/^http/,'ws')
|
156
|
+
url = url.sub(/:\/\/localhost/,'://127.0.0.1')
|
157
|
+
conn = Faye::WebSocket::Client.new(url)
|
156
158
|
|
157
159
|
if @options[:debug]
|
158
160
|
conn.on :error do |e|
|
@@ -161,7 +163,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
161
163
|
end
|
162
164
|
|
163
165
|
blk.call(conn)
|
164
|
-
|
166
|
+
}
|
165
167
|
end #}}}
|
166
168
|
|
167
169
|
def get(parameters = []) #{{{
|
@@ -354,8 +356,8 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
354
356
|
:method => riddl_method,
|
355
357
|
:headers => headers,
|
356
358
|
:body => tmp.read,
|
357
|
-
:ssl_verifypeer => false
|
358
|
-
|
359
|
+
:ssl_verifypeer => false,
|
360
|
+
:followlocation => true
|
359
361
|
}
|
360
362
|
if url.user && url.password
|
361
363
|
opts[:username] = Protocols::Utils::unescape(url.user)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<xsl:stylesheet version="1.0" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p="http://riddl.org/ns/common-patterns/properties/1.0">
|
3
3
|
<xsl:output method="xml" indent="yes"/>
|
4
4
|
|
5
|
-
<xsl:template match="/p:properties">
|
5
|
+
<xsl:template match="/p:properties" priority="1">
|
6
6
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
|
7
7
|
|
8
8
|
<start>
|
@@ -203,6 +203,12 @@
|
|
203
203
|
</define>
|
204
204
|
|
205
205
|
<define name="riddl-resource-recursive-choice">
|
206
|
+
<!--
|
207
|
+
It was a choice when no resources inside recursive resources were allowed.
|
208
|
+
Beacause i doubted that worked.
|
209
|
+
But it works just fine.
|
210
|
+
Maybe its bad for facades but i cant find cases for that.
|
211
|
+
Please report them if you find them.
|
206
212
|
<choice>
|
207
213
|
<attribute name="recursive">
|
208
214
|
<data type="boolean"/>
|
@@ -210,7 +216,13 @@
|
|
210
216
|
<group>
|
211
217
|
<ref name="riddl-resource-sub"/>
|
212
218
|
</group>
|
213
|
-
</choice
|
219
|
+
</choice-->
|
220
|
+
<optional>
|
221
|
+
<attribute name="recursive">
|
222
|
+
<data type="boolean"/>
|
223
|
+
</attribute>
|
224
|
+
</optional>
|
225
|
+
<ref name="riddl-resource-sub"/>
|
214
226
|
</define>
|
215
227
|
|
216
228
|
<define name="riddl-resource-dynamic">
|
@@ -25,7 +25,7 @@ module Riddl
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def key?(key)
|
28
|
-
@redis.exists(key)
|
28
|
+
@redis.exists?(key)
|
29
29
|
end
|
30
30
|
|
31
31
|
def each
|
@@ -40,9 +40,9 @@ module Riddl
|
|
40
40
|
|
41
41
|
def set(key,value,dur=nil)
|
42
42
|
value = value.is_a?(String) ? value.to_s : (JSON::generate(value) rescue '')
|
43
|
-
@redis.multi do
|
44
|
-
|
45
|
-
|
43
|
+
@redis.multi do |transaction|
|
44
|
+
transaction.set key, value
|
45
|
+
transaction.expire key, dur unless dur.nil?
|
46
46
|
end
|
47
47
|
nil
|
48
48
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<xsl:stylesheet version="1.0" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p="http://riddl.org/ns/common-patterns/properties/1.0">
|
3
3
|
<xsl:output method="xml" indent="yes"/>
|
4
4
|
|
5
|
-
<xsl:template match="/p:properties">
|
5
|
+
<xsl:template match="/p:properties" priority="1">
|
6
6
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
|
7
7
|
|
8
8
|
<start>
|
@@ -203,6 +203,12 @@
|
|
203
203
|
</define>
|
204
204
|
|
205
205
|
<define name="riddl-resource-recursive-choice">
|
206
|
+
<!--
|
207
|
+
It was a choice when no resources inside recursive resources were allowed.
|
208
|
+
Beacause i doubted that worked.
|
209
|
+
But it works just fine.
|
210
|
+
Maybe its bad for facades but i cant find cases for that.
|
211
|
+
Please report them if you find them.
|
206
212
|
<choice>
|
207
213
|
<attribute name="recursive">
|
208
214
|
<data type="boolean"/>
|
@@ -210,7 +216,13 @@
|
|
210
216
|
<group>
|
211
217
|
<ref name="riddl-resource-sub"/>
|
212
218
|
</group>
|
213
|
-
</choice
|
219
|
+
</choice-->
|
220
|
+
<optional>
|
221
|
+
<attribute name="recursive">
|
222
|
+
<data type="boolean"/>
|
223
|
+
</attribute>
|
224
|
+
</optional>
|
225
|
+
<ref name="riddl-resource-sub"/>
|
214
226
|
</define>
|
215
227
|
|
216
228
|
<define name="riddl-resource-dynamic">
|
data/riddl.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "riddl"
|
3
|
-
s.version = "0
|
3
|
+
s.version = "1.0"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
6
|
s.summary = "Restful Interface Description and Declaration Language: tools and client/server libs"
|
7
7
|
|
8
8
|
s.description = "REST service interface definition, mixing, and evolution. Supports mixed http and xmpp servers."
|
9
9
|
|
10
|
-
s.files = Dir['{lib/ruby/riddl/ns/**/*,tools/**/*,ns/**/*,contrib/**/*,lib/ruby/riddl/**/*,examples/**/*}'] + %w(COPYING Rakefile riddl.gemspec README.md TODO AUTHORS INSTALL)
|
10
|
+
s.files = Dir['{lib/ruby/riddl/ns/**/*,tools/**/*,ns/**/*,contrib/**/*,lib/ruby/riddl/**/*,examples/**/*}'] + %w(COPYING Rakefile riddl.gemspec README.md TODO AUTHORS INSTALL.md)
|
11
11
|
|
12
12
|
s.require_path = 'lib/ruby'
|
13
13
|
s.extra_rdoc_files = ['README.md']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen 'eTM' Mangler
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: tools
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: daemonite
|
@@ -261,7 +261,7 @@ extra_rdoc_files:
|
|
261
261
|
files:
|
262
262
|
- AUTHORS
|
263
263
|
- COPYING
|
264
|
-
- INSTALL
|
264
|
+
- INSTALL.md
|
265
265
|
- README.md
|
266
266
|
- Rakefile
|
267
267
|
- TODO
|
@@ -406,6 +406,9 @@ files:
|
|
406
406
|
- examples/propnew/server.properties.schema
|
407
407
|
- examples/propnew/server.properties.xml
|
408
408
|
- examples/propnew/test
|
409
|
+
- examples/recursive/description.xml
|
410
|
+
- examples/recursive/riddlcheck
|
411
|
+
- examples/recursive/server.rb
|
409
412
|
- examples/simulate/test.rb
|
410
413
|
- examples/sse/description.xml
|
411
414
|
- examples/sse/sample.html
|
@@ -417,6 +420,7 @@ files:
|
|
417
420
|
- examples/twitter/twitpic.xml
|
418
421
|
- examples/twitter/twitter.xml
|
419
422
|
- examples/websocket/client.rb
|
423
|
+
- examples/websocket/client.sh
|
420
424
|
- examples/websocket/description.xml
|
421
425
|
- examples/websocket/sample.html
|
422
426
|
- examples/websocket/server.rb
|
@@ -551,7 +555,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
551
555
|
- !ruby/object:Gem::Version
|
552
556
|
version: '0'
|
553
557
|
requirements: []
|
554
|
-
rubygems_version: 3.4.
|
558
|
+
rubygems_version: 3.4.10
|
555
559
|
signing_key:
|
556
560
|
specification_version: 4
|
557
561
|
summary: 'Restful Interface Description and Declaration Language: tools and client/server
|