riddl 0.100.0 → 0.100.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +0,0 @@
1
- #!/usr/bin/ruby
2
- # encoding: UTF-8
3
- require 'rubygems'
4
- require 'blather/client/dsl'
5
- require 'xml/smart'
6
- require 'pp'
7
-
8
- XR_NS = 'http://riddl.org/ns/xmpp-rest'.freeze
9
-
10
- class Stanza < Blather::Stanza
11
- def self.new
12
- node = super :message
13
- node.type = :normal
14
- node.id = SecureRandom.uuid
15
- node
16
- end
17
- end
18
-
19
- module Test
20
- extend Blather::DSL
21
- def self.run; client.run; end
22
-
23
- setup 'jürgen@fp7-adventure.eu', 'mangler'
24
- when_ready do
25
- p 'sss'
26
- stanza = Stanza.new
27
- node = XML::Smart::Dom::Element.new(stanza)
28
- stanza.to = "adventure_processinstantiation@fp7-adventure.eu"
29
- n = node.add 'part', "a" * 1000045
30
- n.namespaces.add(nil,XR_NS)
31
- s = stanza.to_s
32
- puts s.length
33
- write_to_stream stanza
34
- puts 'a'
35
- sleep 10000
36
- puts 'b'
37
- end
38
- end
39
-
40
- trap(:INT) { EM.stop }
41
- trap(:TERM) { EM.stop }
42
- EM.run do
43
- Test.run
44
- end
@@ -1,18 +0,0 @@
1
- #!/usr/bin/ruby
2
- # encoding: UTF-8
3
- require 'rubygems'
4
- require 'riddl/client'
5
-
6
- srv = Riddl::Client.new("xmpp://adventure_processinstantiation@fp7-adventure.eu","http://fp7-adventure.eu:9296/?riddl-description",:jid => 'jürgen@fp7-adventure.eu', :pass => 'mangler', :debug => STDOUT)
7
- res = srv.resource("/")
8
- status, response = res.post [
9
- Riddl::Parameter::Complex.new("xml","application/xml",File.read('description.xml')),
10
- Riddl::Parameter::Simple.new("targetmode","ready")
11
- ]
12
- p status
13
- ins = response[0].value
14
- p ins
15
-
16
- res = srv.resource("/#{ins}")
17
- status, response = res.get
18
- p status
@@ -1,40 +0,0 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'blather/client/dsl'
4
- $stdout.sync = true
5
-
6
- module Ping
7
- extend Blather::DSL
8
- def self.run; client.run; end
9
-
10
- setup 'jürgen@fp7-adventure.eu', 'mangler'
11
-
12
- status do |s|
13
- p s
14
- puts "serve!"
15
- say s.from, 'ping'
16
- end
17
-
18
- message :chat?, :body => 'pong' do |m|
19
- puts "ping!"
20
- say m.from, 'ping'
21
- end
22
- end
23
-
24
- module Pong
25
- extend Blather::DSL
26
- def self.run; client.run; end
27
-
28
- setup 'adventure_processexecution@fp7-adventure.eu', 'adventure_processexecution'
29
- message :chat?, :body => 'ping' do |m|
30
- puts "pong!"
31
- say m.from, 'pong'
32
- end
33
- end
34
-
35
- trap(:INT) { EM.stop }
36
- trap(:TERM) { EM.stop }
37
- EM.run do
38
- Ping.run
39
- Pong.run
40
- end
@@ -1,32 +0,0 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'blather/client/dsl'
4
-
5
- module App
6
- extend Blather::DSL
7
-
8
- def self.run
9
- EM.run { client.run }
10
- end
11
-
12
- setup 'jürgen@fp7-adventure.eu', 'mangler'
13
-
14
- when_ready do
15
- puts "i'm ready"
16
- end
17
-
18
- # Auto approve subscription requests
19
- subscription :request? do |s|
20
- write_to_stream s.approve!
21
- end
22
-
23
- # Echo back what was said
24
- message :chat?, :body do |m|
25
- write_to_stream m.reply
26
- end
27
- end
28
-
29
- trap(:INT) { EM.stop }
30
- trap(:TERM) { EM.stop }
31
-
32
- App.run