libastag 0.0.1
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/CHANGES +7 -0
- data/MIT-LICENSE +19 -0
- data/README +65 -0
- data/Rakefile +276 -0
- data/TODO +7 -0
- data/doc/classes/Helpers/REXML/Attributes.html +179 -0
- data/doc/classes/Helpers/REXML.html +115 -0
- data/doc/classes/Helpers.html +181 -0
- data/doc/classes/Libastag/Rabbit.html +462 -0
- data/doc/classes/Libastag/RabitEar.html +120 -0
- data/doc/classes/Libastag/RabitLed.html +120 -0
- data/doc/classes/Libastag.html +141 -0
- data/doc/classes/Request/Action.html +213 -0
- data/doc/classes/Request/Base/Event.html +226 -0
- data/doc/classes/Request/Base/EventCollection.html +246 -0
- data/doc/classes/Request/Base.html +134 -0
- data/doc/classes/Request/GET_EARS_POSITION.html +151 -0
- data/doc/classes/Request/Query.html +244 -0
- data/doc/classes/Request/SetEarsPosition.html +213 -0
- data/doc/classes/Request/TtsMessage.html +235 -0
- data/doc/classes/Request.html +414 -0
- data/doc/classes/Response/AbuseSending.html +165 -0
- data/doc/classes/Response/Base/BadServerRsp.html +163 -0
- data/doc/classes/Response/Base/GoodServerRsp.html +161 -0
- data/doc/classes/Response/Base/ServerRsp.html +347 -0
- data/doc/classes/Response/Base.html +162 -0
- data/doc/classes/Response/Blacklist.html +165 -0
- data/doc/classes/Response/ChorNotSend.html +166 -0
- data/doc/classes/Response/ChorSend.html +165 -0
- data/doc/classes/Response/CommandSend.html +168 -0
- data/doc/classes/Response/EarPositionNotSend.html +165 -0
- data/doc/classes/Response/EarPositionSend.html +165 -0
- data/doc/classes/Response/EmptyServerRsp.html +161 -0
- data/doc/classes/Response/LangListUser.html +166 -0
- data/doc/classes/Response/LinkPreview.html +165 -0
- data/doc/classes/Response/ListFriend.html +165 -0
- data/doc/classes/Response/ListReceivedMsg.html +165 -0
- data/doc/classes/Response/MessageNotSend.html +165 -0
- data/doc/classes/Response/MessageSend.html +165 -0
- data/doc/classes/Response/NabCastNotSend.html +169 -0
- data/doc/classes/Response/NabCastSend.html +165 -0
- data/doc/classes/Response/NoCorrectParameters.html +165 -0
- data/doc/classes/Response/NoGoodTokenOrSerial.html +165 -0
- data/doc/classes/Response/NotV2Rabbit.html +165 -0
- data/doc/classes/Response/PositionEar.html +166 -0
- data/doc/classes/Response/ProtocolExcepion.html +164 -0
- data/doc/classes/Response/RabbitName.html +164 -0
- data/doc/classes/Response/RabbitSleep.html +164 -0
- data/doc/classes/Response/RabbitVersion.html +164 -0
- data/doc/classes/Response/Signature.html +164 -0
- data/doc/classes/Response/Timezone.html +164 -0
- data/doc/classes/Response/TtsNotSend.html +168 -0
- data/doc/classes/Response/TtsSend.html +165 -0
- data/doc/classes/Response/VoiceListTts.html +165 -0
- data/doc/classes/Response/WebRadioNotSend.html +165 -0
- data/doc/classes/Response/WebRadioSend.html +165 -0
- data/doc/classes/Response.html +337 -0
- data/doc/classes/VioletAPI.html +118 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_4.dot +57 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +489 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +55 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_7.dot +30 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/dot/f_8.dot +142 -0
- data/doc/dot/f_8.png +0 -0
- data/doc/files/CHANGES.html +126 -0
- data/doc/files/MIT-LICENSE.html +134 -0
- data/doc/files/README.html +192 -0
- data/doc/files/TODO.html +126 -0
- data/doc/files/lib/libastag_rb.html +116 -0
- data/doc/files/lib/violet/helpers_rb.html +123 -0
- data/doc/files/lib/violet/request_rb.html +133 -0
- data/doc/files/lib/violet/response_rb.html +220 -0
- data/doc/files/lib/violet/violetapi_rb.html +114 -0
- data/doc/fr_class_index.html +79 -0
- data/doc/fr_file_index.html +35 -0
- data/doc/fr_method_index.html +56 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/libastag.rb +116 -0
- data/lib/violet/helpers.rb +48 -0
- data/lib/violet/request.rb +301 -0
- data/lib/violet/response.rb +412 -0
- data/lib/violet/violetapi.rb +14 -0
- data/test/fake_violet_srv.rb +94 -0
- data/test/test_helpers.rb +31 -0
- data/test/test_request.rb +20 -0
- data/test/test_response.rb +295 -0
- data/test/test_send.rb +137 -0
- metadata +264 -0
|
@@ -0,0 +1,337 @@
|
|
|
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>Module: Response</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>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Response</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../files/lib/violet/response_rb.html">
|
|
59
|
+
lib/violet/response.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
</table>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- banner header -->
|
|
68
|
+
|
|
69
|
+
<div id="bodyContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<div id="contextContent">
|
|
74
|
+
<div id="diagram">
|
|
75
|
+
<map id="map" name="map">
|
|
76
|
+
<area shape="rect" coords="1625,229,1732,277" href="Response/Base/GoodServerRsp.html" alt="GoodServerRsp" />
|
|
77
|
+
<area shape="rect" coords="27,325,136,373" href="Response/EarPositionSend.html" alt="EarPositionSend" />
|
|
78
|
+
<area shape="rect" coords="160,325,256,373" href="Response/NabCastSend.html" alt="NabCastSend" />
|
|
79
|
+
<area shape="rect" coords="280,325,384,373" href="Response/CommandSend.html" alt="CommandSend" />
|
|
80
|
+
<area shape="rect" coords="408,325,485,373" href="Response/Signature.html" alt="Signature" />
|
|
81
|
+
<area shape="rect" coords="509,325,595,373" href="Response/PositionEar.html" alt="PositionEar" />
|
|
82
|
+
<area shape="rect" coords="619,325,707,373" href="Response/VoiceListTts.html" alt="VoiceListTts" />
|
|
83
|
+
<area shape="rect" coords="731,325,819,373" href="Response/LinkPreview.html" alt="LinkPreview" />
|
|
84
|
+
<area shape="rect" coords="843,325,941,373" href="Response/MessageSend.html" alt="MessageSend" />
|
|
85
|
+
<area shape="rect" coords="965,325,1059,373" href="Response/LangListUser.html" alt="LangListUser" />
|
|
86
|
+
<area shape="rect" coords="1083,325,1173,373" href="Response/RabbitName.html" alt="RabbitName" />
|
|
87
|
+
<area shape="rect" coords="1197,325,1269,373" href="Response/TtsSend.html" alt="TtsSend" />
|
|
88
|
+
<area shape="rect" coords="1293,325,1405,373" href="Response/ListReceivedMsg.html" alt="ListReceivedMsg" />
|
|
89
|
+
<area shape="rect" coords="1429,325,1507,373" href="Response/ListFriend.html" alt="ListFriend" />
|
|
90
|
+
<area shape="rect" coords="1531,325,1619,373" href="Response/RabbitSleep.html" alt="RabbitSleep" />
|
|
91
|
+
<area shape="rect" coords="1643,325,1715,373" href="Response/Blacklist.html" alt="Blacklist" />
|
|
92
|
+
<area shape="rect" coords="1739,325,1816,373" href="Response/Timezone.html" alt="Timezone" />
|
|
93
|
+
<area shape="rect" coords="1840,325,1939,373" href="Response/RabbitVersion.html" alt="RabbitVersion" />
|
|
94
|
+
<area shape="rect" coords="1963,325,2067,373" href="Response/WebRadioSend.html" alt="WebRadioSend" />
|
|
95
|
+
<area shape="rect" coords="2091,325,2168,373" href="Response/ChorSend.html" alt="ChorSend" />
|
|
96
|
+
<area shape="rect" coords="1756,229,1855,277" href="Response/Base/BadServerRsp.html" alt="BadServerRsp" />
|
|
97
|
+
<area shape="rect" coords="2192,325,2331,373" href="Response/NoGoodTokenOrSerial.html" alt="NoGoodTokenOrSerial" />
|
|
98
|
+
<area shape="rect" coords="2355,325,2451,373" href="Response/ChorNotSend.html" alt="ChorNotSend" />
|
|
99
|
+
<area shape="rect" coords="2475,325,2589,373" href="Response/NabCastNotSend.html" alt="NabCastNotSend" />
|
|
100
|
+
<area shape="rect" coords="2613,325,2728,373" href="Response/MessageNotSend.html" alt="MessageNotSend" />
|
|
101
|
+
<area shape="rect" coords="2752,325,2851,373" href="Response/AbuseSending.html" alt="AbuseSending" />
|
|
102
|
+
<area shape="rect" coords="2875,325,3008,373" href="Response/NoCorrectParameters.html" alt="NoCorrectParameters" />
|
|
103
|
+
<area shape="rect" coords="3032,325,3120,373" href="Response/TtsNotSend.html" alt="TtsNotSend" />
|
|
104
|
+
<area shape="rect" coords="3144,325,3235,373" href="Response/NotV2Rabbit.html" alt="NotV2Rabbit" />
|
|
105
|
+
<area shape="rect" coords="3259,325,3381,373" href="Response/WebRadioNotSend.html" alt="WebRadioNotSend" />
|
|
106
|
+
<area shape="rect" coords="3405,325,3531,373" href="Response/EarPositionNotSend.html" alt="EarPositionNotSend" />
|
|
107
|
+
<area shape="rect" coords="1149,5,1227,53" href="Exception.html" alt="Exception" />
|
|
108
|
+
<area shape="rect" coords="1131,133,1245,181" href="Response/ProtocolExcepion.html" alt="ProtocolExcepion" />
|
|
109
|
+
<area shape="rect" coords="1765,133,1845,181" href="Response/Base/ServerRsp.html" alt="ServerRsp" />
|
|
110
|
+
<area shape="rect" coords="1879,229,1991,277" href="Response/EmptyServerRsp.html" alt="EmptyServerRsp" />
|
|
111
|
+
<area shape="rect" coords="1615,99,1865,288" href="Response/Base.html" alt="Base" />
|
|
112
|
+
<area shape="rect" coords="16,64,3541,384" href="Response.html" alt="Response" />
|
|
113
|
+
</map>
|
|
114
|
+
<img src="../dot/f_5.png" usemap="#map" border="0" alt="dot/f_5.png">
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div id="description">
|
|
118
|
+
<h1>violet/response.rb</h1>
|
|
119
|
+
<h2>Summary</h2>
|
|
120
|
+
<p>
|
|
121
|
+
this module handle servers messages. Main method/class are <a
|
|
122
|
+
href="Response.html#M000003">Response.parse</a> and <a
|
|
123
|
+
href="Response/Base/ServerRsp.html">Response::Base::ServerRsp</a> (well
|
|
124
|
+
documented).
|
|
125
|
+
</p>
|
|
126
|
+
<p>
|
|
127
|
+
you should only use <a href="Response.html#M000003">Response.parse</a> with
|
|
128
|
+
the server‘s message (xml) as argument, it returns a ServerRsp
|
|
129
|
+
instance from the corresponding class (see all the ServerRsp subclass).
|
|
130
|
+
with a ServerRsp instance you can use :
|
|
131
|
+
</p>
|
|
132
|
+
<dl>
|
|
133
|
+
<dt> r.has_x? </dt><dd>return <tt>true</tt> if r has at least one element of name "x",
|
|
134
|
+
return <tt>false</tt> otherwhise.
|
|
135
|
+
|
|
136
|
+
</dd>
|
|
137
|
+
<dt> r.has_many_xs? </dt><dd>return <tt>true</tt> if r has more than one element of name "x",
|
|
138
|
+
return <tt>false</tt> otherwhise.
|
|
139
|
+
|
|
140
|
+
</dd>
|
|
141
|
+
<dt> r.x </dt><dd>find the first xml element of name x and return it‘s text if any, or
|
|
142
|
+
a hash of it‘s options
|
|
143
|
+
|
|
144
|
+
</dd>
|
|
145
|
+
<dt> r.x </dt><dd>find all xml element of name x and return an Array of their text if any, or
|
|
146
|
+
their options.
|
|
147
|
+
|
|
148
|
+
</dd>
|
|
149
|
+
<dt> r.good? </dt><dd>return <tt>true</tt> if the response is not an error, <tt>false</tt>
|
|
150
|
+
otherwhise.
|
|
151
|
+
|
|
152
|
+
</dd>
|
|
153
|
+
<dt> r.bad? </dt><dd>return <tt>true</tt> if the response is an error, <tt>false</tt>
|
|
154
|
+
otherwhise.
|
|
155
|
+
|
|
156
|
+
</dd>
|
|
157
|
+
</dl>
|
|
158
|
+
<h2>Examples :</h2>
|
|
159
|
+
<pre>
|
|
160
|
+
>> rsp = Response.parse('<?xml version="1.0" encoding="UTF-8"?><rsp><blacklist nb="2"/><pseudo name="toto"/><pseudo name="titi"/></rsp>')
|
|
161
|
+
=> #<Response::Blacklist:0x2acd8c08f2f8 @xml=<UNDEFINED> ... </>>
|
|
162
|
+
>> rsp.good?
|
|
163
|
+
=> true
|
|
164
|
+
>> rsp.has_message?
|
|
165
|
+
=> false
|
|
166
|
+
>> rsp.message
|
|
167
|
+
NameError: undefined local variable or method message for #<Response::Blacklist:0x2b1f056afdc0 @xml=<UNDEFINED> ... </>>
|
|
168
|
+
>> rsp.has_blacklist?
|
|
169
|
+
=> true
|
|
170
|
+
>> rsp.blacklist
|
|
171
|
+
=> {:nb=>"2"}
|
|
172
|
+
>> rsp.pseudo
|
|
173
|
+
=> {:name=>"toto"}
|
|
174
|
+
>> rsp.has_many_pseudos?
|
|
175
|
+
=> true
|
|
176
|
+
>> rsp.pseudos
|
|
177
|
+
=> [{:name=>"toto"}, {:name=>"titi"}]
|
|
178
|
+
</pre>
|
|
179
|
+
<h2>Low Level</h2>
|
|
180
|
+
<p>
|
|
181
|
+
if you want to access to the REXML::Document object of a ServerRsp you can
|
|
182
|
+
either use rsp.xml or use ServerRsp#get_all method.
|
|
183
|
+
</p>
|
|
184
|
+
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div id="method-list">
|
|
191
|
+
<h3 class="section-bar">Methods</h3>
|
|
192
|
+
|
|
193
|
+
<div class="name-list">
|
|
194
|
+
<a href="#M000003">parse</a>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<!-- if includes -->
|
|
202
|
+
|
|
203
|
+
<div id="section">
|
|
204
|
+
|
|
205
|
+
<div id="class-list">
|
|
206
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
|
207
|
+
|
|
208
|
+
Module <a href="Response/Base.html" class="link">Response::Base</a><br />
|
|
209
|
+
Class <a href="Response/AbuseSending.html" class="link">Response::AbuseSending</a><br />
|
|
210
|
+
Class <a href="Response/Blacklist.html" class="link">Response::Blacklist</a><br />
|
|
211
|
+
Class <a href="Response/ChorNotSend.html" class="link">Response::ChorNotSend</a><br />
|
|
212
|
+
Class <a href="Response/ChorSend.html" class="link">Response::ChorSend</a><br />
|
|
213
|
+
Class <a href="Response/CommandSend.html" class="link">Response::CommandSend</a><br />
|
|
214
|
+
Class <a href="Response/EarPositionNotSend.html" class="link">Response::EarPositionNotSend</a><br />
|
|
215
|
+
Class <a href="Response/EarPositionSend.html" class="link">Response::EarPositionSend</a><br />
|
|
216
|
+
Class <a href="Response/EmptyServerRsp.html" class="link">Response::EmptyServerRsp</a><br />
|
|
217
|
+
Class <a href="Response/LangListUser.html" class="link">Response::LangListUser</a><br />
|
|
218
|
+
Class <a href="Response/LinkPreview.html" class="link">Response::LinkPreview</a><br />
|
|
219
|
+
Class <a href="Response/ListFriend.html" class="link">Response::ListFriend</a><br />
|
|
220
|
+
Class <a href="Response/ListReceivedMsg.html" class="link">Response::ListReceivedMsg</a><br />
|
|
221
|
+
Class <a href="Response/MessageNotSend.html" class="link">Response::MessageNotSend</a><br />
|
|
222
|
+
Class <a href="Response/MessageSend.html" class="link">Response::MessageSend</a><br />
|
|
223
|
+
Class <a href="Response/NabCastNotSend.html" class="link">Response::NabCastNotSend</a><br />
|
|
224
|
+
Class <a href="Response/NabCastSend.html" class="link">Response::NabCastSend</a><br />
|
|
225
|
+
Class <a href="Response/NoCorrectParameters.html" class="link">Response::NoCorrectParameters</a><br />
|
|
226
|
+
Class <a href="Response/NoGoodTokenOrSerial.html" class="link">Response::NoGoodTokenOrSerial</a><br />
|
|
227
|
+
Class <a href="Response/NotV2Rabbit.html" class="link">Response::NotV2Rabbit</a><br />
|
|
228
|
+
Class <a href="Response/PositionEar.html" class="link">Response::PositionEar</a><br />
|
|
229
|
+
Class <a href="Response/ProtocolExcepion.html" class="link">Response::ProtocolExcepion</a><br />
|
|
230
|
+
Class <a href="Response/RabbitName.html" class="link">Response::RabbitName</a><br />
|
|
231
|
+
Class <a href="Response/RabbitSleep.html" class="link">Response::RabbitSleep</a><br />
|
|
232
|
+
Class <a href="Response/RabbitVersion.html" class="link">Response::RabbitVersion</a><br />
|
|
233
|
+
Class <a href="Response/Signature.html" class="link">Response::Signature</a><br />
|
|
234
|
+
Class <a href="Response/Timezone.html" class="link">Response::Timezone</a><br />
|
|
235
|
+
Class <a href="Response/TtsNotSend.html" class="link">Response::TtsNotSend</a><br />
|
|
236
|
+
Class <a href="Response/TtsSend.html" class="link">Response::TtsSend</a><br />
|
|
237
|
+
Class <a href="Response/VoiceListTts.html" class="link">Response::VoiceListTts</a><br />
|
|
238
|
+
Class <a href="Response/WebRadioNotSend.html" class="link">Response::WebRadioNotSend</a><br />
|
|
239
|
+
Class <a href="Response/WebRadioSend.html" class="link">Response::WebRadioSend</a><br />
|
|
240
|
+
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<!-- if method_list -->
|
|
250
|
+
<div id="methods">
|
|
251
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
252
|
+
|
|
253
|
+
<div id="method-M000003" class="method-detail">
|
|
254
|
+
<a name="M000003"></a>
|
|
255
|
+
|
|
256
|
+
<div class="method-heading">
|
|
257
|
+
<a href="#M000003" class="method-signature">
|
|
258
|
+
<span class="method-name">parse</span><span class="method-args">(raw)</span>
|
|
259
|
+
</a>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div class="method-description">
|
|
263
|
+
<h2>Summary</h2>
|
|
264
|
+
<p>
|
|
265
|
+
<a href="Response.html#M000003">parse</a> given raw (xml text) and return a
|
|
266
|
+
new ServerRsp from the corresponding class.
|
|
267
|
+
</p>
|
|
268
|
+
<p>
|
|
269
|
+
Violet messages aren‘t easy to identify, because there is not id. So
|
|
270
|
+
we have to study the xml content if there are no message element (easier to
|
|
271
|
+
detect the response type).
|
|
272
|
+
</p>
|
|
273
|
+
<h2>Arguments</h2>
|
|
274
|
+
<p>
|
|
275
|
+
the xml response of the Violet Server.
|
|
276
|
+
</p>
|
|
277
|
+
<h2>Exceptions</h2>
|
|
278
|
+
<p>
|
|
279
|
+
this method raise a <a
|
|
280
|
+
href="Response/ProtocolExcepion.html">ProtocolExcepion</a> if it‘s
|
|
281
|
+
fail to detect the kind of the server‘s response.
|
|
282
|
+
</p>
|
|
283
|
+
<h2>Examples</h2>
|
|
284
|
+
<pre>
|
|
285
|
+
>> rsp = Response.parse('<?xml version="1.0" encoding="UTF-8"?><rsp><rabbitSleep>YES</rabbitSleep></rsp>')
|
|
286
|
+
=> #<Response::RabbitSleep:0x2b16c5e476e8 @xml=<UNDEFINED> ... </>>
|
|
287
|
+
>> rsp.class
|
|
288
|
+
=> Response::RabbitSleep
|
|
289
|
+
|
|
290
|
+
>> rsp = Response.parse('<?xml version="1.0" encoding="UTF-8"?><rsp><rabbitVersion>V1</rabbitVersion></rsp>')
|
|
291
|
+
=> #<Response::RabbitVersion:0x2b16c5e154b8 @xml=<UNDEFINED> ... </>>
|
|
292
|
+
>> rsp.class
|
|
293
|
+
=> Response::RabbitVersion
|
|
294
|
+
</pre>
|
|
295
|
+
<p><a class="source-toggle" href="#"
|
|
296
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
|
297
|
+
<div class="method-source-code" id="M000003-source">
|
|
298
|
+
<pre>
|
|
299
|
+
<span class="ruby-comment cmt"># File lib/violet/response.rb, line 390</span>
|
|
300
|
+
390: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Response</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">raw</span>
|
|
301
|
+
391: <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">Base</span><span class="ruby-operator">::</span><span class="ruby-constant">ServerRsp</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">raw</span> <span class="ruby-comment cmt"># we shouldn't create ServerRsp instances, but act as if you didn't see ;)</span>
|
|
302
|
+
392: <span class="ruby-identifier">klassname</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">raw</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r|<rsp>\s*</rsp>|i</span>
|
|
303
|
+
393: <span class="ruby-value str">'EmptyServerRsp'</span>
|
|
304
|
+
394: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">has_message?</span>
|
|
305
|
+
395: <span class="ruby-node">/^#{tmp.message}$/i</span>
|
|
306
|
+
396: <span class="ruby-keyword kw">else</span>
|
|
307
|
+
397: <span class="ruby-node">/^#{tmp.xml.root.elements[1].name}$/i</span> <span class="ruby-comment cmt"># REXML::Elements#[] has index 1-based and not 0-based, so we really fetch the first element's name</span>
|
|
308
|
+
398: <span class="ruby-keyword kw">end</span>
|
|
309
|
+
399:
|
|
310
|
+
400: <span class="ruby-identifier">klass</span> = <span class="ruby-keyword kw">nil</span>
|
|
311
|
+
401: <span class="ruby-keyword kw">begin</span>
|
|
312
|
+
402: <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span> <span class="ruby-node">"#{self}::#{Response.constants.grep(klassname).first}"</span>
|
|
313
|
+
403: <span class="ruby-identifier">raise</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">nil?</span>
|
|
314
|
+
404: <span class="ruby-keyword kw">rescue</span>
|
|
315
|
+
405: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ProtocolExcepion</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"unknown server's response : #{raw}"</span>)
|
|
316
|
+
406: <span class="ruby-keyword kw">end</span>
|
|
317
|
+
407:
|
|
318
|
+
408: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">raw</span>
|
|
319
|
+
409: <span class="ruby-keyword kw">end</span>
|
|
320
|
+
</pre>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
<div id="validator-badges">
|
|
333
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</body>
|
|
337
|
+
</html>
|
|
@@ -0,0 +1,118 @@
|
|
|
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>Module: VioletAPI</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>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">VioletAPI</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../files/lib/violet/violetapi_rb.html">
|
|
59
|
+
lib/violet/violetapi.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
</table>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- banner header -->
|
|
68
|
+
|
|
69
|
+
<div id="bodyContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<div id="contextContent">
|
|
74
|
+
<div id="diagram">
|
|
75
|
+
<map id="map" name="map">
|
|
76
|
+
<area shape="rect" coords="16,16,109,64" href="VioletAPI.html" alt="VioletAPI" />
|
|
77
|
+
</map>
|
|
78
|
+
<img src="../dot/f_7.png" usemap="#map" border="0" alt="dot/f_7.png">
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div id="description">
|
|
82
|
+
<h2>violet/violetapi.rb</h2>
|
|
83
|
+
<p>
|
|
84
|
+
TODO
|
|
85
|
+
</p>
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<!-- if includes -->
|
|
97
|
+
|
|
98
|
+
<div id="section">
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
<!-- if method_list -->
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<div id="validator-badges">
|
|
114
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
data/doc/created.rid
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Wed, 05 Dec 2007 14:34:36 +0100
|
data/doc/dot/f_0.dot
ADDED
data/doc/dot/f_0.png
ADDED
|
Binary file
|
data/doc/dot/f_4.dot
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
digraph TopLevel {
|
|
2
|
+
compound = true
|
|
3
|
+
bgcolor = lightcyan1
|
|
4
|
+
fontname = Arial
|
|
5
|
+
fontsize = 8
|
|
6
|
+
label = "TopLevel"
|
|
7
|
+
node [
|
|
8
|
+
fontname = Arial,
|
|
9
|
+
fontsize = 8,
|
|
10
|
+
color = black
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
subgraph cluster_Libastag {
|
|
14
|
+
fillcolor = palegreen1
|
|
15
|
+
URL = "classes/Libastag.html"
|
|
16
|
+
fontname = Arial
|
|
17
|
+
color = blue
|
|
18
|
+
label = "Libastag"
|
|
19
|
+
style = filled
|
|
20
|
+
Libastag [
|
|
21
|
+
shape = plaintext,
|
|
22
|
+
height = 0.01,
|
|
23
|
+
width = 0.01,
|
|
24
|
+
label = ""
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
Libastag__RabitEar [
|
|
28
|
+
fontcolor = black,
|
|
29
|
+
URL = "classes/Libastag/RabitEar.html",
|
|
30
|
+
shape = ellipse,
|
|
31
|
+
color = palegoldenrod,
|
|
32
|
+
style = filled,
|
|
33
|
+
label = "RabitEar"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
Libastag__RabitLed [
|
|
37
|
+
fontcolor = black,
|
|
38
|
+
URL = "classes/Libastag/RabitLed.html",
|
|
39
|
+
shape = ellipse,
|
|
40
|
+
color = palegoldenrod,
|
|
41
|
+
style = filled,
|
|
42
|
+
label = "RabitLed"
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
Libastag__Rabbit [
|
|
46
|
+
fontcolor = black,
|
|
47
|
+
URL = "classes/Libastag/Rabbit.html",
|
|
48
|
+
shape = ellipse,
|
|
49
|
+
color = palegoldenrod,
|
|
50
|
+
style = filled,
|
|
51
|
+
label = "Rabbit"
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
data/doc/dot/f_4.png
ADDED
|
Binary file
|