integrity-nabaztag 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/lib/integrity/notifier/config.haml +8 -0
- data/lib/integrity/notifier/nabaztag.rb +37 -0
- data/vendor/nabaztag-ruby/.gitignore +1 -0
- data/vendor/nabaztag-ruby/CHANGES +18 -0
- data/vendor/nabaztag-ruby/README +22 -0
- data/vendor/nabaztag-ruby/Rakefile +49 -0
- data/vendor/nabaztag-ruby/bin/nabaztag-say +97 -0
- data/vendor/nabaztag-ruby/lib/nabaztag.rb +160 -0
- data/vendor/nabaztag-ruby/lib/nabaztag/choreography.rb +119 -0
- data/vendor/nabaztag-ruby/lib/nabaztag/message.rb +75 -0
- data/vendor/nabaztag-ruby/lib/nabaztag/response.rb +78 -0
- data/vendor/nabaztag-ruby/sample/build.rb +35 -0
- data/vendor/nabaztag-ruby/sample/demo.rb +42 -0
- data/vendor/nabaztag-ruby/sample/interactive.rb +40 -0
- data/vendor/nabaztag-ruby/sample/speech.rb +39 -0
- data/vendor/nabaztag-ruby/setup.rb +1551 -0
- data/vendor/nabaztag-ruby/test/choreography_test.rb +42 -0
- data/vendor/nabaztag-ruby/test/message_test.rb +34 -0
- data/vendor/nabaztag-ruby/test/response_test.rb +32 -0
- metadata +75 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
$: << File.dirname(__FILE__) + '/../lib/'
|
2
|
+
require 'nabaztag/choreography'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class ChoreographyTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
class Choreography < Nabaztag::Choreography
|
8
|
+
attr_reader :messages
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_reproduce_api_example_2
|
12
|
+
ch = Choreography.new{
|
13
|
+
ear :left, 20, :forward
|
14
|
+
}
|
15
|
+
assert_equal ['0,motor,1,20,0,0'], ch.messages
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_reproduce_api_example_3
|
19
|
+
ch = Choreography.new{
|
20
|
+
length 2 do
|
21
|
+
led :middle, 0, 238, 0
|
22
|
+
end
|
23
|
+
led :left, 250, 0, 0
|
24
|
+
led :middle, :off
|
25
|
+
}
|
26
|
+
assert_equal ['0,led,2,0,238,0','2,led,1,250,0,0','3,led,2,0,0,0'], ch.messages
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_should_reproduce_api_example_4
|
30
|
+
ch = Choreography.new{
|
31
|
+
tempo 10
|
32
|
+
together 2 do
|
33
|
+
ear :left, 20, :forward
|
34
|
+
led :middle, 0, 238, 0
|
35
|
+
end
|
36
|
+
led :left, 250, 0, 0
|
37
|
+
led :middle, :off
|
38
|
+
}
|
39
|
+
assert_equal '10,0,motor,1,20,0,0,0,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0', ch.build
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
$: << File.dirname(__FILE__) + '/../lib/'
|
2
|
+
require 'nabaztag/message'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class NabaztagMessageTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
MAC = 'ABC123'
|
8
|
+
TOKEN = 'DEF456'
|
9
|
+
|
10
|
+
class Message < Nabaztag::Message
|
11
|
+
public :request_uri
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :message
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@message = Message.new(MAC, TOKEN)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_construct_url_with_mac_and_token
|
21
|
+
assert_equal 'http://api.nabaztag.com/vl/FR/api.jsp?sn=ABC123&token=DEF456', message.request_uri
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_should_escape_parameters_as_utf_8
|
25
|
+
message.tts = "équipe"
|
26
|
+
assert_match %r!tts=%C3%A9quipe!n, message.request_uri
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_should_send_actions
|
30
|
+
message.action = (:get_timezone)
|
31
|
+
assert_match %r!action=4!n, message.request_uri
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$: << File.dirname(__FILE__) + '/../lib/'
|
2
|
+
require 'nabaztag/response'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class NabaztagResponseTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
TTS_RESPONSE = '<?xml version="1.0" encoding="UTF-8"?><rsp><message>TTSSEND</message><comment>Your text has been sent</comment></rsp>'
|
8
|
+
EAR_RESPONSE = '<rsp><message>POSITIONEAR</message><leftposition>10</leftposition><rightposition>5</rightposition></rsp>'
|
9
|
+
|
10
|
+
def test_should_extract_message_from_XML_response
|
11
|
+
response = Nabaztag::Response.new(TTS_RESPONSE)
|
12
|
+
assert_equal ['TTSSEND'], response.messages
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_extract_comment_from_XML_response
|
16
|
+
response = Nabaztag::Response.new(TTS_RESPONSE)
|
17
|
+
assert_equal ['Your text has been sent'], response.comments
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_find_ear_positions_if_supplied
|
21
|
+
response = Nabaztag::Response.new(EAR_RESPONSE)
|
22
|
+
assert_equal 10, response.left_ear
|
23
|
+
assert_equal 5, response.right_ear
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_return_nil_for_unknown_ear_positions
|
27
|
+
response = Nabaztag::Response.new(TTS_RESPONSE)
|
28
|
+
assert_nil response.left_ear
|
29
|
+
assert_nil response.right_ear
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: integrity-nabaztag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Morrison
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-08 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A Nabaztag notifier for integrity
|
17
|
+
email: daniel@collectiveidea.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- Rakefile
|
26
|
+
- VERSION
|
27
|
+
- lib/integrity/notifier/config.haml
|
28
|
+
- lib/integrity/notifier/nabaztag.rb
|
29
|
+
- vendor/nabaztag-ruby/.gitignore
|
30
|
+
- vendor/nabaztag-ruby/CHANGES
|
31
|
+
- vendor/nabaztag-ruby/README
|
32
|
+
- vendor/nabaztag-ruby/Rakefile
|
33
|
+
- vendor/nabaztag-ruby/bin/nabaztag-say
|
34
|
+
- vendor/nabaztag-ruby/lib/nabaztag.rb
|
35
|
+
- vendor/nabaztag-ruby/lib/nabaztag/choreography.rb
|
36
|
+
- vendor/nabaztag-ruby/lib/nabaztag/message.rb
|
37
|
+
- vendor/nabaztag-ruby/lib/nabaztag/response.rb
|
38
|
+
- vendor/nabaztag-ruby/sample/build.rb
|
39
|
+
- vendor/nabaztag-ruby/sample/demo.rb
|
40
|
+
- vendor/nabaztag-ruby/sample/interactive.rb
|
41
|
+
- vendor/nabaztag-ruby/sample/speech.rb
|
42
|
+
- vendor/nabaztag-ruby/setup.rb
|
43
|
+
- vendor/nabaztag-ruby/test/choreography_test.rb
|
44
|
+
- vendor/nabaztag-ruby/test/message_test.rb
|
45
|
+
- vendor/nabaztag-ruby/test/response_test.rb
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: http://github.com/collectiveidea/integrity-nabaztag
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- --charset=UTF-8
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.3.5
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: A Nabaztag notifier for integrity
|
74
|
+
test_files: []
|
75
|
+
|