mu 5.7.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/Mu_Gem.html +1591 -0
  2. data/bin/mu +11 -0
  3. data/lib/mu.rb +65 -0
  4. data/lib/mu/api/ddt.rb +233 -0
  5. data/lib/mu/api/homepage.rb +54 -0
  6. data/lib/mu/api/muapi.rb +231 -0
  7. data/lib/mu/api/netconfig.rb +233 -0
  8. data/lib/mu/api/scale.rb +199 -0
  9. data/lib/mu/api/system.rb +40 -0
  10. data/lib/mu/client.rb +31 -0
  11. data/lib/mu/command.rb +28 -0
  12. data/lib/mu/command/api.rb +95 -0
  13. data/lib/mu/command/cmd_appid.rb +486 -0
  14. data/lib/mu/command/cmd_cli.rb +151 -0
  15. data/lib/mu/command/cmd_ddt.rb +449 -0
  16. data/lib/mu/command/cmd_homepage.rb +146 -0
  17. data/lib/mu/command/cmd_muapi.rb +361 -0
  18. data/lib/mu/command/cmd_netconfig.rb +262 -0
  19. data/lib/mu/command/cmd_runscale.rb +533 -0
  20. data/lib/mu/command/cmd_runscenario.rb +258 -0
  21. data/lib/mu/command/cmd_runverify.rb +336 -0
  22. data/lib/mu/command/cmd_scale.rb +333 -0
  23. data/lib/mu/command/cmd_system.rb +127 -0
  24. data/lib/mu/command/curl.rb +246 -0
  25. data/lib/mu/command/help.rb +29 -0
  26. data/lib/mu/curl/error.rb +54 -0
  27. data/lib/mu/curl/verify.rb +137 -0
  28. data/lib/mu/helper.rb +55 -0
  29. data/lib/mu/http_helper.rb +232 -0
  30. data/rdoc/classes/Mu.html +305 -0
  31. data/rdoc/classes/Mu/Client.html +265 -0
  32. data/rdoc/classes/Mu/Command.html +208 -0
  33. data/rdoc/classes/Mu/Command/API.html +524 -0
  34. data/rdoc/classes/Mu/Command/Cmd_appid.html +934 -0
  35. data/rdoc/classes/Mu/Command/Cmd_cli.html +515 -0
  36. data/rdoc/classes/Mu/Command/Cmd_ddt.html +1169 -0
  37. data/rdoc/classes/Mu/Command/Cmd_homepage.html +489 -0
  38. data/rdoc/classes/Mu/Command/Cmd_muapi.html +968 -0
  39. data/rdoc/classes/Mu/Command/Cmd_netconfig.html +743 -0
  40. data/rdoc/classes/Mu/Command/Cmd_runscale.html +970 -0
  41. data/rdoc/classes/Mu/Command/Cmd_runscenario.html +530 -0
  42. data/rdoc/classes/Mu/Command/Cmd_runverify.html +621 -0
  43. data/rdoc/classes/Mu/Command/Cmd_scale.html +939 -0
  44. data/rdoc/classes/Mu/Command/Cmd_system.html +426 -0
  45. data/rdoc/classes/Mu/Command/Curl.html +524 -0
  46. data/rdoc/classes/Mu/Command/Help.html +166 -0
  47. data/rdoc/classes/Mu/Curl.html +116 -0
  48. data/rdoc/classes/Mu/Curl/Error.html +157 -0
  49. data/rdoc/classes/Mu/Curl/Error/Authorize.html +178 -0
  50. data/rdoc/classes/Mu/Curl/Error/Connect.html +149 -0
  51. data/rdoc/classes/Mu/Curl/Error/DNS.html +113 -0
  52. data/rdoc/classes/Mu/Curl/Error/Region.html +160 -0
  53. data/rdoc/classes/Mu/Curl/Error/Status.html +149 -0
  54. data/rdoc/classes/Mu/Curl/Error/Timeout.html +149 -0
  55. data/rdoc/classes/Mu/Curl/Verify.html +282 -0
  56. data/rdoc/classes/Mu/Curl/Verify/Request.html +227 -0
  57. data/rdoc/classes/Mu/Curl/Verify/Response.html +187 -0
  58. data/rdoc/classes/Mu/Curl/Verify/Result.html +188 -0
  59. data/rdoc/classes/Mu/Ddt.html +914 -0
  60. data/rdoc/classes/Mu/Helper.html +308 -0
  61. data/rdoc/classes/Mu/Homepage.html +377 -0
  62. data/rdoc/classes/Mu/HttpHelper.html +639 -0
  63. data/rdoc/classes/Mu/Muapi.html +816 -0
  64. data/rdoc/classes/Mu/Netconfig.html +781 -0
  65. data/rdoc/classes/Mu/Scale.html +832 -0
  66. data/rdoc/classes/Mu/System.html +281 -0
  67. data/rdoc/classes/Object.html +148 -0
  68. data/rdoc/classes/TCTestMu.html +1793 -0
  69. data/rdoc/classes/Test.html +107 -0
  70. data/rdoc/classes/Test/Unit.html +107 -0
  71. data/rdoc/classes/Test/Unit/TestCase.html +113 -0
  72. data/rdoc/created.rid +1 -0
  73. data/rdoc/files/lib/mu/api/ddt_rb.html +101 -0
  74. data/rdoc/files/lib/mu/api/homepage_rb.html +101 -0
  75. data/rdoc/files/lib/mu/api/muapi_rb.html +101 -0
  76. data/rdoc/files/lib/mu/api/netconfig_rb.html +101 -0
  77. data/rdoc/files/lib/mu/api/scale_rb.html +101 -0
  78. data/rdoc/files/lib/mu/api/system_rb.html +101 -0
  79. data/rdoc/files/lib/mu/client_rb.html +101 -0
  80. data/rdoc/files/lib/mu/command/api_rb.html +101 -0
  81. data/rdoc/files/lib/mu/command/cmd_appid_rb.html +119 -0
  82. data/rdoc/files/lib/mu/command/cmd_cli_rb.html +108 -0
  83. data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +117 -0
  84. data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +115 -0
  85. data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +116 -0
  86. data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +116 -0
  87. data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +119 -0
  88. data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +115 -0
  89. data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +117 -0
  90. data/rdoc/files/lib/mu/command/cmd_scale_rb.html +115 -0
  91. data/rdoc/files/lib/mu/command/cmd_system_rb.html +116 -0
  92. data/rdoc/files/lib/mu/command/curl_rb.html +101 -0
  93. data/rdoc/files/lib/mu/command/help_rb.html +101 -0
  94. data/rdoc/files/lib/mu/command_rb.html +107 -0
  95. data/rdoc/files/lib/mu/curl/error_rb.html +101 -0
  96. data/rdoc/files/lib/mu/curl/verify_rb.html +101 -0
  97. data/rdoc/files/lib/mu/helper_rb.html +101 -0
  98. data/rdoc/files/lib/mu/http_helper_rb.html +101 -0
  99. data/rdoc/files/lib/mu_rb.html +121 -0
  100. data/rdoc/files/test/helper_rb.html +112 -0
  101. data/rdoc/files/test/tc_test_mu_rb.html +111 -0
  102. data/rdoc/fr_class_index.html +68 -0
  103. data/rdoc/fr_file_index.html +55 -0
  104. data/rdoc/fr_method_index.html +374 -0
  105. data/rdoc/index.html +24 -0
  106. data/rdoc/rdoc-style.css +208 -0
  107. data/test/data/app_id_stats.csv +1 -0
  108. data/test/data/data_cgi.msl +94 -0
  109. data/test/data/data_cgi.xml +322 -0
  110. data/test/data/default_test.csv +3 -0
  111. data/test/data/ftp_with_channel.xml +1643 -0
  112. data/test/data/irc.xml +3837 -0
  113. data/test/data/scale_configuration.json +25 -0
  114. data/test/data/test_data_cgi_error.xml +35 -0
  115. data/test/helper.rb +18 -0
  116. data/test/tc_test_mu.rb +716 -0
  117. metadata +322 -0
@@ -0,0 +1,639 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
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: Mu::HttpHelper</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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">Mu::HttpHelper</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/mu/http_helper_rb.html">
59
+ lib/mu/http_helper.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="../Object.html">
69
+ Object
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
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000081">delete</a>&nbsp;&nbsp;
92
+ <a href="#M000083">download_file</a>&nbsp;&nbsp;
93
+ <a href="#M000074">get</a>&nbsp;&nbsp;
94
+ <a href="#M000075">get_json</a>&nbsp;&nbsp;
95
+ <a href="#M000076">get_xml</a>&nbsp;&nbsp;
96
+ <a href="#M000073">new</a>&nbsp;&nbsp;
97
+ <a href="#M000077">post</a>&nbsp;&nbsp;
98
+ <a href="#M000080">post_form</a>&nbsp;&nbsp;
99
+ <a href="#M000078">post_json</a>&nbsp;&nbsp;
100
+ <a href="#M000079">post_xml</a>&nbsp;&nbsp;
101
+ <a href="#M000082">put_json</a>&nbsp;&nbsp;
102
+ </div>
103
+ </div>
104
+
105
+ </div>
106
+
107
+
108
+ <!-- if includes -->
109
+ <div id="includes">
110
+ <h3 class="section-bar">Included Modules</h3>
111
+
112
+ <div id="includes-list">
113
+ <span class="include-name"><a href="Helper.html">Helper</a></span>
114
+ </div>
115
+ </div>
116
+
117
+ <div id="section">
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <!-- if method_list -->
127
+ <div id="methods">
128
+ <h3 class="section-bar">Public Class methods</h3>
129
+
130
+ <div id="method-M000073" class="method-detail">
131
+ <a name="M000073"></a>
132
+
133
+ <div class="method-heading">
134
+ <a href="#M000073" class="method-signature">
135
+ <span class="method-name">new</span><span class="method-args">(host, username, password, docroot)</span>
136
+ </a>
137
+ </div>
138
+
139
+ <div class="method-description">
140
+ <p><a class="source-toggle" href="#"
141
+ onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
142
+ <div class="method-source-code" id="M000073-source">
143
+ <pre>
144
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 5</span>
145
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">docroot</span>)
146
+ <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
147
+ <span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
148
+ <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
149
+ <span class="ruby-ivar">@docroot</span> = <span class="ruby-identifier">docroot</span>
150
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">nil?</span>
151
+ <span class="ruby-keyword kw">end</span>
152
+ </pre>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+ <h3 class="section-bar">Public Instance methods</h3>
158
+
159
+ <div id="method-M000081" class="method-detail">
160
+ <a name="M000081"></a>
161
+
162
+ <div class="method-heading">
163
+ <a href="#M000081" class="method-signature">
164
+ <span class="method-name">delete</span><span class="method-args">(e)</span>
165
+ </a>
166
+ </div>
167
+
168
+ <div class="method-description">
169
+ <p>
170
+ basic <a href="HttpHelper.html#M000081">delete</a> call
171
+ </p>
172
+ <pre>
173
+ * e = the url suffix
174
+ </pre>
175
+ <p><a class="source-toggle" href="#"
176
+ onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
177
+ <div class="method-source-code" id="M000081-source">
178
+ <pre>
179
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 185</span>
180
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">e</span>)
181
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
182
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">url</span>)
183
+ <span class="ruby-keyword kw">end</span>
184
+ </pre>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <div id="method-M000083" class="method-detail">
190
+ <a name="M000083"></a>
191
+
192
+ <div class="method-heading">
193
+ <a href="#M000083" class="method-signature">
194
+ <span class="method-name">download_file</span><span class="method-args">(e, filename, p={})</span>
195
+ </a>
196
+ </div>
197
+
198
+ <div class="method-description">
199
+ <p>
200
+ fetches a file and stores it locally
201
+ </p>
202
+ <pre>
203
+ * e = the url suffix
204
+ * filename = the name to store the file locally
205
+ * p = hash of parameters, such as headers
206
+ </pre>
207
+ <p><a class="source-toggle" href="#"
208
+ onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000083-source">
210
+ <pre>
211
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 217</span>
212
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">download_file</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">p</span>={})
213
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
214
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
215
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
216
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>)
217
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
218
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
219
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;Could not download&quot;</span>)
220
+ <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;==&gt; Could not download the file&quot;</span>
221
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
222
+ <span class="ruby-keyword kw">end</span>
223
+ <span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">&quot;wb&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">body</span>) }
224
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">filename</span>)
225
+ <span class="ruby-keyword kw">end</span>
226
+ </pre>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <div id="method-M000074" class="method-detail">
232
+ <a name="M000074"></a>
233
+
234
+ <div class="method-heading">
235
+ <a href="#M000074" class="method-signature">
236
+ <span class="method-name">get</span><span class="method-args">(e, p={})</span>
237
+ </a>
238
+ </div>
239
+
240
+ <div class="method-description">
241
+ <p>
242
+ basic <a href="HttpHelper.html#M000074">get</a> call
243
+ </p>
244
+ <pre>
245
+ * e = the url suffix
246
+ * p = hash of parameters, such as headers
247
+ </pre>
248
+ <p><a class="source-toggle" href="#"
249
+ onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
250
+ <div class="method-source-code" id="M000074-source">
251
+ <pre>
252
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 18</span>
253
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">p</span>={})
254
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
255
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">url</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
256
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
257
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
258
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span>)
259
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
260
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
261
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
262
+ <span class="ruby-keyword kw">end</span>
263
+ </pre>
264
+ </div>
265
+ </div>
266
+ </div>
267
+
268
+ <div id="method-M000075" class="method-detail">
269
+ <a name="M000075"></a>
270
+
271
+ <div class="method-heading">
272
+ <a href="#M000075" class="method-signature">
273
+ <span class="method-name">get_json</span><span class="method-args">(e, p={})</span>
274
+ </a>
275
+ </div>
276
+
277
+ <div class="method-description">
278
+ <p>
279
+ <a href="HttpHelper.html#M000074">get</a> call for json, converts the
280
+ response to json if applicable
281
+ </p>
282
+ <pre>
283
+ * e = the url suffix
284
+ * p = hash of parameters, such as headers
285
+ </pre>
286
+ <p><a class="source-toggle" href="#"
287
+ onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
288
+ <div class="method-source-code" id="M000075-source">
289
+ <pre>
290
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 32</span>
291
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_json</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">p</span>={})
292
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
293
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">url</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
294
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
295
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
296
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span>)
297
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
298
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
299
+ <span class="ruby-keyword kw">begin</span>
300
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
301
+ <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
302
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
303
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
304
+ <span class="ruby-keyword kw">end</span>
305
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
306
+ <span class="ruby-comment cmt"># nothing to do</span>
307
+ <span class="ruby-keyword kw">end</span>
308
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
309
+ <span class="ruby-keyword kw">end</span>
310
+ </pre>
311
+ </div>
312
+ </div>
313
+ </div>
314
+
315
+ <div id="method-M000076" class="method-detail">
316
+ <a name="M000076"></a>
317
+
318
+ <div class="method-heading">
319
+ <a href="#M000076" class="method-signature">
320
+ <span class="method-name">get_xml</span><span class="method-args">(e, p={})</span>
321
+ </a>
322
+ </div>
323
+
324
+ <div class="method-description">
325
+ <p>
326
+ <a href="HttpHelper.html#M000074">get</a> call for xml, converts the
327
+ response to xml if applicable
328
+ </p>
329
+ <pre>
330
+ * e = the url suffix
331
+ * p = hash of parameters, such as headers
332
+ </pre>
333
+ <p><a class="source-toggle" href="#"
334
+ onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
335
+ <div class="method-source-code" id="M000076-source">
336
+ <pre>
337
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 55</span>
338
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_xml</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">p</span>={})
339
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
340
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">url</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
341
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
342
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
343
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span>)
344
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
345
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
346
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
347
+ <span class="ruby-keyword kw">begin</span>
348
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-regexp re">/&lt;.+&gt;/</span>).<span class="ruby-identifier">match</span>(<span class="ruby-identifier">resp</span>)
349
+ <span class="ruby-identifier">xmldoc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">resp</span>)
350
+ <span class="ruby-keyword kw">else</span>
351
+ <span class="ruby-identifier">err_node</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'err_node'</span>, <span class="ruby-identifier">xmldoc</span>)
352
+ <span class="ruby-identifier">err_node</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>
353
+ <span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">err_node</span>
354
+ <span class="ruby-keyword kw">end</span>
355
+ <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
356
+ <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;Error parsing XML &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
357
+ <span class="ruby-keyword kw">ensure</span>
358
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">xmldoc</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
359
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">xmldoc</span>
360
+ <span class="ruby-keyword kw">end</span>
361
+ <span class="ruby-keyword kw">end</span>
362
+ </pre>
363
+ </div>
364
+ </div>
365
+ </div>
366
+
367
+ <div id="method-M000077" class="method-detail">
368
+ <a name="M000077"></a>
369
+
370
+ <div class="method-heading">
371
+ <a href="#M000077" class="method-signature">
372
+ <span class="method-name">post</span><span class="method-args">(e, body=&quot;&quot;, p = {})</span>
373
+ </a>
374
+ </div>
375
+
376
+ <div class="method-description">
377
+ <p>
378
+ basic <a href="HttpHelper.html#M000077">post</a> call
379
+ </p>
380
+ <pre>
381
+ * e = the url suffix
382
+ * body = the data to post
383
+ * p = hash of parameters, such as headers
384
+ </pre>
385
+ <p><a class="source-toggle" href="#"
386
+ onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
387
+ <div class="method-source-code" id="M000077-source">
388
+ <pre>
389
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 84</span>
390
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">body</span>=<span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">p</span> = {})
391
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
392
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;#{url} #{body}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
393
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
394
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
395
+ <span class="ruby-identifier">msg</span>(<span class="ruby-node">&quot;using cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
396
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">params</span>)
397
+ <span class="ruby-comment cmt"># msg resp.headers</span>
398
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
399
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
400
+ <span class="ruby-keyword kw">begin</span>
401
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
402
+ <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
403
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
404
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
405
+ <span class="ruby-keyword kw">end</span>
406
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
407
+ <span class="ruby-comment cmt"># do nothing</span>
408
+ <span class="ruby-keyword kw">end</span>
409
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
410
+ <span class="ruby-keyword kw">end</span>
411
+ </pre>
412
+ </div>
413
+ </div>
414
+ </div>
415
+
416
+ <div id="method-M000080" class="method-detail">
417
+ <a name="M000080"></a>
418
+
419
+ <div class="method-heading">
420
+ <a href="#M000080" class="method-signature">
421
+ <span class="method-name">post_form</span><span class="method-args">(e, filepath, filename, p = {})</span>
422
+ </a>
423
+ </div>
424
+
425
+ <div class="method-description">
426
+ <p>
427
+ <a href="HttpHelper.html#M000077">post</a> call for uploading form data
428
+ </p>
429
+ <ul>
430
+ <li>e = the url suffix
431
+
432
+ </li>
433
+ <li>filepath = the file to <a href="HttpHelper.html#M000077">post</a>
434
+
435
+ </li>
436
+ <li>filename - the name to use for saving the file on the <a
437
+ href="../Mu.html">Mu</a>
438
+
439
+ </li>
440
+ <li>p = hash of parameters, such as headers
441
+
442
+ </li>
443
+ </ul>
444
+ <p><a class="source-toggle" href="#"
445
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
446
+ <div class="method-source-code" id="M000080-source">
447
+ <pre>
448
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 171</span>
449
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_form</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">filepath</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">p</span> = {})
450
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
451
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
452
+ <span class="ruby-identifier">params</span> = { <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;multipart/form-data&quot;</span>, <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">filepath</span>), <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">filename</span> }
453
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span>)
454
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
455
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
456
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
457
+ <span class="ruby-keyword kw">end</span>
458
+ </pre>
459
+ </div>
460
+ </div>
461
+ </div>
462
+
463
+ <div id="method-M000078" class="method-detail">
464
+ <a name="M000078"></a>
465
+
466
+ <div class="method-heading">
467
+ <a href="#M000078" class="method-signature">
468
+ <span class="method-name">post_json</span><span class="method-args">(e, json, p = {})</span>
469
+ </a>
470
+ </div>
471
+
472
+ <div class="method-description">
473
+ <p>
474
+ <a href="HttpHelper.html#M000077">post</a> call for uploading json
475
+ </p>
476
+ <ul>
477
+ <li>e = the url suffix
478
+
479
+ </li>
480
+ <li>body = the json object to <a href="HttpHelper.html#M000077">post</a>
481
+
482
+ </li>
483
+ <li>p = hash of parameters, such as headers
484
+
485
+ </li>
486
+ </ul>
487
+ <p><a class="source-toggle" href="#"
488
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
489
+ <div class="method-source-code" id="M000078-source">
490
+ <pre>
491
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 110</span>
492
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_json</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">json</span>, <span class="ruby-identifier">p</span> = {})
493
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
494
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;#{url} #{json}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
495
+ <span class="ruby-identifier">params</span> = { <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/json&quot;</span> }.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
496
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
497
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">json</span>, <span class="ruby-identifier">params</span> )
498
+ <span class="ruby-keyword kw">begin</span>
499
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
500
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
501
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
502
+ <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
503
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
504
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
505
+ <span class="ruby-keyword kw">end</span>
506
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
507
+ <span class="ruby-comment cmt"># msg e, Logger::DEBUG</span>
508
+ <span class="ruby-keyword kw">end</span>
509
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
510
+ <span class="ruby-keyword kw">end</span>
511
+ </pre>
512
+ </div>
513
+ </div>
514
+ </div>
515
+
516
+ <div id="method-M000079" class="method-detail">
517
+ <a name="M000079"></a>
518
+
519
+ <div class="method-heading">
520
+ <a href="#M000079" class="method-signature">
521
+ <span class="method-name">post_xml</span><span class="method-args">(e, doc, p = {})</span>
522
+ </a>
523
+ </div>
524
+
525
+ <div class="method-description">
526
+ <p>
527
+ <a href="HttpHelper.html#M000077">post</a> call for uploading xml
528
+ </p>
529
+ <ul>
530
+ <li>e = the url suffix
531
+
532
+ </li>
533
+ <li>body = the xml object to <a href="HttpHelper.html#M000077">post</a>
534
+
535
+ </li>
536
+ <li>p = hash of parameters, such as headers
537
+
538
+ </li>
539
+ </ul>
540
+ <p><a class="source-toggle" href="#"
541
+ onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
542
+ <div class="method-source-code" id="M000079-source">
543
+ <pre>
544
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 134</span>
545
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_xml</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">doc</span>, <span class="ruby-identifier">p</span> = {})
546
+ <span class="ruby-keyword kw">begin</span>
547
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
548
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;post to #{url}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
549
+ <span class="ruby-identifier">params</span> = { <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/xml&quot;</span> }.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
550
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
551
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">params</span> )
552
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
553
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
554
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
555
+ <span class="ruby-comment cmt"># XML Document</span>
556
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-regexp re">/&lt;.+&gt;/</span>).<span class="ruby-identifier">match</span>(<span class="ruby-identifier">resp</span>)
557
+ <span class="ruby-identifier">xmldoc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">resp</span>)
558
+ <span class="ruby-keyword kw">else</span>
559
+ <span class="ruby-identifier">err_node</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'err_node'</span>, <span class="ruby-identifier">xmldoc</span>)
560
+ <span class="ruby-identifier">err_node</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>
561
+ <span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">err_node</span>
562
+ <span class="ruby-keyword kw">end</span>
563
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SocketError</span>
564
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Host &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@host</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; nicht erreichbar&quot;</span>
565
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
566
+ <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;error parsing XML &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
567
+ <span class="ruby-keyword kw">end</span>
568
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//err_node&quot;</span>).<span class="ruby-identifier">empty?</span>)
569
+ <span class="ruby-ivar">@posted_uuid</span> = <span class="ruby-keyword kw">nil</span>
570
+ <span class="ruby-keyword kw">end</span>
571
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">nil?</span>
572
+ <span class="ruby-ivar">@posted_uuid</span> = <span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//uuid&quot;</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">text</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//uuid&quot;</span>).<span class="ruby-identifier">empty?</span>
573
+ <span class="ruby-keyword kw">end</span>
574
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">xmldoc</span>
575
+ <span class="ruby-keyword kw">end</span>
576
+ </pre>
577
+ </div>
578
+ </div>
579
+ </div>
580
+
581
+ <div id="method-M000082" class="method-detail">
582
+ <a name="M000082"></a>
583
+
584
+ <div class="method-heading">
585
+ <a href="#M000082" class="method-signature">
586
+ <span class="method-name">put_json</span><span class="method-args">(e, json, p={})</span>
587
+ </a>
588
+ </div>
589
+
590
+ <div class="method-description">
591
+ <p>
592
+ put call for json
593
+ </p>
594
+ <pre>
595
+ * e = the url suffix
596
+ * body = the json object to put
597
+ * p = hash of parameters, such as headers
598
+ </pre>
599
+ <p><a class="source-toggle" href="#"
600
+ onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
601
+ <div class="method-source-code" id="M000082-source">
602
+ <pre>
603
+ <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 194</span>
604
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_json</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">json</span>, <span class="ruby-identifier">p</span>={})
605
+ <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
606
+ <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
607
+ <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cookies</span>] = <span class="ruby-identifier">$cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$cookie</span>.<span class="ruby-identifier">empty?</span>
608
+ <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">json</span>, { <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/json&quot;</span> } )
609
+ <span class="ruby-keyword kw">begin</span>
610
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">resp</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
611
+ <span class="ruby-identifier">$cookie</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
612
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;got cookie #{$cookie}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">empty?</span>
613
+ <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
614
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
615
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
616
+ <span class="ruby-keyword kw">end</span>
617
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
618
+ <span class="ruby-comment cmt"># msg e, Logger::DEBUG</span>
619
+ <span class="ruby-keyword kw">end</span>
620
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
621
+ <span class="ruby-keyword kw">end</span>
622
+ </pre>
623
+ </div>
624
+ </div>
625
+ </div>
626
+
627
+
628
+ </div>
629
+
630
+
631
+ </div>
632
+
633
+
634
+ <div id="validator-badges">
635
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
636
+ </div>
637
+
638
+ </body>
639
+ </html>