mu 5.7.8 → 5.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/lib/mu.rb +1 -1
  2. data/lib/mu/command.rb +18 -2
  3. data/lib/mu/command/cmd_musl.rb +165 -0
  4. data/lib/mu/command/cmd_runscale.rb +12 -8
  5. data/lib/mu/command/help.rb +1 -0
  6. data/lib/mu/har.rb +449 -0
  7. data/lib/mu/libxml.rb +21 -0
  8. data/lib/mu/maker.rb +288 -0
  9. data/lib/mu/xmlizable.rb +559 -0
  10. metadata +78 -267
  11. data/rdoc/Gemfile.html +0 -194
  12. data/rdoc/LICENSE_txt.html +0 -201
  13. data/rdoc/Mu.html +0 -478
  14. data/rdoc/Mu/Client.html +0 -461
  15. data/rdoc/Mu/Command.html +0 -338
  16. data/rdoc/Mu/Command/API.html +0 -844
  17. data/rdoc/Mu/Command/Cmd_appid.html +0 -1341
  18. data/rdoc/Mu/Command/Cmd_cli.html +0 -800
  19. data/rdoc/Mu/Command/Cmd_ddt.html +0 -1612
  20. data/rdoc/Mu/Command/Cmd_homepage.html +0 -762
  21. data/rdoc/Mu/Command/Cmd_muapi.html +0 -1363
  22. data/rdoc/Mu/Command/Cmd_netconfig.html +0 -1077
  23. data/rdoc/Mu/Command/Cmd_runscale.html +0 -1441
  24. data/rdoc/Mu/Command/Cmd_runscenario.html +0 -787
  25. data/rdoc/Mu/Command/Cmd_runverify.html +0 -893
  26. data/rdoc/Mu/Command/Cmd_scale.html +0 -1323
  27. data/rdoc/Mu/Command/Cmd_system.html +0 -677
  28. data/rdoc/Mu/Command/Curl.html +0 -751
  29. data/rdoc/Mu/Command/Help.html +0 -305
  30. data/rdoc/Mu/Curl.html +0 -243
  31. data/rdoc/Mu/Curl/Error.html +0 -304
  32. data/rdoc/Mu/Curl/Error/Authorize.html +0 -355
  33. data/rdoc/Mu/Curl/Error/Connect.html +0 -286
  34. data/rdoc/Mu/Curl/Error/DNS.html +0 -236
  35. data/rdoc/Mu/Curl/Error/Region.html +0 -307
  36. data/rdoc/Mu/Curl/Error/Status.html +0 -286
  37. data/rdoc/Mu/Curl/Error/Timeout.html +0 -286
  38. data/rdoc/Mu/Curl/Verify.html +0 -472
  39. data/rdoc/Mu/Curl/Verify/Request.html +0 -424
  40. data/rdoc/Mu/Curl/Verify/Response.html +0 -372
  41. data/rdoc/Mu/Curl/Verify/Result.html +0 -373
  42. data/rdoc/Mu/Ddt.html +0 -1347
  43. data/rdoc/Mu/Helper.html +0 -517
  44. data/rdoc/Mu/Homepage.html +0 -719
  45. data/rdoc/Mu/HttpHelper.html +0 -890
  46. data/rdoc/Mu/Muapi.html +0 -1226
  47. data/rdoc/Mu/Netconfig.html +0 -1178
  48. data/rdoc/Mu/Scale.html +0 -1359
  49. data/rdoc/Mu/System.html +0 -504
  50. data/rdoc/Object.html +0 -285
  51. data/rdoc/README_rdoc.html +0 -892
  52. data/rdoc/Rakefile.html +0 -257
  53. data/rdoc/TCTestMu.html +0 -2583
  54. data/rdoc/Test.html +0 -235
  55. data/rdoc/Test/Unit.html +0 -235
  56. data/rdoc/Test/Unit/TestCase.html +0 -236
  57. data/rdoc/Test/helper_rb.html +0 -62
  58. data/rdoc/Test/tc_test_mu_rb.html +0 -60
  59. data/rdoc/VERSION.html +0 -179
  60. data/rdoc/bin/mu.html +0 -54
  61. data/rdoc/classes/Mu.html +0 -132
  62. data/rdoc/classes/Mu/Client.html +0 -214
  63. data/rdoc/classes/Mu/Command.html +0 -129
  64. data/rdoc/classes/Mu/Command/API.html +0 -362
  65. data/rdoc/classes/Mu/Command/Cmd_appid.html +0 -238
  66. data/rdoc/classes/Mu/Command/Cmd_cli.html +0 -273
  67. data/rdoc/classes/Mu/Command/Cmd_ddt.html +0 -639
  68. data/rdoc/classes/Mu/Command/Cmd_homepage.html +0 -276
  69. data/rdoc/classes/Mu/Command/Cmd_muapi.html +0 -527
  70. data/rdoc/classes/Mu/Command/Cmd_netconfig.html +0 -399
  71. data/rdoc/classes/Mu/Command/Cmd_runscale.html +0 -220
  72. data/rdoc/classes/Mu/Command/Cmd_runscenario.html +0 -197
  73. data/rdoc/classes/Mu/Command/Cmd_runverify.html +0 -196
  74. data/rdoc/classes/Mu/Command/Cmd_scale.html +0 -511
  75. data/rdoc/classes/Mu/Command/Cmd_system.html +0 -236
  76. data/rdoc/classes/Mu/Command/Curl.html +0 -182
  77. data/rdoc/classes/Mu/Command/Help.html +0 -137
  78. data/rdoc/classes/Mu/Curl.html +0 -116
  79. data/rdoc/classes/Mu/Curl/Error.html +0 -148
  80. data/rdoc/classes/Mu/Curl/Error/Authorize.html +0 -165
  81. data/rdoc/classes/Mu/Curl/Error/Connect.html +0 -139
  82. data/rdoc/classes/Mu/Curl/Error/DNS.html +0 -113
  83. data/rdoc/classes/Mu/Curl/Error/Region.html +0 -150
  84. data/rdoc/classes/Mu/Curl/Error/Status.html +0 -139
  85. data/rdoc/classes/Mu/Curl/Error/Timeout.html +0 -139
  86. data/rdoc/classes/Mu/Curl/Verify.html +0 -207
  87. data/rdoc/classes/Mu/Curl/Verify/Request.html +0 -187
  88. data/rdoc/classes/Mu/Curl/Verify/Response.html +0 -172
  89. data/rdoc/classes/Mu/Curl/Verify/Result.html +0 -172
  90. data/rdoc/classes/Mu/Ddt.html +0 -610
  91. data/rdoc/classes/Mu/Helper.html +0 -308
  92. data/rdoc/classes/Mu/Homepage.html +0 -306
  93. data/rdoc/classes/Mu/HttpHelper.html +0 -393
  94. data/rdoc/classes/Mu/Muapi.html +0 -549
  95. data/rdoc/classes/Mu/Netconfig.html +0 -478
  96. data/rdoc/classes/Mu/Scale.html +0 -580
  97. data/rdoc/classes/Mu/System.html +0 -232
  98. data/rdoc/classes/Object.html +0 -139
  99. data/rdoc/classes/TCTestMu.html +0 -948
  100. data/rdoc/classes/Test.html +0 -107
  101. data/rdoc/classes/Test/Unit.html +0 -107
  102. data/rdoc/classes/Test/Unit/TestCase.html +0 -113
  103. data/rdoc/created.rid +0 -36
  104. data/rdoc/files/lib/mu/api/ddt_rb.html +0 -101
  105. data/rdoc/files/lib/mu/api/homepage_rb.html +0 -101
  106. data/rdoc/files/lib/mu/api/muapi_rb.html +0 -101
  107. data/rdoc/files/lib/mu/api/netconfig_rb.html +0 -101
  108. data/rdoc/files/lib/mu/api/scale_rb.html +0 -101
  109. data/rdoc/files/lib/mu/api/system_rb.html +0 -101
  110. data/rdoc/files/lib/mu/client_rb.html +0 -101
  111. data/rdoc/files/lib/mu/command/api_rb.html +0 -101
  112. data/rdoc/files/lib/mu/command/cmd_appid_rb.html +0 -119
  113. data/rdoc/files/lib/mu/command/cmd_cli_rb.html +0 -108
  114. data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +0 -116
  115. data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +0 -115
  116. data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +0 -115
  117. data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +0 -116
  118. data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +0 -119
  119. data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +0 -115
  120. data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +0 -118
  121. data/rdoc/files/lib/mu/command/cmd_scale_rb.html +0 -115
  122. data/rdoc/files/lib/mu/command/cmd_system_rb.html +0 -116
  123. data/rdoc/files/lib/mu/command/curl_rb.html +0 -101
  124. data/rdoc/files/lib/mu/command/help_rb.html +0 -101
  125. data/rdoc/files/lib/mu/command_rb.html +0 -107
  126. data/rdoc/files/lib/mu/curl/error_rb.html +0 -101
  127. data/rdoc/files/lib/mu/curl/verify_rb.html +0 -101
  128. data/rdoc/files/lib/mu/helper_rb.html +0 -101
  129. data/rdoc/files/lib/mu/http_helper_rb.html +0 -101
  130. data/rdoc/files/lib/mu_rb.html +0 -121
  131. data/rdoc/files/test/helper_rb.html +0 -112
  132. data/rdoc/files/test/tc_test_mu_rb.html +0 -111
  133. data/rdoc/fr_class_index.html +0 -34
  134. data/rdoc/fr_file_index.html +0 -31
  135. data/rdoc/fr_method_index.html +0 -112
  136. data/rdoc/images/brick.png +0 -0
  137. data/rdoc/images/brick_link.png +0 -0
  138. data/rdoc/images/bug.png +0 -0
  139. data/rdoc/images/bullet_black.png +0 -0
  140. data/rdoc/images/bullet_toggle_minus.png +0 -0
  141. data/rdoc/images/bullet_toggle_plus.png +0 -0
  142. data/rdoc/images/date.png +0 -0
  143. data/rdoc/images/find.png +0 -0
  144. data/rdoc/images/loadingAnimation.gif +0 -0
  145. data/rdoc/images/macFFBgHack.png +0 -0
  146. data/rdoc/images/package.png +0 -0
  147. data/rdoc/images/page_green.png +0 -0
  148. data/rdoc/images/page_white_text.png +0 -0
  149. data/rdoc/images/page_white_width.png +0 -0
  150. data/rdoc/images/plugin.png +0 -0
  151. data/rdoc/images/ruby.png +0 -0
  152. data/rdoc/images/tag_green.png +0 -0
  153. data/rdoc/images/wrench.png +0 -0
  154. data/rdoc/images/wrench_orange.png +0 -0
  155. data/rdoc/images/zoom.png +0 -0
  156. data/rdoc/index.html +0 -884
  157. data/rdoc/js/darkfish.js +0 -116
  158. data/rdoc/js/jquery.js +0 -32
  159. data/rdoc/js/quicksearch.js +0 -114
  160. data/rdoc/js/thickbox-compressed.js +0 -10
  161. data/rdoc/lib/mu/api/ddt_rb.html +0 -52
  162. data/rdoc/lib/mu/api/homepage_rb.html +0 -52
  163. data/rdoc/lib/mu/api/muapi_rb.html +0 -52
  164. data/rdoc/lib/mu/api/netconfig_rb.html +0 -52
  165. data/rdoc/lib/mu/api/scale_rb.html +0 -52
  166. data/rdoc/lib/mu/api/system_rb.html +0 -52
  167. data/rdoc/lib/mu/client_rb.html +0 -52
  168. data/rdoc/lib/mu/command/api_rb.html +0 -52
  169. data/rdoc/lib/mu/command/cmd_appid_rb.html +0 -62
  170. data/rdoc/lib/mu/command/cmd_cli_rb.html +0 -55
  171. data/rdoc/lib/mu/command/cmd_ddt_rb.html +0 -60
  172. data/rdoc/lib/mu/command/cmd_homepage_rb.html +0 -57
  173. data/rdoc/lib/mu/command/cmd_muapi_rb.html +0 -59
  174. data/rdoc/lib/mu/command/cmd_netconfig_rb.html +0 -58
  175. data/rdoc/lib/mu/command/cmd_runscale_rb.html +0 -62
  176. data/rdoc/lib/mu/command/cmd_runscenario_rb.html +0 -57
  177. data/rdoc/lib/mu/command/cmd_runverify_rb.html +0 -61
  178. data/rdoc/lib/mu/command/cmd_scale_rb.html +0 -58
  179. data/rdoc/lib/mu/command/cmd_system_rb.html +0 -59
  180. data/rdoc/lib/mu/command/curl_rb.html +0 -52
  181. data/rdoc/lib/mu/command/help_rb.html +0 -52
  182. data/rdoc/lib/mu/command_rb.html +0 -55
  183. data/rdoc/lib/mu/curl/error_rb.html +0 -52
  184. data/rdoc/lib/mu/curl/verify_rb.html +0 -52
  185. data/rdoc/lib/mu/helper_rb.html +0 -52
  186. data/rdoc/lib/mu/http_helper_rb.html +0 -52
  187. data/rdoc/lib/mu_rb.html +0 -80
  188. data/rdoc/rdoc-style.css +0 -208
  189. data/rdoc/rdoc.css +0 -706
  190. data/test/data/app_id_stats.csv +0 -1
  191. data/test/data/app_id_status.json +0 -156
  192. data/test/data/data_cgi.msl +0 -94
  193. data/test/data/data_cgi.xml +0 -322
  194. data/test/data/default_test.csv +0 -3
  195. data/test/data/ftp_with_channel.xml +0 -1643
  196. data/test/data/irc.xml +0 -3837
  197. data/test/data/scale.json +0 -25
  198. data/test/data/test_data_cgi_error.xml +0 -35
@@ -1,890 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: Mu::HttpHelper</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/mu/http_helper_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/mu/http_helper.rb">lib/mu/http_helper.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link"><a href="../Object.html">Object</a></p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-new">::new</a></li>
73
-
74
- <li><a href="#method-i-delete">#delete</a></li>
75
-
76
- <li><a href="#method-i-download_file">#download_file</a></li>
77
-
78
- <li><a href="#method-i-get">#get</a></li>
79
-
80
- <li><a href="#method-i-get_json">#get_json</a></li>
81
-
82
- <li><a href="#method-i-get_xml">#get_xml</a></li>
83
-
84
- <li><a href="#method-i-post">#post</a></li>
85
-
86
- <li><a href="#method-i-post_form">#post_form</a></li>
87
-
88
- <li><a href="#method-i-post_json">#post_json</a></li>
89
-
90
- <li><a href="#method-i-post_xml">#post_xml</a></li>
91
-
92
- <li><a href="#method-i-put_json">#put_json</a></li>
93
-
94
- </ul>
95
- </div>
96
-
97
-
98
- <!-- Included Modules -->
99
-
100
- <div id="includes-section" class="section">
101
- <h3 class="section-header">Included Modules</h3>
102
- <ul class="link-list">
103
-
104
-
105
- <li><span class="include">Helper</span></li>
106
-
107
-
108
- </ul>
109
- </div>
110
-
111
- </div>
112
-
113
- <div id="project-metadata">
114
-
115
-
116
- <div id="fileindex-section" class="section project-section">
117
- <h3 class="section-header">Files</h3>
118
- <ul>
119
-
120
- <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
121
-
122
- <li class="file"><a href="../LICENSE_txt.html">LICENSE.txt</a></li>
123
-
124
- <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
125
-
126
- <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
127
-
128
- <li class="file"><a href="../VERSION.html">VERSION</a></li>
129
-
130
- </ul>
131
- </div>
132
-
133
-
134
- <div id="classindex-section" class="section project-section">
135
- <h3 class="section-header">Class Index
136
- <span class="search-toggle"><img src="../images/find.png"
137
- height="16" width="16" alt="[+]"
138
- title="show/hide quicksearch" /></span></h3>
139
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
140
- <fieldset>
141
- <legend>Quicksearch</legend>
142
- <input type="text" name="quicksearch" value=""
143
- class="quicksearch-field" />
144
- </fieldset>
145
- </form>
146
-
147
- <ul class="link-list">
148
-
149
- <li><a href="../Mu.html">Mu</a></li>
150
-
151
- <li><a href="../Mu/Client.html">Mu::Client</a></li>
152
-
153
- <li><a href="../Mu/Command.html">Mu::Command</a></li>
154
-
155
- <li><a href="../Mu/Command/API.html">Mu::Command::API</a></li>
156
-
157
- <li><a href="../Mu/Command/API.html">Mu::Command::API</a></li>
158
-
159
- <li><a href="../Mu/Command/Cmd_appid.html">Mu::Command::Cmd_appid</a></li>
160
-
161
- <li><a href="../Mu/Command/Cmd_cli.html">Mu::Command::Cmd_cli</a></li>
162
-
163
- <li><a href="../Mu/Command/Cmd_ddt.html">Mu::Command::Cmd_ddt</a></li>
164
-
165
- <li><a href="../Mu/Command/Cmd_homepage.html">Mu::Command::Cmd_homepage</a></li>
166
-
167
- <li><a href="../Mu/Command/Cmd_muapi.html">Mu::Command::Cmd_muapi</a></li>
168
-
169
- <li><a href="../Mu/Command/Cmd_netconfig.html">Mu::Command::Cmd_netconfig</a></li>
170
-
171
- <li><a href="../Mu/Command/Cmd_runscale.html">Mu::Command::Cmd_runscale</a></li>
172
-
173
- <li><a href="../Mu/Command/Cmd_runscenario.html">Mu::Command::Cmd_runscenario</a></li>
174
-
175
- <li><a href="../Mu/Command/Cmd_runverify.html">Mu::Command::Cmd_runverify</a></li>
176
-
177
- <li><a href="../Mu/Command/Cmd_scale.html">Mu::Command::Cmd_scale</a></li>
178
-
179
- <li><a href="../Mu/Command/Cmd_system.html">Mu::Command::Cmd_system</a></li>
180
-
181
- <li><a href="../Mu/Command/Curl.html">Mu::Command::Curl</a></li>
182
-
183
- <li><a href="../Mu/Command/Help.html">Mu::Command::Help</a></li>
184
-
185
- <li><a href="../Mu/Curl.html">Mu::Curl</a></li>
186
-
187
- <li><a href="../Mu/Curl/Error.html">Mu::Curl::Error</a></li>
188
-
189
- <li><a href="../Mu/Curl/Error/Authorize.html">Mu::Curl::Error::Authorize</a></li>
190
-
191
- <li><a href="../Mu/Curl/Error/Connect.html">Mu::Curl::Error::Connect</a></li>
192
-
193
- <li><a href="../Mu/Curl/Error/DNS.html">Mu::Curl::Error::DNS</a></li>
194
-
195
- <li><a href="../Mu/Curl/Error/Region.html">Mu::Curl::Error::Region</a></li>
196
-
197
- <li><a href="../Mu/Curl/Error/Status.html">Mu::Curl::Error::Status</a></li>
198
-
199
- <li><a href="../Mu/Curl/Error/Timeout.html">Mu::Curl::Error::Timeout</a></li>
200
-
201
- <li><a href="../Mu/Curl/Verify.html">Mu::Curl::Verify</a></li>
202
-
203
- <li><a href="../Mu/Curl/Verify/Request.html">Mu::Curl::Verify::Request</a></li>
204
-
205
- <li><a href="../Mu/Curl/Verify/Response.html">Mu::Curl::Verify::Response</a></li>
206
-
207
- <li><a href="../Mu/Curl/Verify/Result.html">Mu::Curl::Verify::Result</a></li>
208
-
209
- <li><a href="../Mu/Ddt.html">Mu::Ddt</a></li>
210
-
211
- <li><a href="../Mu/Helper.html">Mu::Helper</a></li>
212
-
213
- <li><a href="../Mu/Homepage.html">Mu::Homepage</a></li>
214
-
215
- <li><a href="../Mu/HttpHelper.html">Mu::HttpHelper</a></li>
216
-
217
- <li><a href="../Mu/Muapi.html">Mu::Muapi</a></li>
218
-
219
- <li><a href="../Mu/Netconfig.html">Mu::Netconfig</a></li>
220
-
221
- <li><a href="../Mu/Scale.html">Mu::Scale</a></li>
222
-
223
- <li><a href="../Mu/System.html">Mu::System</a></li>
224
-
225
- <li><a href="../Test.html">Test</a></li>
226
-
227
- <li><a href="../Test/Unit.html">Test::Unit</a></li>
228
-
229
- <li><a href="../Test/Unit/TestCase.html">Test::Unit::TestCase</a></li>
230
-
231
- <li><a href="../Object.html">Object</a></li>
232
-
233
- <li><a href="../TCTestMu.html">TCTestMu</a></li>
234
-
235
- </ul>
236
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
237
- </div>
238
-
239
-
240
- </div>
241
- </div>
242
-
243
- <div id="documentation">
244
- <h1 class="class">Mu::HttpHelper</h1>
245
-
246
- <div id="description">
247
-
248
- </div>
249
-
250
- <!-- Constants -->
251
-
252
-
253
- <!-- Attributes -->
254
-
255
-
256
- <!-- Methods -->
257
-
258
- <div id="public-class-method-details" class="method-section section">
259
- <h3 class="section-header">Public Class Methods</h3>
260
-
261
-
262
- <div id="new-method" class="method-detail ">
263
- <a name="method-c-new"></a>
264
-
265
- <div class="method-heading">
266
-
267
- <span class="method-name">new</span><span
268
- class="method-args">(host, username, password, docroot)</span>
269
- <span class="method-click-advice">click to toggle source</span>
270
-
271
- </div>
272
-
273
- <div class="method-description">
274
-
275
-
276
-
277
-
278
-
279
- <div class="method-source-code"
280
- id="new-source">
281
- <pre>
282
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 5</span>
283
- 5: <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>)
284
- 6: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
285
- 7: <span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
286
- 8: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
287
- 9: <span class="ruby-ivar">@docroot</span> = <span class="ruby-identifier">docroot</span>
288
- 10: <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>
289
- 11: <span class="ruby-keyword kw">end</span></pre>
290
- </div>
291
-
292
- </div>
293
-
294
-
295
-
296
-
297
- </div>
298
-
299
-
300
- </div>
301
-
302
- <div id="public-instance-method-details" class="method-section section">
303
- <h3 class="section-header">Public Instance Methods</h3>
304
-
305
-
306
- <div id="delete-method" class="method-detail ">
307
- <a name="method-i-delete"></a>
308
-
309
- <div class="method-heading">
310
-
311
- <span class="method-name">delete</span><span
312
- class="method-args">(e)</span>
313
- <span class="method-click-advice">click to toggle source</span>
314
-
315
- </div>
316
-
317
- <div class="method-description">
318
-
319
- <p>
320
- basic delete call
321
- </p>
322
- <pre>
323
- * e = the url suffix</pre>
324
-
325
-
326
-
327
- <div class="method-source-code"
328
- id="delete-source">
329
- <pre>
330
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 184</span>
331
- 184: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">e</span>)
332
- 185: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
333
- 186: <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>)
334
- 187: <span class="ruby-keyword kw">end</span></pre>
335
- </div>
336
-
337
- </div>
338
-
339
-
340
-
341
-
342
- </div>
343
-
344
-
345
- <div id="download-file-method" class="method-detail ">
346
- <a name="method-i-download_file"></a>
347
-
348
- <div class="method-heading">
349
-
350
- <span class="method-name">download_file</span><span
351
- class="method-args">(e, filename, p={})</span>
352
- <span class="method-click-advice">click to toggle source</span>
353
-
354
- </div>
355
-
356
- <div class="method-description">
357
-
358
- <p>
359
- fetches a file and stores it locally
360
- </p>
361
- <pre>
362
- * e = the url suffix
363
- * filename = the name to store the file locally
364
- * p = hash of parameters, such as headers</pre>
365
-
366
-
367
-
368
- <div class="method-source-code"
369
- id="download-file-source">
370
- <pre>
371
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 216</span>
372
- 216: <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>={})
373
- 217: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
374
- 218: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
375
- 219: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
376
- 220: <span class="ruby-identifier">resp</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>)
377
- 221: <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>
378
- 222: <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>
379
- 223: <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>)
380
- 224: <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;==&gt; Could not download the file&quot;</span>
381
- 225: <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
382
- 226: <span class="ruby-keyword kw">end</span>
383
- 227: <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>) }
384
- 228: <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>)
385
- 229: <span class="ruby-keyword kw">end</span></pre>
386
- </div>
387
-
388
- </div>
389
-
390
-
391
-
392
-
393
- </div>
394
-
395
-
396
- <div id="get-method" class="method-detail ">
397
- <a name="method-i-get"></a>
398
-
399
- <div class="method-heading">
400
-
401
- <span class="method-name">get</span><span
402
- class="method-args">(e, p={})</span>
403
- <span class="method-click-advice">click to toggle source</span>
404
-
405
- </div>
406
-
407
- <div class="method-description">
408
-
409
- <p>
410
- basic get call
411
- </p>
412
- <pre>
413
- * e = the url suffix
414
- * p = hash of parameters, such as headers</pre>
415
-
416
-
417
-
418
- <div class="method-source-code"
419
- id="get-source">
420
- <pre>
421
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 18</span>
422
- 18: <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>={})
423
- 19: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
424
- 20: <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>
425
- 21: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
426
- 22: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
427
- 23: <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>)
428
- 24: <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>
429
- 25: <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>
430
- 26: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
431
- 27: <span class="ruby-keyword kw">end</span></pre>
432
- </div>
433
-
434
- </div>
435
-
436
-
437
-
438
-
439
- </div>
440
-
441
-
442
- <div id="get-json-method" class="method-detail ">
443
- <a name="method-i-get_json"></a>
444
-
445
- <div class="method-heading">
446
-
447
- <span class="method-name">get_json</span><span
448
- class="method-args">(e, p={})</span>
449
- <span class="method-click-advice">click to toggle source</span>
450
-
451
- </div>
452
-
453
- <div class="method-description">
454
-
455
- <p>
456
- get call for json, converts the response to json if applicable
457
- </p>
458
- <pre>
459
- * e = the url suffix
460
- * p = hash of parameters, such as headers</pre>
461
-
462
-
463
-
464
- <div class="method-source-code"
465
- id="get-json-source">
466
- <pre>
467
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 32</span>
468
- 32: <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>={})
469
- 33: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
470
- 34: <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>
471
- 35: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
472
- 36: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
473
- 37: <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>)
474
- 38: <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>
475
- 39: <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>
476
- 40: <span class="ruby-keyword kw">begin</span>
477
- 41: <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>
478
- 42: <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
479
- 43: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
480
- 44: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
481
- 45: <span class="ruby-keyword kw">end</span>
482
- 46: <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>
483
- 47: <span class="ruby-comment cmt"># nothing to do</span>
484
- 48: <span class="ruby-keyword kw">end</span>
485
- 49: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
486
- 50: <span class="ruby-keyword kw">end</span></pre>
487
- </div>
488
-
489
- </div>
490
-
491
-
492
-
493
-
494
- </div>
495
-
496
-
497
- <div id="get-xml-method" class="method-detail ">
498
- <a name="method-i-get_xml"></a>
499
-
500
- <div class="method-heading">
501
-
502
- <span class="method-name">get_xml</span><span
503
- class="method-args">(e, p={})</span>
504
- <span class="method-click-advice">click to toggle source</span>
505
-
506
- </div>
507
-
508
- <div class="method-description">
509
-
510
- <p>
511
- get call for xml, converts the response to xml if applicable
512
- </p>
513
- <pre>
514
- * e = the url suffix
515
- * p = hash of parameters, such as headers</pre>
516
-
517
-
518
-
519
- <div class="method-source-code"
520
- id="get-xml-source">
521
- <pre>
522
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 55</span>
523
- 55: <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>={})
524
- 56: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
525
- 57: <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>
526
- 58: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
527
- 59: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
528
- 60: <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>)
529
- 61: <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>
530
- 62: <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>
531
- 63: <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>
532
- 64: <span class="ruby-keyword kw">begin</span>
533
- 65: <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>)
534
- 66: <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>)
535
- 67: <span class="ruby-keyword kw">else</span>
536
- 68: <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>)
537
- 69: <span class="ruby-identifier">err_node</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>
538
- 70: <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>
539
- 71: <span class="ruby-keyword kw">end</span>
540
- 72: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
541
- 73: <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>
542
- 74: <span class="ruby-keyword kw">ensure</span>
543
- 75: <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>
544
- 76: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">xmldoc</span>
545
- 77: <span class="ruby-keyword kw">end</span>
546
- 78: <span class="ruby-keyword kw">end</span></pre>
547
- </div>
548
-
549
- </div>
550
-
551
-
552
-
553
-
554
- </div>
555
-
556
-
557
- <div id="post-method" class="method-detail ">
558
- <a name="method-i-post"></a>
559
-
560
- <div class="method-heading">
561
-
562
- <span class="method-name">post</span><span
563
- class="method-args">(e, body="", p = {})</span>
564
- <span class="method-click-advice">click to toggle source</span>
565
-
566
- </div>
567
-
568
- <div class="method-description">
569
-
570
- <p>
571
- basic post call
572
- </p>
573
- <pre>
574
- * e = the url suffix
575
- * body = the data to post
576
- * p = hash of parameters, such as headers</pre>
577
-
578
-
579
-
580
- <div class="method-source-code"
581
- id="post-source">
582
- <pre>
583
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 84</span>
584
- 84: <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> = {})
585
- 85: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
586
- 86: <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>
587
- 87: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
588
- 88: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
589
- 89: <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>
590
- 90: <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>)
591
- 91: <span class="ruby-comment cmt"># msg resp.headers</span>
592
- 92: <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>
593
- 93: <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>
594
- 94: <span class="ruby-keyword kw">begin</span>
595
- 95: <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>
596
- 96: <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
597
- 97: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
598
- 98: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
599
- 99: <span class="ruby-keyword kw">end</span>
600
- 100: <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>
601
- 101: <span class="ruby-comment cmt"># do nothing</span>
602
- 102: <span class="ruby-keyword kw">end</span>
603
- 103: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
604
- 104: <span class="ruby-keyword kw">end</span></pre>
605
- </div>
606
-
607
- </div>
608
-
609
-
610
-
611
-
612
- </div>
613
-
614
-
615
- <div id="post-form-method" class="method-detail ">
616
- <a name="method-i-post_form"></a>
617
-
618
- <div class="method-heading">
619
-
620
- <span class="method-name">post_form</span><span
621
- class="method-args">(e, filepath, p = {})</span>
622
- <span class="method-click-advice">click to toggle source</span>
623
-
624
- </div>
625
-
626
- <div class="method-description">
627
-
628
- <p>
629
- post call for uploading form data
630
- </p>
631
- <ul>
632
- <li><p>
633
- e = the url suffix
634
- </p>
635
- </li>
636
- <li><p>
637
- filepath = the file to post
638
- </p>
639
- </li>
640
- <li><p>
641
- p = hash of parameters, such as headers
642
- </p>
643
- </li>
644
- </ul>
645
-
646
-
647
-
648
- <div class="method-source-code"
649
- id="post-form-source">
650
- <pre>
651
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 170</span>
652
- 170: <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">p</span> = {})
653
- 171: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
654
- 172: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
655
- 173: <span class="ruby-identifier">params</span> = { <span class="ruby-value">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/x-www-form-urlencoded&quot;</span>, <span class="ruby-value">: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-value str">'rb'</span>) }
656
- 174: <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>)
657
- 175: <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>
658
- 176: <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>
659
- 177: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
660
- 178: <span class="ruby-keyword kw">end</span></pre>
661
- </div>
662
-
663
- </div>
664
-
665
-
666
-
667
-
668
- </div>
669
-
670
-
671
- <div id="post-json-method" class="method-detail ">
672
- <a name="method-i-post_json"></a>
673
-
674
- <div class="method-heading">
675
-
676
- <span class="method-name">post_json</span><span
677
- class="method-args">(e, json, p = {})</span>
678
- <span class="method-click-advice">click to toggle source</span>
679
-
680
- </div>
681
-
682
- <div class="method-description">
683
-
684
- <p>
685
- post call for uploading json
686
- </p>
687
- <ul>
688
- <li><p>
689
- e = the url suffix
690
- </p>
691
- </li>
692
- <li><p>
693
- body = the json object to post
694
- </p>
695
- </li>
696
- <li><p>
697
- p = hash of parameters, such as headers
698
- </p>
699
- </li>
700
- </ul>
701
-
702
-
703
-
704
- <div class="method-source-code"
705
- id="post-json-source">
706
- <pre>
707
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 110</span>
708
- 110: <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> = {})
709
- 111: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
710
- 112: <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>
711
- 113: <span class="ruby-identifier">params</span> = { <span class="ruby-value">: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>
712
- 114: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
713
- 115: <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> )
714
- 116: <span class="ruby-keyword kw">begin</span>
715
- 117: <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>
716
- 118: <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>
717
- 119: <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>
718
- 120: <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
719
- 121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
720
- 122: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
721
- 123: <span class="ruby-keyword kw">end</span>
722
- 124: <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>
723
- 125: <span class="ruby-comment cmt"># msg e, Logger::DEBUG</span>
724
- 126: <span class="ruby-keyword kw">end</span>
725
- 127: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
726
- 128: <span class="ruby-keyword kw">end</span></pre>
727
- </div>
728
-
729
- </div>
730
-
731
-
732
-
733
-
734
- </div>
735
-
736
-
737
- <div id="post-xml-method" class="method-detail ">
738
- <a name="method-i-post_xml"></a>
739
-
740
- <div class="method-heading">
741
-
742
- <span class="method-name">post_xml</span><span
743
- class="method-args">(e, doc, p = {})</span>
744
- <span class="method-click-advice">click to toggle source</span>
745
-
746
- </div>
747
-
748
- <div class="method-description">
749
-
750
- <p>
751
- post call for uploading xml
752
- </p>
753
- <ul>
754
- <li><p>
755
- e = the url suffix
756
- </p>
757
- </li>
758
- <li><p>
759
- body = the xml object to post
760
- </p>
761
- </li>
762
- <li><p>
763
- p = hash of parameters, such as headers
764
- </p>
765
- </li>
766
- </ul>
767
-
768
-
769
-
770
- <div class="method-source-code"
771
- id="post-xml-source">
772
- <pre>
773
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 134</span>
774
- 134: <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> = {})
775
- 135: <span class="ruby-keyword kw">begin</span>
776
- 136: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
777
- 137: <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>
778
- 138: <span class="ruby-identifier">params</span> = { <span class="ruby-value">: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>
779
- 139: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
780
- 140: <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> )
781
- 141: <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>
782
- 142: <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>
783
- 143: <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>
784
- 144: <span class="ruby-comment cmt"># XML Document</span>
785
- 145: <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>)
786
- 146: <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>)
787
- 147: <span class="ruby-keyword kw">else</span>
788
- 148: <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>)
789
- 149: <span class="ruby-identifier">err_node</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>
790
- 150: <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>
791
- 151: <span class="ruby-keyword kw">end</span>
792
- 152: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SocketError</span>
793
- 153: <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>
794
- 154: <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>
795
- 155: <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>
796
- 156: <span class="ruby-keyword kw">end</span>
797
- 157: <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>)
798
- 158: <span class="ruby-ivar">@posted_uuid</span> = <span class="ruby-keyword kw">nil</span>
799
- 159: <span class="ruby-keyword kw">end</span>
800
- 160: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">xmldoc</span>.<span class="ruby-identifier">nil?</span>
801
- 161: <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>
802
- 162: <span class="ruby-keyword kw">end</span>
803
- 163: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">xmldoc</span>
804
- 164: <span class="ruby-keyword kw">end</span></pre>
805
- </div>
806
-
807
- </div>
808
-
809
-
810
-
811
-
812
- </div>
813
-
814
-
815
- <div id="put-json-method" class="method-detail ">
816
- <a name="method-i-put_json"></a>
817
-
818
- <div class="method-heading">
819
-
820
- <span class="method-name">put_json</span><span
821
- class="method-args">(e, json, p={})</span>
822
- <span class="method-click-advice">click to toggle source</span>
823
-
824
- </div>
825
-
826
- <div class="method-description">
827
-
828
- <p>
829
- put call for json
830
- </p>
831
- <pre>
832
- * e = the url suffix
833
- * body = the json object to put
834
- * p = hash of parameters, such as headers</pre>
835
-
836
-
837
-
838
- <div class="method-source-code"
839
- id="put-json-source">
840
- <pre>
841
- <span class="ruby-comment cmt"># File lib/mu/http_helper.rb, line 193</span>
842
- 193: <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>={})
843
- 194: <span class="ruby-identifier">url</span> = <span class="ruby-node">&quot;https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}&quot;</span>
844
- 195: <span class="ruby-identifier">params</span> = {}.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">p</span>
845
- 196: <span class="ruby-identifier">params</span>[<span class="ruby-value">: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>
846
- 197: <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-value">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/json&quot;</span> } )
847
- 198: <span class="ruby-keyword kw">begin</span>
848
- 199: <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>
849
- 200: <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>
850
- 201: <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>
851
- 202: <span class="ruby-identifier">jresp</span> = <span class="ruby-constant">JSON</span> <span class="ruby-identifier">resp</span>
852
- 203: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jresp</span>
853
- 204: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">jresp</span>
854
- 205: <span class="ruby-keyword kw">end</span>
855
- 206: <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>
856
- 207: <span class="ruby-comment cmt"># msg e, Logger::DEBUG</span>
857
- 208: <span class="ruby-keyword kw">end</span>
858
- 209: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
859
- 210: <span class="ruby-keyword kw">end</span></pre>
860
- </div>
861
-
862
- </div>
863
-
864
-
865
-
866
-
867
- </div>
868
-
869
-
870
- </div>
871
-
872
-
873
- </div>
874
-
875
-
876
- <div id="rdoc-debugging-section-dump" class="debugging-section">
877
-
878
- <p>Disabled; run with --debug to generate this.</p>
879
-
880
- </div>
881
-
882
- <div id="validator-badges">
883
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
884
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
885
- Rdoc Generator</a> 1.1.6</small>.</p>
886
- </div>
887
-
888
- </body>
889
- </html>
890
-