libastag 0.0.1 → 0.0.2
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.
- data/BUGS +10 -0
- data/CHANGES +8 -1
- data/MIT-LICENSE +2 -1
- data/README +7 -3
- data/Rakefile +3 -2
- data/TODO +4 -7
- data/doc/classes/Helpers.html +16 -20
- data/doc/classes/Helpers/REXML.html +4 -4
- data/doc/classes/Helpers/REXML/Attributes.html +10 -10
- data/doc/classes/Libastag.html +5 -5
- data/doc/classes/Libastag/Rabbit.html +56 -56
- data/doc/classes/Libastag/RabitEar.html +4 -4
- data/doc/classes/Libastag/RabitLed.html +4 -4
- data/doc/classes/Request.html +33 -37
- data/doc/classes/Request/Action.html +34 -34
- data/doc/classes/Request/AudioStream.html +313 -0
- data/doc/classes/Request/Base.html +13 -10
- data/doc/classes/Request/Base/Event.html +58 -23
- data/doc/classes/Request/Base/EventCollection.html +35 -32
- data/doc/classes/Request/Choregraphy.html +500 -0
- data/doc/classes/Request/Choregraphy/BadChorDesc.html +135 -0
- data/doc/classes/Request/Choregraphy/Ears.html +130 -0
- data/doc/classes/Request/Choregraphy/Ears/Directions.html +141 -0
- data/doc/classes/Request/Choregraphy/Ears/Positions.html +146 -0
- data/doc/classes/Request/Choregraphy/Leds.html +130 -0
- data/doc/classes/Request/Choregraphy/Leds/Colors.html +171 -0
- data/doc/classes/Request/Choregraphy/Leds/Positions.html +161 -0
- data/doc/classes/Request/GET_EARS_POSITION.html +17 -14
- data/doc/classes/Request/IdMessage.html +234 -0
- data/doc/classes/Request/Query.html +80 -55
- data/doc/classes/Request/SetEarsPosition.html +58 -36
- data/doc/classes/Request/TtsMessage.html +74 -50
- data/doc/classes/Response.html +55 -124
- data/doc/classes/Response/AbuseSending.html +34 -34
- data/doc/classes/Response/Base.html +34 -34
- data/doc/classes/Response/Base/BadServerRsp.html +34 -34
- data/doc/classes/Response/Base/GoodServerRsp.html +34 -34
- data/doc/classes/Response/Base/ServerRsp.html +53 -53
- data/doc/classes/Response/Blacklist.html +34 -34
- data/doc/classes/Response/ChorNotSend.html +34 -34
- data/doc/classes/Response/ChorSend.html +34 -34
- data/doc/classes/Response/CommandSend.html +34 -34
- data/doc/classes/Response/EarPositionNotSend.html +34 -34
- data/doc/classes/Response/EarPositionSend.html +34 -34
- data/doc/classes/Response/EmptyServerRsp.html +34 -34
- data/doc/classes/Response/LangListUser.html +34 -34
- data/doc/classes/Response/LinkPreview.html +34 -34
- data/doc/classes/Response/ListFriend.html +34 -34
- data/doc/classes/Response/ListReceivedMsg.html +34 -34
- data/doc/classes/Response/MessageNotSend.html +34 -34
- data/doc/classes/Response/MessageSend.html +34 -34
- data/doc/classes/Response/NabCastNotSend.html +34 -34
- data/doc/classes/Response/NabCastSend.html +34 -34
- data/doc/classes/Response/NoCorrectParameters.html +34 -34
- data/doc/classes/Response/NoGoodTokenOrSerial.html +34 -34
- data/doc/classes/Response/NotV2Rabbit.html +34 -34
- data/doc/classes/Response/PositionEar.html +34 -34
- data/doc/classes/Response/ProtocolExcepion.html +35 -35
- data/doc/classes/Response/RabbitName.html +34 -34
- data/doc/classes/Response/RabbitSleep.html +34 -34
- data/doc/classes/Response/RabbitVersion.html +34 -34
- data/doc/classes/Response/Signature.html +34 -34
- data/doc/classes/Response/Timezone.html +34 -34
- data/doc/classes/Response/TtsNotSend.html +34 -34
- data/doc/classes/Response/TtsSend.html +34 -34
- data/doc/classes/Response/VoiceListTts.html +34 -34
- data/doc/classes/Response/WebRadioNotSend.html +34 -34
- data/doc/classes/Response/WebRadioSend.html +34 -34
- data/doc/created.rid +1 -1
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_5.dot +13 -445
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +445 -11
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_7.dot +30 -5
- data/doc/dot/f_7.png +0 -0
- data/doc/dot/f_8.dot +39 -0
- data/doc/dot/f_8.png +0 -0
- data/doc/files/{lib/violet/violetapi_rb.html → BUGS.html} +17 -9
- data/doc/files/CHANGES.html +15 -2
- data/doc/files/MIT-LICENSE.html +2 -2
- data/doc/files/README.html +13 -3
- data/doc/files/TODO.html +5 -8
- data/doc/files/lib/libastag_rb.html +12 -10
- data/doc/files/lib/violet/helpers_rb.html +5 -5
- data/doc/files/lib/violet/request_rb.html +16 -12
- data/doc/files/lib/violet/response_rb.html +36 -35
- data/doc/fr_class_index.html +10 -1
- data/doc/fr_file_index.html +1 -1
- data/doc/fr_method_index.html +25 -12
- data/examples/morse.rb +72 -0
- data/lib/libastag.rb +6 -2
- data/lib/violet/helpers.rb +4 -2
- data/lib/violet/request.rb +501 -47
- data/lib/violet/response.rb +5 -2
- data/test/fake_violet_srv.rb +1 -1
- data/test/test_helpers.rb +3 -5
- data/test/{test_send.rb → test_query_and_actions.rb} +27 -10
- data/test/test_request_base.rb +76 -0
- data/test/test_request_chor.rb +162 -0
- data/test/test_request_stuff.rb +171 -0
- data/test/test_response.rb +3 -4
- metadata +45 -20
- data/doc/classes/VioletAPI.html +0 -118
- data/doc/dot/f_4.dot +0 -57
- data/doc/dot/f_4.png +0 -0
- data/lib/violet/violetapi.rb +0 -14
- data/test/test_request.rb +0 -20
|
@@ -69,16 +69,19 @@
|
|
|
69
69
|
<div id="contextContent">
|
|
70
70
|
<div id="diagram">
|
|
71
71
|
<map id="map" name="map">
|
|
72
|
-
<area shape="rect" coords="
|
|
73
|
-
<area shape="rect" coords="27,
|
|
74
|
-
<area shape="rect" coords="123,
|
|
75
|
-
<area shape="rect" coords="
|
|
76
|
-
<area shape="rect" coords="
|
|
77
|
-
<area shape="rect" coords="
|
|
78
|
-
<area shape="rect" coords="
|
|
79
|
-
<area shape="rect" coords="
|
|
80
|
-
<area shape="rect" coords="
|
|
81
|
-
<area shape="rect" coords="
|
|
72
|
+
<area shape="rect" coords="736,86,808,134" href="Base/Event.html" alt="Event" />
|
|
73
|
+
<area shape="rect" coords="27,182,99,230" href="Action.html" alt="Action" />
|
|
74
|
+
<area shape="rect" coords="123,182,216,230" href="AudioStream.html" alt="AudioStream" />
|
|
75
|
+
<area shape="rect" coords="240,182,333,230" href="Choregraphy.html" alt="Choregraphy" />
|
|
76
|
+
<area shape="rect" coords="357,182,448,230" href="TtsMessage.html" alt="TtsMessage" />
|
|
77
|
+
<area shape="rect" coords="472,182,555,230" href="IdMessage.html" alt="IdMessage" />
|
|
78
|
+
<area shape="rect" coords="579,182,685,230" href="SetEarsPosition.html" alt="SetEarsPosition" />
|
|
79
|
+
<area shape="rect" coords="709,182,813,230" href="Base/EventCollection.html" alt="EventCollection" />
|
|
80
|
+
<area shape="rect" coords="984,86,1061,134" href="../Enumerable.html" alt="Enumerable" />
|
|
81
|
+
<area shape="rect" coords="307,86,379,134" href="Query.html" alt="Query" />
|
|
82
|
+
<area shape="rect" coords="835,74,963,122" href="GET_EARS_POSITION.html" alt="GET_EARS_POSITION" />
|
|
83
|
+
<area shape="rect" coords="699,51,824,240" href="Base.html" alt="Base" />
|
|
84
|
+
<area shape="rect" coords="16,16,973,251" href="../Request.html" alt="Request" />
|
|
82
85
|
</map>
|
|
83
86
|
<img src="../../dot/f_8.png" usemap="#map" border="0" alt="dot/f_8.png">
|
|
84
87
|
</div>
|
|
@@ -127,10 +130,10 @@
|
|
|
127
130
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
|
128
131
|
<div class="method-source-code" id="M000015-source">
|
|
129
132
|
<pre>
|
|
130
|
-
<span class="ruby-comment cmt"># File lib/violet/request.rb, line
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 736</span>
|
|
134
|
+
736: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">GET_EARS_POSITION</span>.<span class="ruby-identifier">to_url</span>
|
|
135
|
+
737: <span class="ruby-value str">'ears=ok'</span>
|
|
136
|
+
738: <span class="ruby-keyword kw">end</span>
|
|
134
137
|
</pre>
|
|
135
138
|
</div>
|
|
136
139
|
</div>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Request::IdMessage</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Request::IdMessage</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/violet/request_rb.html">
|
|
59
|
+
lib/violet/request.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Base/Event.html">
|
|
69
|
+
Base::Event
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
<div id="diagram">
|
|
83
|
+
<map id="map" name="map">
|
|
84
|
+
<area shape="rect" coords="736,86,808,134" href="Base/Event.html" alt="Event" />
|
|
85
|
+
<area shape="rect" coords="27,182,99,230" href="Action.html" alt="Action" />
|
|
86
|
+
<area shape="rect" coords="123,182,216,230" href="AudioStream.html" alt="AudioStream" />
|
|
87
|
+
<area shape="rect" coords="240,182,333,230" href="Choregraphy.html" alt="Choregraphy" />
|
|
88
|
+
<area shape="rect" coords="357,182,448,230" href="TtsMessage.html" alt="TtsMessage" />
|
|
89
|
+
<area shape="rect" coords="472,182,555,230" href="IdMessage.html" alt="IdMessage" />
|
|
90
|
+
<area shape="rect" coords="579,182,685,230" href="SetEarsPosition.html" alt="SetEarsPosition" />
|
|
91
|
+
<area shape="rect" coords="709,182,813,230" href="Base/EventCollection.html" alt="EventCollection" />
|
|
92
|
+
<area shape="rect" coords="984,86,1061,134" href="../Enumerable.html" alt="Enumerable" />
|
|
93
|
+
<area shape="rect" coords="307,86,379,134" href="Query.html" alt="Query" />
|
|
94
|
+
<area shape="rect" coords="835,74,963,122" href="GET_EARS_POSITION.html" alt="GET_EARS_POSITION" />
|
|
95
|
+
<area shape="rect" coords="699,51,824,240" href="Base.html" alt="Base" />
|
|
96
|
+
<area shape="rect" coords="16,16,973,251" href="../Request.html" alt="Request" />
|
|
97
|
+
</map>
|
|
98
|
+
<img src="../../dot/f_8.png" usemap="#map" border="0" alt="dot/f_8.png">
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div id="description">
|
|
102
|
+
<p>
|
|
103
|
+
<a href="IdMessage.html">IdMessage</a> events are used with a message id
|
|
104
|
+
from Library or a personal MP3 file. Library can be seen here : <a
|
|
105
|
+
href="http://my.nabaztag.com/vl/action/myMessagesBiblio.do">my.nabaztag.com/vl/action/myMessagesBiblio.do</a>
|
|
106
|
+
</p>
|
|
107
|
+
<h1>Example (Batman)</h1>
|
|
108
|
+
<pre>
|
|
109
|
+
IdMessage.new :idmessage => 10282 # => #<Request::IdMessage:0x2b28ec730128 @h={:idmessage=>10282}>
|
|
110
|
+
</pre>
|
|
111
|
+
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div id="method-list">
|
|
118
|
+
<h3 class="section-bar">Methods</h3>
|
|
119
|
+
|
|
120
|
+
<div class="name-list">
|
|
121
|
+
<a href="#M000040">new</a>
|
|
122
|
+
<a href="#M000041">to_url</a>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<!-- if includes -->
|
|
130
|
+
|
|
131
|
+
<div id="section">
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<div id="constants-list">
|
|
135
|
+
<h3 class="section-bar">Constants</h3>
|
|
136
|
+
|
|
137
|
+
<div class="name-list">
|
|
138
|
+
<table summary="Constants">
|
|
139
|
+
<tr class="top-aligned-row context-row">
|
|
140
|
+
<td class="context-item-name">MIN_IDMESSAGE</td>
|
|
141
|
+
<td>=</td>
|
|
142
|
+
<td class="context-item-value">1</td>
|
|
143
|
+
</tr>
|
|
144
|
+
</table>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<!-- if method_list -->
|
|
154
|
+
<div id="methods">
|
|
155
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
156
|
+
|
|
157
|
+
<div id="method-M000040" class="method-detail">
|
|
158
|
+
<a name="M000040"></a>
|
|
159
|
+
|
|
160
|
+
<div class="method-heading">
|
|
161
|
+
<a href="#M000040" class="method-signature">
|
|
162
|
+
<span class="method-name">new</span><span class="method-args">(h)</span>
|
|
163
|
+
</a>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div class="method-description">
|
|
167
|
+
<p>
|
|
168
|
+
take an Hash in parameter, with at least <tt>:idmessage</tt> key. the
|
|
169
|
+
<tt>:idmessage</tt> must respond_to to_i and have a to_i representation
|
|
170
|
+
greater or equal than IdMessage::MIN_IDMESSAGE.
|
|
171
|
+
</p>
|
|
172
|
+
<p><a class="source-toggle" href="#"
|
|
173
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
|
174
|
+
<div class="method-source-code" id="M000040-source">
|
|
175
|
+
<pre>
|
|
176
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 223</span>
|
|
177
|
+
223: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
|
|
178
|
+
224: <span class="ruby-ivar">@h</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">dup</span>
|
|
179
|
+
225:
|
|
180
|
+
226: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'no :idmessage given'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:idmessage</span>]
|
|
181
|
+
227: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">":idmessage must be greater than #{MIN_IDMESSAGE}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:idmessage</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-operator">>=</span> <span class="ruby-constant">MIN_IDMESSAGE</span>
|
|
182
|
+
228:
|
|
183
|
+
229: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:idmessage</span>] = <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:idmessage</span>].<span class="ruby-identifier">to_i</span>
|
|
184
|
+
230:
|
|
185
|
+
231: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcasttitle</span>] = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">escape</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcasttitle</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcasttitle</span>]
|
|
186
|
+
232: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcast</span>] = <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcast</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:nabcast</span>]
|
|
187
|
+
233: <span class="ruby-keyword kw">end</span>
|
|
188
|
+
</pre>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
194
|
+
|
|
195
|
+
<div id="method-M000041" class="method-detail">
|
|
196
|
+
<a name="M000041"></a>
|
|
197
|
+
|
|
198
|
+
<div class="method-heading">
|
|
199
|
+
<a href="#M000041" class="method-signature">
|
|
200
|
+
<span class="method-name">to_url</span><span class="method-args">()</span>
|
|
201
|
+
</a>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<div class="method-description">
|
|
205
|
+
<p><a class="source-toggle" href="#"
|
|
206
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
|
207
|
+
<div class="method-source-code" id="M000041-source">
|
|
208
|
+
<pre>
|
|
209
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 235</span>
|
|
210
|
+
235: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
|
|
211
|
+
236: <span class="ruby-identifier">url</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
212
|
+
237: <span class="ruby-ivar">@h</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
|
213
|
+
238: <span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{key}=#{val}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>
|
|
214
|
+
239: <span class="ruby-keyword kw">end</span>
|
|
215
|
+
240: <span class="ruby-identifier">url</span>
|
|
216
|
+
241: <span class="ruby-keyword kw">end</span>
|
|
217
|
+
</pre>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<div id="validator-badges">
|
|
230
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
</body>
|
|
234
|
+
</html>
|
|
@@ -79,31 +79,37 @@
|
|
|
79
79
|
<div id="contextContent">
|
|
80
80
|
<div id="diagram">
|
|
81
81
|
<map id="map" name="map">
|
|
82
|
-
<area shape="rect" coords="
|
|
83
|
-
<area shape="rect" coords="27,
|
|
84
|
-
<area shape="rect" coords="123,
|
|
85
|
-
<area shape="rect" coords="
|
|
86
|
-
<area shape="rect" coords="
|
|
87
|
-
<area shape="rect" coords="
|
|
88
|
-
<area shape="rect" coords="
|
|
89
|
-
<area shape="rect" coords="
|
|
90
|
-
<area shape="rect" coords="
|
|
91
|
-
<area shape="rect" coords="
|
|
82
|
+
<area shape="rect" coords="736,86,808,134" href="Base/Event.html" alt="Event" />
|
|
83
|
+
<area shape="rect" coords="27,182,99,230" href="Action.html" alt="Action" />
|
|
84
|
+
<area shape="rect" coords="123,182,216,230" href="AudioStream.html" alt="AudioStream" />
|
|
85
|
+
<area shape="rect" coords="240,182,333,230" href="Choregraphy.html" alt="Choregraphy" />
|
|
86
|
+
<area shape="rect" coords="357,182,448,230" href="TtsMessage.html" alt="TtsMessage" />
|
|
87
|
+
<area shape="rect" coords="472,182,555,230" href="IdMessage.html" alt="IdMessage" />
|
|
88
|
+
<area shape="rect" coords="579,182,685,230" href="SetEarsPosition.html" alt="SetEarsPosition" />
|
|
89
|
+
<area shape="rect" coords="709,182,813,230" href="Base/EventCollection.html" alt="EventCollection" />
|
|
90
|
+
<area shape="rect" coords="984,86,1061,134" href="../Enumerable.html" alt="Enumerable" />
|
|
91
|
+
<area shape="rect" coords="307,86,379,134" href="Query.html" alt="Query" />
|
|
92
|
+
<area shape="rect" coords="835,74,963,122" href="GET_EARS_POSITION.html" alt="GET_EARS_POSITION" />
|
|
93
|
+
<area shape="rect" coords="699,51,824,240" href="Base.html" alt="Base" />
|
|
94
|
+
<area shape="rect" coords="16,16,973,251" href="../Request.html" alt="Request" />
|
|
92
95
|
</map>
|
|
93
96
|
<img src="../../dot/f_8.png" usemap="#map" border="0" alt="dot/f_8.png">
|
|
94
97
|
</div>
|
|
95
98
|
|
|
96
99
|
<div id="description">
|
|
97
100
|
<p>
|
|
98
|
-
this class is used to "translate" our Events into URLs.
|
|
101
|
+
this class is used to "translate" our Events into URLs. a query
|
|
102
|
+
contains an event to send and the serial/token of the target Rabbit. That
|
|
103
|
+
way, you can send the same event to many nabaztag easily.
|
|
99
104
|
</p>
|
|
100
|
-
<pre>
|
|
101
|
-
TODO
|
|
102
|
-
</pre>
|
|
103
105
|
<p>
|
|
104
106
|
see <a
|
|
105
107
|
href="http://api.nabaztag.com/docs/home.html">api.nabaztag.com/docs/home.html</a>
|
|
106
108
|
</p>
|
|
109
|
+
<h2>Examples</h2>
|
|
110
|
+
<pre>
|
|
111
|
+
q = Query.new :token => "my_token", :serial => "my_serial", :event => GET_RABBIT_NAME # => #<Request::Query:0x2aaaaaee10b8 @event=#<Request::Action:0x2b74bb47f828 @id=10>, @token="my_token", @serial="my_serial">
|
|
112
|
+
</pre>
|
|
107
113
|
|
|
108
114
|
</div>
|
|
109
115
|
|
|
@@ -114,9 +120,9 @@ href="http://api.nabaztag.com/docs/home.html">api.nabaztag.com/docs/home.html</a
|
|
|
114
120
|
<h3 class="section-bar">Methods</h3>
|
|
115
121
|
|
|
116
122
|
<div class="name-list">
|
|
117
|
-
<a href="#
|
|
118
|
-
<a href="#
|
|
119
|
-
<a href="#
|
|
123
|
+
<a href="#M000035">new</a>
|
|
124
|
+
<a href="#M000037">send!</a>
|
|
125
|
+
<a href="#M000036">to_url</a>
|
|
120
126
|
</div>
|
|
121
127
|
</div>
|
|
122
128
|
|
|
@@ -138,35 +144,38 @@ href="http://api.nabaztag.com/docs/home.html">api.nabaztag.com/docs/home.html</a
|
|
|
138
144
|
<div id="methods">
|
|
139
145
|
<h3 class="section-bar">Public Class methods</h3>
|
|
140
146
|
|
|
141
|
-
<div id="method-
|
|
142
|
-
<a name="
|
|
147
|
+
<div id="method-M000035" class="method-detail">
|
|
148
|
+
<a name="M000035"></a>
|
|
143
149
|
|
|
144
150
|
<div class="method-heading">
|
|
145
|
-
<a href="#
|
|
151
|
+
<a href="#M000035" class="method-signature">
|
|
146
152
|
<span class="method-name">new</span><span class="method-args">(h)</span>
|
|
147
153
|
</a>
|
|
148
154
|
</div>
|
|
149
155
|
|
|
150
156
|
<div class="method-description">
|
|
151
157
|
<p>
|
|
152
|
-
create a <a href="Query.html#
|
|
158
|
+
create a <a href="Query.html#M000035">new</a> <a
|
|
153
159
|
href="Query.html">Query</a> object with the give parameters.
|
|
154
160
|
<tt>serial</tt> and <tt>token</tt> parameters should be checked at a higher
|
|
155
161
|
level. <tt>event</tt> parameter is usually an Event object, but you can
|
|
156
|
-
give any Object that respond to <a href="Query.html#
|
|
162
|
+
give any Object that respond to <a href="Query.html#M000036">to_url</a>, it
|
|
163
|
+
should return a string that contains some GET parameters like
|
|
164
|
+
"foo=bar&oni=2", or an array of GET options like [
|
|
165
|
+
"foo=bar", "oni=2" ].
|
|
157
166
|
</p>
|
|
158
167
|
<p><a class="source-toggle" href="#"
|
|
159
|
-
onclick="toggleCode('
|
|
160
|
-
<div class="method-source-code" id="
|
|
168
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
|
169
|
+
<div class="method-source-code" id="M000035-source">
|
|
161
170
|
<pre>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 103</span>
|
|
172
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
|
|
173
|
+
104: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'event parameter has no "to_url" method or is empty'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:event</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:event</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_url</span>)
|
|
174
|
+
105: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'need a :serial'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:serial</span>]
|
|
175
|
+
106: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'need a :token'</span> ) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:token</span>]
|
|
176
|
+
107:
|
|
177
|
+
108: <span class="ruby-ivar">@event</span>, <span class="ruby-ivar">@serial</span>, <span class="ruby-ivar">@token</span> = <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:event</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:serial</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:token</span>]
|
|
178
|
+
109: <span class="ruby-keyword kw">end</span>
|
|
170
179
|
</pre>
|
|
171
180
|
</div>
|
|
172
181
|
</div>
|
|
@@ -174,56 +183,72 @@ give any Object that respond to <a href="Query.html#M000025">to_url</a>.
|
|
|
174
183
|
|
|
175
184
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
176
185
|
|
|
177
|
-
<div id="method-
|
|
178
|
-
<a name="
|
|
186
|
+
<div id="method-M000037" class="method-detail">
|
|
187
|
+
<a name="M000037"></a>
|
|
179
188
|
|
|
180
189
|
<div class="method-heading">
|
|
181
|
-
<a href="#
|
|
190
|
+
<a href="#M000037" class="method-signature">
|
|
182
191
|
<span class="method-name">send!</span><span class="method-args">(response_type=nil)</span>
|
|
183
192
|
</a>
|
|
184
193
|
</div>
|
|
185
194
|
|
|
186
195
|
<div class="method-description">
|
|
187
196
|
<p>
|
|
188
|
-
|
|
197
|
+
send the query to the server. it return a ServerRsp object from the
|
|
198
|
+
corresponding class if no args is given.
|
|
189
199
|
</p>
|
|
200
|
+
<h2>Arguments</h2>
|
|
201
|
+
<dl>
|
|
202
|
+
<dt>:xml</dt><dd>the raw xml server‘s response
|
|
203
|
+
|
|
204
|
+
</dd>
|
|
205
|
+
</dl>
|
|
206
|
+
<h2>Examples</h2>
|
|
207
|
+
<pre>
|
|
208
|
+
q = Query.new :token => "my_token", :serial => "my_serial", :event => GET_RABBIT_NAME # => #<Request::Query:0x2aaaaaee10b8 @event=#<Request::Action:0x2b74bb47f828 @id=10>, @token="my_token", @serial="my_serial">
|
|
209
|
+
q.send! # => #<Response::RabbitName:0x2b74b8c38798 @xml=<UNDEFINED> ... </>>
|
|
210
|
+
q.send!(:xml) # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rsp><rabbitName>Makoto</rabbitName></rsp>\n"
|
|
211
|
+
</pre>
|
|
190
212
|
<p><a class="source-toggle" href="#"
|
|
191
|
-
onclick="toggleCode('
|
|
192
|
-
<div class="method-source-code" id="
|
|
213
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
|
214
|
+
<div class="method-source-code" id="M000037-source">
|
|
193
215
|
<pre>
|
|
194
|
-
<span class="ruby-comment cmt"># File lib/violet/request.rb, line
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
105: <span class="ruby-keyword kw">end</span>
|
|
216
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 131</span>
|
|
217
|
+
131: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send!</span> <span class="ruby-identifier">response_type</span>=<span class="ruby-keyword kw">nil</span>
|
|
218
|
+
132: <span class="ruby-identifier">rsp</span> = <span class="ruby-identifier">open</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_url</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">rsp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">rsp</span>.<span class="ruby-identifier">read</span> }
|
|
219
|
+
133: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:xml</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">rsp</span> <span class="ruby-keyword kw">else</span> <span class="ruby-constant">Response</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">rsp</span>) <span class="ruby-keyword kw">end</span>
|
|
220
|
+
134: <span class="ruby-keyword kw">end</span>
|
|
200
221
|
</pre>
|
|
201
222
|
</div>
|
|
202
223
|
</div>
|
|
203
224
|
</div>
|
|
204
225
|
|
|
205
|
-
<div id="method-
|
|
206
|
-
<a name="
|
|
226
|
+
<div id="method-M000036" class="method-detail">
|
|
227
|
+
<a name="M000036"></a>
|
|
207
228
|
|
|
208
229
|
<div class="method-heading">
|
|
209
|
-
<a href="#
|
|
230
|
+
<a href="#M000036" class="method-signature">
|
|
210
231
|
<span class="method-name">to_url</span><span class="method-args">()</span>
|
|
211
232
|
</a>
|
|
212
233
|
</div>
|
|
213
234
|
|
|
214
235
|
<div class="method-description">
|
|
215
236
|
<p>
|
|
216
|
-
return the complet url
|
|
217
|
-
and options.
|
|
237
|
+
return the complet url
|
|
218
238
|
</p>
|
|
219
239
|
<p><a class="source-toggle" href="#"
|
|
220
|
-
onclick="toggleCode('
|
|
221
|
-
<div class="method-source-code" id="
|
|
240
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
|
241
|
+
<div class="method-source-code" id="M000036-source">
|
|
222
242
|
<pre>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
<span class="ruby-comment cmt"># File lib/violet/request.rb, line 112</span>
|
|
244
|
+
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
|
|
245
|
+
113: <span class="ruby-identifier">opts</span> = <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">to_url</span>
|
|
246
|
+
114: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:join</span>) <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">opts</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&'</span>) <span class="ruby-keyword kw">end</span>
|
|
247
|
+
115:
|
|
248
|
+
116: <span class="ruby-identifier">base_url</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@event</span>.<span class="ruby-identifier">streamed?</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">APISTREAM_URL</span> <span class="ruby-keyword kw">else</span> <span class="ruby-constant">API_URL</span> <span class="ruby-keyword kw">end</span>
|
|
249
|
+
117:
|
|
250
|
+
118: <span class="ruby-node">"#{base_url}?"</span> <span class="ruby-operator"><<</span> [ <span class="ruby-node">"sn=#{@serial}"</span>, <span class="ruby-node">"token=#{@token}"</span>, <span class="ruby-identifier">opts</span> ].<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&'</span>)
|
|
251
|
+
119: <span class="ruby-keyword kw">end</span>
|
|
227
252
|
</pre>
|
|
228
253
|
</div>
|
|
229
254
|
</div>
|