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.
Files changed (108) hide show
  1. data/BUGS +10 -0
  2. data/CHANGES +8 -1
  3. data/MIT-LICENSE +2 -1
  4. data/README +7 -3
  5. data/Rakefile +3 -2
  6. data/TODO +4 -7
  7. data/doc/classes/Helpers.html +16 -20
  8. data/doc/classes/Helpers/REXML.html +4 -4
  9. data/doc/classes/Helpers/REXML/Attributes.html +10 -10
  10. data/doc/classes/Libastag.html +5 -5
  11. data/doc/classes/Libastag/Rabbit.html +56 -56
  12. data/doc/classes/Libastag/RabitEar.html +4 -4
  13. data/doc/classes/Libastag/RabitLed.html +4 -4
  14. data/doc/classes/Request.html +33 -37
  15. data/doc/classes/Request/Action.html +34 -34
  16. data/doc/classes/Request/AudioStream.html +313 -0
  17. data/doc/classes/Request/Base.html +13 -10
  18. data/doc/classes/Request/Base/Event.html +58 -23
  19. data/doc/classes/Request/Base/EventCollection.html +35 -32
  20. data/doc/classes/Request/Choregraphy.html +500 -0
  21. data/doc/classes/Request/Choregraphy/BadChorDesc.html +135 -0
  22. data/doc/classes/Request/Choregraphy/Ears.html +130 -0
  23. data/doc/classes/Request/Choregraphy/Ears/Directions.html +141 -0
  24. data/doc/classes/Request/Choregraphy/Ears/Positions.html +146 -0
  25. data/doc/classes/Request/Choregraphy/Leds.html +130 -0
  26. data/doc/classes/Request/Choregraphy/Leds/Colors.html +171 -0
  27. data/doc/classes/Request/Choregraphy/Leds/Positions.html +161 -0
  28. data/doc/classes/Request/GET_EARS_POSITION.html +17 -14
  29. data/doc/classes/Request/IdMessage.html +234 -0
  30. data/doc/classes/Request/Query.html +80 -55
  31. data/doc/classes/Request/SetEarsPosition.html +58 -36
  32. data/doc/classes/Request/TtsMessage.html +74 -50
  33. data/doc/classes/Response.html +55 -124
  34. data/doc/classes/Response/AbuseSending.html +34 -34
  35. data/doc/classes/Response/Base.html +34 -34
  36. data/doc/classes/Response/Base/BadServerRsp.html +34 -34
  37. data/doc/classes/Response/Base/GoodServerRsp.html +34 -34
  38. data/doc/classes/Response/Base/ServerRsp.html +53 -53
  39. data/doc/classes/Response/Blacklist.html +34 -34
  40. data/doc/classes/Response/ChorNotSend.html +34 -34
  41. data/doc/classes/Response/ChorSend.html +34 -34
  42. data/doc/classes/Response/CommandSend.html +34 -34
  43. data/doc/classes/Response/EarPositionNotSend.html +34 -34
  44. data/doc/classes/Response/EarPositionSend.html +34 -34
  45. data/doc/classes/Response/EmptyServerRsp.html +34 -34
  46. data/doc/classes/Response/LangListUser.html +34 -34
  47. data/doc/classes/Response/LinkPreview.html +34 -34
  48. data/doc/classes/Response/ListFriend.html +34 -34
  49. data/doc/classes/Response/ListReceivedMsg.html +34 -34
  50. data/doc/classes/Response/MessageNotSend.html +34 -34
  51. data/doc/classes/Response/MessageSend.html +34 -34
  52. data/doc/classes/Response/NabCastNotSend.html +34 -34
  53. data/doc/classes/Response/NabCastSend.html +34 -34
  54. data/doc/classes/Response/NoCorrectParameters.html +34 -34
  55. data/doc/classes/Response/NoGoodTokenOrSerial.html +34 -34
  56. data/doc/classes/Response/NotV2Rabbit.html +34 -34
  57. data/doc/classes/Response/PositionEar.html +34 -34
  58. data/doc/classes/Response/ProtocolExcepion.html +35 -35
  59. data/doc/classes/Response/RabbitName.html +34 -34
  60. data/doc/classes/Response/RabbitSleep.html +34 -34
  61. data/doc/classes/Response/RabbitVersion.html +34 -34
  62. data/doc/classes/Response/Signature.html +34 -34
  63. data/doc/classes/Response/Timezone.html +34 -34
  64. data/doc/classes/Response/TtsNotSend.html +34 -34
  65. data/doc/classes/Response/TtsSend.html +34 -34
  66. data/doc/classes/Response/VoiceListTts.html +34 -34
  67. data/doc/classes/Response/WebRadioNotSend.html +34 -34
  68. data/doc/classes/Response/WebRadioSend.html +34 -34
  69. data/doc/created.rid +1 -1
  70. data/doc/dot/f_0.png +0 -0
  71. data/doc/dot/f_5.dot +13 -445
  72. data/doc/dot/f_5.png +0 -0
  73. data/doc/dot/f_6.dot +445 -11
  74. data/doc/dot/f_6.png +0 -0
  75. data/doc/dot/f_7.dot +30 -5
  76. data/doc/dot/f_7.png +0 -0
  77. data/doc/dot/f_8.dot +39 -0
  78. data/doc/dot/f_8.png +0 -0
  79. data/doc/files/{lib/violet/violetapi_rb.html → BUGS.html} +17 -9
  80. data/doc/files/CHANGES.html +15 -2
  81. data/doc/files/MIT-LICENSE.html +2 -2
  82. data/doc/files/README.html +13 -3
  83. data/doc/files/TODO.html +5 -8
  84. data/doc/files/lib/libastag_rb.html +12 -10
  85. data/doc/files/lib/violet/helpers_rb.html +5 -5
  86. data/doc/files/lib/violet/request_rb.html +16 -12
  87. data/doc/files/lib/violet/response_rb.html +36 -35
  88. data/doc/fr_class_index.html +10 -1
  89. data/doc/fr_file_index.html +1 -1
  90. data/doc/fr_method_index.html +25 -12
  91. data/examples/morse.rb +72 -0
  92. data/lib/libastag.rb +6 -2
  93. data/lib/violet/helpers.rb +4 -2
  94. data/lib/violet/request.rb +501 -47
  95. data/lib/violet/response.rb +5 -2
  96. data/test/fake_violet_srv.rb +1 -1
  97. data/test/test_helpers.rb +3 -5
  98. data/test/{test_send.rb → test_query_and_actions.rb} +27 -10
  99. data/test/test_request_base.rb +76 -0
  100. data/test/test_request_chor.rb +162 -0
  101. data/test/test_request_stuff.rb +171 -0
  102. data/test/test_response.rb +3 -4
  103. metadata +45 -20
  104. data/doc/classes/VioletAPI.html +0 -118
  105. data/doc/dot/f_4.dot +0 -57
  106. data/doc/dot/f_4.png +0 -0
  107. data/lib/violet/violetapi.rb +0 -14
  108. data/test/test_request.rb +0 -20
@@ -81,20 +81,37 @@
81
81
  <div id="contextContent">
82
82
  <div id="diagram">
83
83
  <map id="map" name="map">
84
- <area shape="rect" coords="392,85,464,133" href="Base/Event.html" alt="Event" />
85
- <area shape="rect" coords="27,181,99,229" href="Action.html" alt="Action" />
86
- <area shape="rect" coords="123,181,211,229" href="TtsMessage.html" alt="TtsMessage" />
87
- <area shape="rect" coords="235,181,341,229" href="SetEarsPosition.html" alt="SetEarsPosition" />
88
- <area shape="rect" coords="365,181,469,229" href="Base/EventCollection.html" alt="EventCollection" />
89
- <area shape="rect" coords="647,85,724,133" href="../Enumerable.html" alt="Enumerable" />
90
- <area shape="rect" coords="135,85,207,133" href="Query.html" alt="Query" />
91
- <area shape="rect" coords="491,73,625,121" href="GET_EARS_POSITION.html" alt="GET_EARS_POSITION" />
92
- <area shape="rect" coords="355,51,480,240" href="Base.html" alt="Base" />
93
- <area shape="rect" coords="16,16,636,251" href="../Request.html" alt="Request" />
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" />
94
97
  </map>
95
98
  <img src="../../dot/f_8.png" usemap="#map" border="0" alt="dot/f_8.png">
96
99
  </div>
97
100
 
101
+ <div id="description">
102
+ <p>
103
+ <a href="SetEarsPosition.html">SetEarsPosition</a> events change your
104
+ rabbit&#8216;s ears positions. you can set left ear position, or right ear
105
+ position, or both.
106
+ </p>
107
+ <h1>Examples</h1>
108
+ <pre>
109
+ SetEarsPosition.new :posleft =&gt; 12 # =&gt; #&lt;Request::SetEarsPosition:0x2ad0b2c79680 @h={:posleft=&gt;12}&gt;
110
+ SetEarsPosition.new :posright =&gt; 1 # =&gt; #&lt;Request::SetEarsPosition:0x2ad0b2c70260 @h={:posright=&gt;1}&gt;
111
+ SetEarsPosition.new :posright =&gt; 5, :posleft =&gt; 5 # =&gt; #&lt;Request::SetEarsPosition:0x2ad0b2c5e330 @h={:posleft=&gt;5, :posright=&gt;5}&gt;
112
+ </pre>
113
+
114
+ </div>
98
115
 
99
116
 
100
117
  </div>
@@ -103,8 +120,8 @@
103
120
  <h3 class="section-bar">Methods</h3>
104
121
 
105
122
  <div class="name-list">
106
- <a href="#M000029">new</a>&nbsp;&nbsp;
107
- <a href="#M000030">to_url</a>&nbsp;&nbsp;
123
+ <a href="#M000042">new</a>&nbsp;&nbsp;
124
+ <a href="#M000043">to_url</a>&nbsp;&nbsp;
108
125
  </div>
109
126
  </div>
110
127
 
@@ -144,27 +161,32 @@
144
161
  <div id="methods">
145
162
  <h3 class="section-bar">Public Class methods</h3>
146
163
 
147
- <div id="method-M000029" class="method-detail">
148
- <a name="M000029"></a>
164
+ <div id="method-M000042" class="method-detail">
165
+ <a name="M000042"></a>
149
166
 
150
167
  <div class="method-heading">
151
- <a href="#M000029" class="method-signature">
168
+ <a href="#M000042" class="method-signature">
152
169
  <span class="method-name">new</span><span class="method-args">(h)</span>
153
170
  </a>
154
171
  </div>
155
172
 
156
173
  <div class="method-description">
174
+ <p>
175
+ take an hash in parameter, with <tt>:posright</tt> and/or <tt>:posleft</tt>
176
+ keys. values should be between SetEarsPosition::MIN_POS and
177
+ SetEarsPosition::MAX_POS.
178
+ </p>
157
179
  <p><a class="source-toggle" href="#"
158
- onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
159
- <div class="method-source-code" id="M000029-source">
180
+ onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
181
+ <div class="method-source-code" id="M000042-source">
160
182
  <pre>
161
- <span class="ruby-comment cmt"># File lib/violet/request.rb, line 114</span>
162
- 114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
163
- 115: <span class="ruby-ivar">@h</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">dup</span>
164
- 116: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'at least :posright or :posleft must be set'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>]
165
- 117: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;:posright must be between #{MIN_POS} and #{MAX_POS}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-constant">MIN_POS</span>,<span class="ruby-constant">MAX_POS</span>)
166
- 118: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;:posleft must be between #{MIN_POS} and #{MAX_POS}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span> ] <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span> ].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-constant">MIN_POS</span>,<span class="ruby-constant">MAX_POS</span>)
167
- 119: <span class="ruby-keyword kw">end</span>
183
+ <span class="ruby-comment cmt"># File lib/violet/request.rb, line 152</span>
184
+ 152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
185
+ 153: <span class="ruby-ivar">@h</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">dup</span>
186
+ 154: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'at least :posright or :posleft must be set'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>]
187
+ 155: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;:posright must be between #{MIN_POS} and #{MAX_POS}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-constant">MIN_POS</span>,<span class="ruby-constant">MAX_POS</span>)
188
+ 156: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;:posleft must be between #{MIN_POS} and #{MAX_POS}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span> ] <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span> ].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-constant">MIN_POS</span>,<span class="ruby-constant">MAX_POS</span>)
189
+ 157: <span class="ruby-keyword kw">end</span>
168
190
  </pre>
169
191
  </div>
170
192
  </div>
@@ -172,27 +194,27 @@
172
194
 
173
195
  <h3 class="section-bar">Public Instance methods</h3>
174
196
 
175
- <div id="method-M000030" class="method-detail">
176
- <a name="M000030"></a>
197
+ <div id="method-M000043" class="method-detail">
198
+ <a name="M000043"></a>
177
199
 
178
200
  <div class="method-heading">
179
- <a href="#M000030" class="method-signature">
201
+ <a href="#M000043" class="method-signature">
180
202
  <span class="method-name">to_url</span><span class="method-args">()</span>
181
203
  </a>
182
204
  </div>
183
205
 
184
206
  <div class="method-description">
185
207
  <p><a class="source-toggle" href="#"
186
- onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
187
- <div class="method-source-code" id="M000030-source">
208
+ onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000043-source">
188
210
  <pre>
189
- <span class="ruby-comment cmt"># File lib/violet/request.rb, line 122</span>
190
- 122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
191
- 123: <span class="ruby-identifier">url</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
192
- 124: <span class="ruby-identifier">url</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;posleft=#{h[:posleft].to_i}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:posleft</span>]
193
- 125: <span class="ruby-identifier">url</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;posright=#{h[:posright].to_i}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:posright</span>]
194
- 126: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&amp;'</span>)
195
- 127: <span class="ruby-keyword kw">end</span>
211
+ <span class="ruby-comment cmt"># File lib/violet/request.rb, line 159</span>
212
+ 159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
213
+ 160: <span class="ruby-identifier">url</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
214
+ 161: <span class="ruby-identifier">url</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;posleft=#{@h[:posleft].to_i}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posleft</span>]
215
+ 162: <span class="ruby-identifier">url</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;posright=#{@h[:posright].to_i}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:posright</span>]
216
+ 163: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">sort</span>
217
+ 164: <span class="ruby-keyword kw">end</span>
196
218
  </pre>
197
219
  </div>
198
220
  </div>
@@ -81,20 +81,36 @@
81
81
  <div id="contextContent">
82
82
  <div id="diagram">
83
83
  <map id="map" name="map">
84
- <area shape="rect" coords="392,85,464,133" href="Base/Event.html" alt="Event" />
85
- <area shape="rect" coords="27,181,99,229" href="Action.html" alt="Action" />
86
- <area shape="rect" coords="123,181,211,229" href="TtsMessage.html" alt="TtsMessage" />
87
- <area shape="rect" coords="235,181,341,229" href="SetEarsPosition.html" alt="SetEarsPosition" />
88
- <area shape="rect" coords="365,181,469,229" href="Base/EventCollection.html" alt="EventCollection" />
89
- <area shape="rect" coords="647,85,724,133" href="../Enumerable.html" alt="Enumerable" />
90
- <area shape="rect" coords="135,85,207,133" href="Query.html" alt="Query" />
91
- <area shape="rect" coords="491,73,625,121" href="GET_EARS_POSITION.html" alt="GET_EARS_POSITION" />
92
- <area shape="rect" coords="355,51,480,240" href="Base.html" alt="Base" />
93
- <area shape="rect" coords="16,16,636,251" href="../Request.html" alt="Request" />
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" />
94
97
  </map>
95
98
  <img src="../../dot/f_8.png" usemap="#map" border="0" alt="dot/f_8.png">
96
99
  </div>
97
100
 
101
+ <div id="description">
102
+ <p>
103
+ <a href="TtsMessage.html">TtsMessage</a> events are used to Text-To-Speach
104
+ messages.
105
+ </p>
106
+ <h1>Examples</h1>
107
+ <pre>
108
+ TtsMessage.new :tts =&gt; &quot;oups!&quot; # =&gt; #&lt;Request::TtsMessage:0x2ab1ba3cd8e0 @h={:tts=&gt;&quot;oups!&quot;}&gt;
109
+ TtsMessage.new :tts =&gt; &quot;allez hop !&quot;, :speed =&gt; 200, :voice =&gt; &quot;caroline22k&quot; # =&gt; #&lt;Request::TtsMessage:0x2ab1ba3b8e40 @h={:tts=&gt;&quot;allez%20hop%20!&quot;, :speed=&gt;200, :voice=&gt;&quot;caroline22k&quot;}&gt;
110
+ TtsMessage.new :tts =&gt; &quot;GNU is Not Unix&quot;, :speed =&gt; 200, :pitch =&gt; 400 # =&gt; #&lt;Request::TtsMessage:0x2ab1ba3a9580 @h={:tts=&gt;&quot;GNU%20is%20Not%20Unix&quot;, :speed=&gt;200, :pitch=&gt;400}&gt;
111
+ </pre>
112
+
113
+ </div>
98
114
 
99
115
 
100
116
  </div>
@@ -103,8 +119,8 @@
103
119
  <h3 class="section-bar">Methods</h3>
104
120
 
105
121
  <div class="name-list">
106
- <a href="#M000027">new</a>&nbsp;&nbsp;
107
- <a href="#M000028">to_url</a>&nbsp;&nbsp;
122
+ <a href="#M000038">new</a>&nbsp;&nbsp;
123
+ <a href="#M000039">to_url</a>&nbsp;&nbsp;
108
124
  </div>
109
125
  </div>
110
126
 
@@ -129,7 +145,7 @@
129
145
  <tr class="top-aligned-row context-row">
130
146
  <td class="context-item-name">MAX_SPEED</td>
131
147
  <td>=</td>
132
- <td class="context-item-value">32000</td>
148
+ <td class="context-item-value">32_000</td>
133
149
  </tr>
134
150
  <tr class="top-aligned-row context-row">
135
151
  <td class="context-item-name">MIN_PITCH</td>
@@ -139,7 +155,7 @@
139
155
  <tr class="top-aligned-row context-row">
140
156
  <td class="context-item-name">MAX_PITCH</td>
141
157
  <td>=</td>
142
- <td class="context-item-value">32000</td>
158
+ <td class="context-item-value">32_000</td>
143
159
  </tr>
144
160
  </table>
145
161
  </div>
@@ -154,38 +170,47 @@
154
170
  <div id="methods">
155
171
  <h3 class="section-bar">Public Class methods</h3>
156
172
 
157
- <div id="method-M000027" class="method-detail">
158
- <a name="M000027"></a>
173
+ <div id="method-M000038" class="method-detail">
174
+ <a name="M000038"></a>
159
175
 
160
176
  <div class="method-heading">
161
- <a href="#M000027" class="method-signature">
177
+ <a href="#M000038" class="method-signature">
162
178
  <span class="method-name">new</span><span class="method-args">(h)</span>
163
179
  </a>
164
180
  </div>
165
181
 
166
182
  <div class="method-description">
183
+ <p>
184
+ take an hash in parameter, with at least <tt>:tts</tt> key. the
185
+ <tt>:tts</tt> key must be a string encoded in UTF-8. Optionals parameters
186
+ are <tt>:speed</tt> and <tt>:pitch</tt>, they must be between MIN_SPEED and
187
+ MAX_SPEED (MIN_PITCH and MAX_PITCH respectively). Default values for
188
+ speed/pitch is 100.
189
+ </p>
167
190
  <p><a class="source-toggle" href="#"
168
- onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
169
- <div class="method-source-code" id="M000027-source">
191
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
192
+ <div class="method-source-code" id="M000038-source">
170
193
  <pre>
171
- <span class="ruby-comment cmt"># File lib/violet/request.rb, line 140</span>
172
- 140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
173
- 141: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'no text given'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:tts</span>]
174
- 142: <span class="ruby-ivar">@h</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">dup</span>
175
- 143:
176
- 144: [<span class="ruby-identifier">:speed</span>,<span class="ruby-identifier">:pitch</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
177
- 145: <span class="ruby-identifier">min</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-node">&quot;#{self.class}::MIN_#{p.to_s.upcase}&quot;</span>)
178
- 146: <span class="ruby-identifier">max</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-node">&quot;#{self.class}::MAX_#{p.to_s.upcase}&quot;</span>)
179
- 147:
180
- 148: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">p</span>].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-identifier">min</span>,<span class="ruby-identifier">max</span>)
181
- 149: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{p} values must be between #{min} and #{max}&quot;</span>)
182
- 150: <span class="ruby-keyword kw">else</span>
183
- 151: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">p</span>] = <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">p</span>].<span class="ruby-identifier">to_i</span>
184
- 152: <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">p</span>]
185
- 153: <span class="ruby-keyword kw">end</span>
186
- 154:
187
- 155: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:tts</span>] = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:tts</span>]
188
- 156: <span class="ruby-keyword kw">end</span>
194
+ <span class="ruby-comment cmt"># File lib/violet/request.rb, line 184</span>
195
+ 184: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">h</span>
196
+ 185: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'no :tts given'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:tts</span>]
197
+ 186: <span class="ruby-ivar">@h</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">dup</span>
198
+ 187:
199
+ 188: [<span class="ruby-identifier">:speed</span>,<span class="ruby-identifier">:pitch</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
200
+ 189: <span class="ruby-identifier">min</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-node">&quot;#{self.class}::MIN_#{k.to_s.upcase}&quot;</span>)
201
+ 190: <span class="ruby-identifier">max</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-node">&quot;#{self.class}::MAX_#{k.to_s.upcase}&quot;</span>)
202
+ 191:
203
+ 192: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-identifier">min</span>,<span class="ruby-identifier">max</span>)
204
+ 193: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{k} values must be between #{min} and #{max}&quot;</span>)
205
+ 194: <span class="ruby-keyword kw">else</span>
206
+ 195: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_i</span>
207
+ 196: <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">k</span>]
208
+ 197: <span class="ruby-keyword kw">end</span>
209
+ 198:
210
+ 199: <span class="ruby-comment cmt"># to have a well formatted url</span>
211
+ 200: <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:tts</span>] = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">escape</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">:tts</span>]
212
+ 201: <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>]
213
+ 202: <span class="ruby-keyword kw">end</span>
189
214
  </pre>
190
215
  </div>
191
216
  </div>
@@ -193,28 +218,27 @@
193
218
 
194
219
  <h3 class="section-bar">Public Instance methods</h3>
195
220
 
196
- <div id="method-M000028" class="method-detail">
197
- <a name="M000028"></a>
221
+ <div id="method-M000039" class="method-detail">
222
+ <a name="M000039"></a>
198
223
 
199
224
  <div class="method-heading">
200
- <a href="#M000028" class="method-signature">
225
+ <a href="#M000039" class="method-signature">
201
226
  <span class="method-name">to_url</span><span class="method-args">()</span>
202
227
  </a>
203
228
  </div>
204
229
 
205
230
  <div class="method-description">
206
231
  <p><a class="source-toggle" href="#"
207
- onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
208
- <div class="method-source-code" id="M000028-source">
232
+ onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
233
+ <div class="method-source-code" id="M000039-source">
209
234
  <pre>
210
- <span class="ruby-comment cmt"># File lib/violet/request.rb, line 158</span>
211
- 158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
212
- 159: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">in</span> [<span class="ruby-identifier">:tts</span>,<span class="ruby-identifier">:voice</span>,<span class="ruby-identifier">:speed</span>,<span class="ruby-identifier">:pitch</span>] <span class="ruby-keyword kw">do</span>
213
- 160: (<span class="ruby-identifier">url</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{p}=#{@h[p]}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@h</span>[<span class="ruby-identifier">p</span>]
214
- 161: <span class="ruby-keyword kw">end</span>
215
- 162:
216
- 163: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&amp;'</span>)
217
- 164: <span class="ruby-keyword kw">end</span>
235
+ <span class="ruby-comment cmt"># File lib/violet/request.rb, line 204</span>
236
+ 204: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_url</span>
237
+ 205: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">key</span>,<span class="ruby-identifier">val</span> <span class="ruby-keyword kw">in</span> <span class="ruby-ivar">@h</span>
238
+ 206: (<span class="ruby-identifier">url</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{key}=#{val}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>
239
+ 207: <span class="ruby-keyword kw">end</span>
240
+ 208: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">sort</span>
241
+ 209: <span class="ruby-keyword kw">end</span>
218
242
  </pre>
219
243
  </div>
220
244
  </div>
@@ -73,116 +73,47 @@
73
73
  <div id="contextContent">
74
74
  <div id="diagram">
75
75
  <map id="map" name="map">
76
- <area shape="rect" coords="1625,229,1732,277" href="Response/Base/GoodServerRsp.html" alt="GoodServerRsp" />
76
+ <area shape="rect" coords="1621,229,1731,277" href="Response/Base/GoodServerRsp.html" alt="GoodServerRsp" />
77
77
  <area shape="rect" coords="27,325,136,373" href="Response/EarPositionSend.html" alt="EarPositionSend" />
78
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" />
79
+ <area shape="rect" coords="280,325,381,373" href="Response/CommandSend.html" alt="CommandSend" />
80
+ <area shape="rect" coords="405,325,483,373" href="Response/Signature.html" alt="Signature" />
81
+ <area shape="rect" coords="507,325,589,373" href="Response/PositionEar.html" alt="PositionEar" />
82
+ <area shape="rect" coords="613,325,704,373" href="Response/VoiceListTts.html" alt="VoiceListTts" />
83
+ <area shape="rect" coords="728,325,819,373" href="Response/LinkPreview.html" alt="LinkPreview" />
84
84
  <area shape="rect" coords="843,325,941,373" href="Response/MessageSend.html" alt="MessageSend" />
85
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" />
86
+ <area shape="rect" coords="1083,325,1171,373" href="Response/RabbitName.html" alt="RabbitName" />
87
+ <area shape="rect" coords="1195,325,1267,373" href="Response/TtsSend.html" alt="TtsSend" />
88
+ <area shape="rect" coords="1291,325,1403,373" href="Response/ListReceivedMsg.html" alt="ListReceivedMsg" />
89
+ <area shape="rect" coords="1427,325,1504,373" href="Response/ListFriend.html" alt="ListFriend" />
90
+ <area shape="rect" coords="1528,325,1616,373" href="Response/RabbitSleep.html" alt="RabbitSleep" />
91
+ <area shape="rect" coords="1640,325,1712,373" href="Response/Blacklist.html" alt="Blacklist" />
92
+ <area shape="rect" coords="1736,325,1813,373" href="Response/Timezone.html" alt="Timezone" />
93
+ <area shape="rect" coords="1837,325,1936,373" href="Response/RabbitVersion.html" alt="RabbitVersion" />
94
+ <area shape="rect" coords="1960,325,2064,373" href="Response/WebRadioSend.html" alt="WebRadioSend" />
95
+ <area shape="rect" coords="2088,325,2165,373" href="Response/ChorSend.html" alt="ChorSend" />
96
+ <area shape="rect" coords="1755,229,1856,277" href="Response/Base/BadServerRsp.html" alt="BadServerRsp" />
97
+ <area shape="rect" coords="2189,325,2325,373" href="Response/NoGoodTokenOrSerial.html" alt="NoGoodTokenOrSerial" />
98
+ <area shape="rect" coords="2349,325,2443,373" href="Response/ChorNotSend.html" alt="ChorNotSend" />
99
+ <area shape="rect" coords="2467,325,2579,373" href="Response/NabCastNotSend.html" alt="NabCastNotSend" />
100
+ <area shape="rect" coords="2603,325,2717,373" href="Response/MessageNotSend.html" alt="MessageNotSend" />
101
+ <area shape="rect" coords="2741,325,2843,373" href="Response/AbuseSending.html" alt="AbuseSending" />
102
+ <area shape="rect" coords="2867,325,3000,373" href="Response/NoCorrectParameters.html" alt="NoCorrectParameters" />
103
+ <area shape="rect" coords="3024,325,3109,373" href="Response/TtsNotSend.html" alt="TtsNotSend" />
104
+ <area shape="rect" coords="3133,325,3224,373" href="Response/NotV2Rabbit.html" alt="NotV2Rabbit" />
105
+ <area shape="rect" coords="3248,325,3368,373" href="Response/WebRadioNotSend.html" alt="WebRadioNotSend" />
106
+ <area shape="rect" coords="3392,325,3517,373" href="Response/EarPositionNotSend.html" alt="EarPositionNotSend" />
107
+ <area shape="rect" coords="1136,5,1235,53" href="StandardError.html" alt="StandardError" />
108
+ <area shape="rect" coords="1128,133,1243,181" href="Response/ProtocolExcepion.html" alt="ProtocolExcepion" />
109
+ <area shape="rect" coords="1764,133,1847,181" href="Response/Base/ServerRsp.html" alt="ServerRsp" />
110
+ <area shape="rect" coords="1880,229,1992,277" href="Response/EmptyServerRsp.html" alt="EmptyServerRsp" />
111
+ <area shape="rect" coords="1611,99,1867,288" href="Response/Base.html" alt="Base" />
112
+ <area shape="rect" coords="16,64,3528,384" href="Response.html" alt="Response" />
113
113
  </map>
114
- <img src="../dot/f_5.png" usemap="#map" border="0" alt="dot/f_5.png">
114
+ <img src="../dot/f_6.png" usemap="#map" border="0" alt="dot/f_6.png">
115
115
  </div>
116
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&#8216;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 &quot;x&quot;,
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 &quot;x&quot;,
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&#8216;s text if any, or
142
- a hash of it&#8216;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
- &gt;&gt; rsp = Response.parse('&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;rsp&gt;&lt;blacklist nb=&quot;2&quot;/&gt;&lt;pseudo name=&quot;toto&quot;/&gt;&lt;pseudo name=&quot;titi&quot;/&gt;&lt;/rsp&gt;')
161
- =&gt; #&lt;Response::Blacklist:0x2acd8c08f2f8 @xml=&lt;UNDEFINED&gt; ... &lt;/&gt;&gt;
162
- &gt;&gt; rsp.good?
163
- =&gt; true
164
- &gt;&gt; rsp.has_message?
165
- =&gt; false
166
- &gt;&gt; rsp.message
167
- NameError: undefined local variable or method message for #&lt;Response::Blacklist:0x2b1f056afdc0 @xml=&lt;UNDEFINED&gt; ... &lt;/&gt;&gt;
168
- &gt;&gt; rsp.has_blacklist?
169
- =&gt; true
170
- &gt;&gt; rsp.blacklist
171
- =&gt; {:nb=&gt;&quot;2&quot;}
172
- &gt;&gt; rsp.pseudo
173
- =&gt; {:name=&gt;&quot;toto&quot;}
174
- &gt;&gt; rsp.has_many_pseudos?
175
- =&gt; true
176
- &gt;&gt; rsp.pseudos
177
- =&gt; [{:name=&gt;&quot;toto&quot;}, {:name=&gt;&quot;titi&quot;}]
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
117
 
187
118
 
188
119
  </div>
@@ -296,27 +227,27 @@ fail to detect the kind of the server&#8216;s response.
296
227
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
297
228
  <div class="method-source-code" id="M000003-source">
298
229
  <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|&lt;rsp&gt;\s*&lt;/rsp&gt;|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">&quot;#{self}::#{Response.constants.grep(klassname).first}&quot;</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">&quot;unknown server's response : #{raw}&quot;</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>
230
+ <span class="ruby-comment cmt"># File lib/violet/response.rb, line 393</span>
231
+ 393: <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>
232
+ 394: <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>
233
+ 395: <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|&lt;rsp&gt;\s*&lt;/rsp&gt;|i</span>
234
+ 396: <span class="ruby-value str">'EmptyServerRsp'</span>
235
+ 397: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">has_message?</span>
236
+ 398: <span class="ruby-node">/^#{tmp.message}$/i</span>
237
+ 399: <span class="ruby-keyword kw">else</span>
238
+ 400: <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>
239
+ 401: <span class="ruby-keyword kw">end</span>
240
+ 402:
241
+ 403: <span class="ruby-identifier">klass</span> = <span class="ruby-keyword kw">nil</span>
242
+ 404: <span class="ruby-keyword kw">begin</span>
243
+ 405: <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">constantize</span> <span class="ruby-node">&quot;#{self}::#{Response.constants.grep(klassname).first}&quot;</span>
244
+ 406: <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>
245
+ 407: <span class="ruby-keyword kw">rescue</span>
246
+ 408: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ProtocolExcepion</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;unknown server's response : #{raw}&quot;</span>)
247
+ 409: <span class="ruby-keyword kw">end</span>
248
+ 410:
249
+ 411: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">raw</span>
250
+ 412: <span class="ruby-keyword kw">end</span>
320
251
  </pre>
321
252
  </div>
322
253
  </div>