riddl 0.130 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0742891c48e4c361fd8b4fdcdf7abfeb0004b87b9459b84833aa5f41ec28a142'
4
- data.tar.gz: 3a3ccce0767ac8efccb9c8277730e3d669e8a484d33aeb93a62e48032c656778
3
+ metadata.gz: 2fe9cdeb848b915475bf5f3c80230f639ef0c5e69385ef9d7cb86a4548aecfea
4
+ data.tar.gz: 4ac9fa0466fe4ab7572283c5f21ac2534ac0c0edcf47c34303bb21f329c053e9
5
5
  SHA512:
6
- metadata.gz: 6a781d0b86a3025b5a3273cc6808bd834edbe41a5633880a76b913df90c3ff109a0bc3fd4b326f99d6943ce04a4e8107850b538738ed1cc2dd69d1b420b758ab
7
- data.tar.gz: 795bdb0f17a9e12b6b1a99ad9fd58e4b2fe845fa4e48f95448ddc3dac8f029a7cf364d5dc287a86221a4178fdd1fd7bb38a95b6f1c644a6c47a356be76aa3636
6
+ metadata.gz: '08d2255f871869b12d2bfdcff552d4439b4f83b2b65bb7a81ff72c0169349159a5fb1b0bce77de2251358e883d1cde3c5070ffb633db1b85a457c95512975d40'
7
+ data.tar.gz: 8a83b5170d7d2c4b3259590843754eded7f30aadf97912ee5a8d7dd13c3ea60158fc28343bc695806d1ee2a8cf127a01e3b62631eb3f91b2c2d144a5ac2fecf9
@@ -11,6 +11,6 @@
11
11
  </endpoints>
12
12
  <handlerwrapper>Test</handlerwrapper>
13
13
  <description>lala</description>
14
- <state changed="2020-10-01T20:41:21+02:00">stopped</state>
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,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!
@@ -5,7 +5,7 @@
5
5
 
6
6
  <script type="text/javascript">
7
7
  function init() {
8
- es = new EventSource('http://localhost:9292/');
8
+ es = new EventSource('https://echo.bpm.in.tum.de/ssetest/');
9
9
  es.onopen = function() {
10
10
  output("onopen");
11
11
  };
@@ -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
- // if true (or any object for that matter) is returned, then 200 is sent
14
- // if false (or nil) is returned 404, the sse is denied
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
- Thread.new do
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/
@@ -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 do
155
- conn = Faye::WebSocket::Client.new((@base + @rpath).sub(/^http/,'ws'))
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
- end
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
- #:followlocation => true
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">
@@ -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,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.130"
3
+ s.version = "1.0.1"
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"
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.130'
4
+ version: 1.0.1
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: 2023-03-21 00:00:00.000000000 Z
14
+ date: 2024-02-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: daemonite
@@ -406,6 +406,8 @@ 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/server.rb
409
411
  - examples/simulate/test.rb
410
412
  - examples/sse/description.xml
411
413
  - examples/sse/sample.html
@@ -417,6 +419,7 @@ files:
417
419
  - examples/twitter/twitpic.xml
418
420
  - examples/twitter/twitter.xml
419
421
  - examples/websocket/client.rb
422
+ - examples/websocket/client.sh
420
423
  - examples/websocket/description.xml
421
424
  - examples/websocket/sample.html
422
425
  - examples/websocket/server.rb
@@ -551,7 +554,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
551
554
  - !ruby/object:Gem::Version
552
555
  version: '0'
553
556
  requirements: []
554
- rubygems_version: 3.4.6
557
+ rubygems_version: 3.4.10
555
558
  signing_key:
556
559
  specification_version: 4
557
560
  summary: 'Restful Interface Description and Declaration Language: tools and client/server