rest_baby 0.8 → 1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/ChangeLog +12 -2
- data/Gemfile +2 -0
- data/Rakefile +7 -1
- data/doc/MockRestService.html +204 -31
- data/doc/RestBaby/Client.html +686 -246
- data/doc/RestBaby.html +6 -7
- data/doc/_index.html +6 -19
- data/doc/class_list.html +6 -2
- data/doc/css/style.css +2 -1
- data/doc/feature_list.html +82 -55
- data/doc/featuredirectories_list.html +25 -32
- data/doc/file.README.html +6 -6
- data/doc/file_list.html +5 -1
- data/doc/frames.html +5 -7
- data/doc/index.html +6 -6
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +41 -25
- data/doc/requirements/features/header_options.html +81 -45
- data/doc/requirements/features/print_response.html +42 -148
- data/doc/requirements/features/rest_client.html +38 -30
- data/doc/requirements/features/url_parameter.html +342 -0
- data/doc/requirements/features.html +42 -39
- data/doc/requirements/step_transformers.html +524 -321
- data/doc/requirements/tags/authentication.html +8 -8
- data/doc/requirements/tags/core.html +4 -4
- data/doc/requirements/tags/delete.html +4 -4
- data/doc/requirements/tags/extended.html +12 -12
- data/doc/requirements/tags/get.html +6 -6
- data/doc/requirements/tags/header.S1.html +160 -0
- data/doc/requirements/tags/header.S2.html +160 -0
- data/doc/requirements/tags/header.S3.html +160 -0
- data/doc/requirements/tags/header.S4.html +160 -0
- data/doc/requirements/tags/header.html +160 -0
- data/doc/requirements/tags/headers.html +7 -16
- data/doc/requirements/tags/parameter.S1.html +160 -0
- data/doc/requirements/tags/parameter.html +160 -0
- data/doc/requirements/tags/post.html +10 -10
- data/doc/requirements/tags/print.S1.html +160 -0
- data/doc/requirements/tags/print.S2.html +160 -0
- data/doc/requirements/tags/print.S3.html +160 -0
- data/doc/requirements/tags/print.S4.html +160 -0
- data/doc/requirements/tags/print.html +4 -4
- data/doc/requirements/tags/put.html +4 -4
- data/doc/requirements/tags/rest.S1.html +160 -0
- data/doc/requirements/tags/rest.S2.html +160 -0
- data/doc/requirements/tags/rest.S3.html +160 -0
- data/doc/requirements/tags/rest.S4.html +160 -0
- data/doc/requirements/tags.html +97 -57
- data/doc/requirements.html +43 -38
- data/doc/step_list.html +204 -189
- data/doc/stepdefinition_list.html +69 -35
- data/doc/tag_list.html +100 -6
- data/doc/top-level-namespace.html +79 -13
- data/features/step_definitions/rest_client_steps.rb +4 -4
- data/lib/rest_baby/version.rb +1 -1
- data/lib/rest_baby.rb +1 -1
- metadata +46 -31
- data/Gemfile.lock +0 -68
data/doc/RestBaby/Client.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: RestBaby::Client
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<script type="text/javascript" charset="utf-8">
|
20
20
|
hasFrames = window.top.frames.main ? true : false;
|
21
21
|
relpath = '../';
|
22
|
-
framesUrl = "../frames.html#!"
|
22
|
+
framesUrl = "../frames.html#!RestBaby/Client.html";
|
23
23
|
</script>
|
24
24
|
|
25
25
|
|
@@ -140,24 +140,62 @@
|
|
140
140
|
|
141
141
|
|
142
142
|
</div>
|
143
|
+
<h2>Constant Summary</h2>
|
144
|
+
|
145
|
+
<dl class="constants">
|
146
|
+
|
147
|
+
<dt id="PARAM_STARTER-constant" class="">PARAM_STARTER =
|
148
|
+
|
149
|
+
</dt>
|
150
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>?</span><span class='tstring_end'>'</span></span></pre></dd>
|
151
|
+
|
152
|
+
<dt id="PARAM_SEPARATOR-constant" class="">PARAM_SEPARATOR =
|
153
|
+
|
154
|
+
</dt>
|
155
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&</span><span class='tstring_end'>'</span></span></pre></dd>
|
156
|
+
|
157
|
+
</dl>
|
158
|
+
|
143
159
|
|
144
160
|
|
145
161
|
|
146
162
|
|
163
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
164
|
+
<ul class="summary">
|
165
|
+
|
166
|
+
<li class="public ">
|
167
|
+
<span class="summary_signature">
|
168
|
+
|
169
|
+
<a href="#code-instance_method" title="#code (instance method)">- (Object) <strong>code</strong> </a>
|
170
|
+
|
147
171
|
|
172
|
+
|
173
|
+
</span>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="note title readonly">readonly</span>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
148
186
|
|
149
187
|
|
150
|
-
<
|
151
|
-
|
152
|
-
|
153
|
-
|
188
|
+
<span class="summary_desc"><div class='inline'>
|
189
|
+
<p>Response Code.</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
154
193
|
|
155
|
-
|
156
|
-
|
157
|
-
<li class="public ">
|
194
|
+
|
195
|
+
<li class="public ">
|
158
196
|
<span class="summary_signature">
|
159
197
|
|
160
|
-
<a href="#
|
198
|
+
<a href="#password-instance_method" title="#password (instance method)">- (Object) <strong>password</strong> </a>
|
161
199
|
|
162
200
|
|
163
201
|
|
@@ -165,6 +203,11 @@
|
|
165
203
|
|
166
204
|
|
167
205
|
|
206
|
+
|
207
|
+
<span class="note title readonly">readonly</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
168
211
|
|
169
212
|
|
170
213
|
|
@@ -172,16 +215,16 @@
|
|
172
215
|
|
173
216
|
|
174
217
|
<span class="summary_desc"><div class='inline'>
|
175
|
-
<p>
|
218
|
+
<p>The password for the user (for authentication).</p>
|
176
219
|
</div></span>
|
177
220
|
|
178
221
|
</li>
|
179
222
|
|
180
|
-
|
181
|
-
|
223
|
+
|
224
|
+
<li class="public ">
|
182
225
|
<span class="summary_signature">
|
183
226
|
|
184
|
-
<a href="#
|
227
|
+
<a href="#user-instance_method" title="#user (instance method)">- (Object) <strong>user</strong> </a>
|
185
228
|
|
186
229
|
|
187
230
|
|
@@ -189,6 +232,11 @@
|
|
189
232
|
|
190
233
|
|
191
234
|
|
235
|
+
|
236
|
+
<span class="note title readonly">readonly</span>
|
237
|
+
|
238
|
+
|
239
|
+
|
192
240
|
|
193
241
|
|
194
242
|
|
@@ -196,16 +244,16 @@
|
|
196
244
|
|
197
245
|
|
198
246
|
<span class="summary_desc"><div class='inline'>
|
199
|
-
<p>
|
247
|
+
<p>The user (for authentication).</p>
|
200
248
|
</div></span>
|
201
249
|
|
202
250
|
</li>
|
203
251
|
|
204
|
-
|
205
|
-
|
252
|
+
|
253
|
+
<li class="public ">
|
206
254
|
<span class="summary_signature">
|
207
255
|
|
208
|
-
<a href="#
|
256
|
+
<a href="#wsresponse-instance_method" title="#wsresponse (instance method)">- (Object) <strong>wsresponse</strong> </a>
|
209
257
|
|
210
258
|
|
211
259
|
|
@@ -213,29 +261,47 @@
|
|
213
261
|
|
214
262
|
|
215
263
|
|
264
|
+
|
265
|
+
<span class="note title readonly">readonly</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
216
269
|
|
217
270
|
|
218
271
|
|
219
272
|
|
220
273
|
|
221
274
|
|
222
|
-
<span class="summary_desc"><div class='inline'
|
275
|
+
<span class="summary_desc"><div class='inline'>
|
276
|
+
<p>The WebService Response from the last call.</p>
|
277
|
+
</div></span>
|
223
278
|
|
224
279
|
</li>
|
225
280
|
|
281
|
+
|
282
|
+
</ul>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<h2>
|
289
|
+
Instance Method Summary
|
290
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
291
|
+
</h2>
|
292
|
+
|
293
|
+
<ul class="summary">
|
226
294
|
|
227
295
|
<li class="public ">
|
228
296
|
<span class="summary_signature">
|
229
297
|
|
230
|
-
<a href="#
|
298
|
+
<a href="#add_headers-instance_method" title="#add_headers (instance method)">- (Object) <strong>add_headers</strong>(headers) </a>
|
231
299
|
|
232
300
|
|
233
301
|
|
234
302
|
</span>
|
235
303
|
|
236
304
|
|
237
|
-
<span class="note title constructor">constructor</span>
|
238
|
-
|
239
305
|
|
240
306
|
|
241
307
|
|
@@ -244,7 +310,7 @@
|
|
244
310
|
|
245
311
|
|
246
312
|
<span class="summary_desc"><div class='inline'>
|
247
|
-
<p>
|
313
|
+
<p>Modifies the headers by merging new headers with current headers.</p>
|
248
314
|
</div></span>
|
249
315
|
|
250
316
|
</li>
|
@@ -253,7 +319,7 @@
|
|
253
319
|
<li class="public ">
|
254
320
|
<span class="summary_signature">
|
255
321
|
|
256
|
-
<a href="#
|
322
|
+
<a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong>(headers = {}, path = '', parameters = {}) </a>
|
257
323
|
|
258
324
|
|
259
325
|
|
@@ -268,7 +334,7 @@
|
|
268
334
|
|
269
335
|
|
270
336
|
<span class="summary_desc"><div class='inline'>
|
271
|
-
<p>Basic web services
|
337
|
+
<p>Basic web services Delete command.</p>
|
272
338
|
</div></span>
|
273
339
|
|
274
340
|
</li>
|
@@ -277,7 +343,7 @@
|
|
277
343
|
<li class="public ">
|
278
344
|
<span class="summary_signature">
|
279
345
|
|
280
|
-
<a href="#
|
346
|
+
<a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(headers = {}, path = '', parameters = {}) </a>
|
281
347
|
|
282
348
|
|
283
349
|
|
@@ -292,7 +358,7 @@
|
|
292
358
|
|
293
359
|
|
294
360
|
<span class="summary_desc"><div class='inline'>
|
295
|
-
<p>
|
361
|
+
<p>Basic web services Get command.</p>
|
296
362
|
</div></span>
|
297
363
|
|
298
364
|
</li>
|
@@ -301,13 +367,15 @@
|
|
301
367
|
<li class="public ">
|
302
368
|
<span class="summary_signature">
|
303
369
|
|
304
|
-
<a href="#
|
370
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Client) <strong>initialize</strong>(url, headers = {}, user = nil, password = nil) </a>
|
305
371
|
|
306
372
|
|
307
373
|
|
308
374
|
</span>
|
309
375
|
|
310
376
|
|
377
|
+
<span class="note title constructor">constructor</span>
|
378
|
+
|
311
379
|
|
312
380
|
|
313
381
|
|
@@ -316,7 +384,7 @@
|
|
316
384
|
|
317
385
|
|
318
386
|
<span class="summary_desc"><div class='inline'>
|
319
|
-
<p>
|
387
|
+
<p>Creates a new rest client.</p>
|
320
388
|
</div></span>
|
321
389
|
|
322
390
|
</li>
|
@@ -325,7 +393,7 @@
|
|
325
393
|
<li class="public ">
|
326
394
|
<span class="summary_signature">
|
327
395
|
|
328
|
-
<a href="#
|
396
|
+
<a href="#post-instance_method" title="#post (instance method)">- (Object) <strong>post</strong>(body = nil, headers = {}, path = '') </a>
|
329
397
|
|
330
398
|
|
331
399
|
|
@@ -340,7 +408,7 @@
|
|
340
408
|
|
341
409
|
|
342
410
|
<span class="summary_desc"><div class='inline'>
|
343
|
-
<p>
|
411
|
+
<p>Basic web services Post command.</p>
|
344
412
|
</div></span>
|
345
413
|
|
346
414
|
</li>
|
@@ -349,7 +417,7 @@
|
|
349
417
|
<li class="public ">
|
350
418
|
<span class="summary_signature">
|
351
419
|
|
352
|
-
<a href="#
|
420
|
+
<a href="#put-instance_method" title="#put (instance method)">- (Object) <strong>put</strong>(body = nil, headers = {}, path = '') </a>
|
353
421
|
|
354
422
|
|
355
423
|
|
@@ -364,7 +432,7 @@
|
|
364
432
|
|
365
433
|
|
366
434
|
<span class="summary_desc"><div class='inline'>
|
367
|
-
<p>
|
435
|
+
<p>Basic web services Put command.</p>
|
368
436
|
</div></span>
|
369
437
|
|
370
438
|
</li>
|
@@ -373,7 +441,7 @@
|
|
373
441
|
<li class="public ">
|
374
442
|
<span class="summary_signature">
|
375
443
|
|
376
|
-
<a href="#
|
444
|
+
<a href="#set_auth-instance_method" title="#set_auth (instance method)">- (Object) <strong>set_auth</strong>(user, password) </a>
|
377
445
|
|
378
446
|
|
379
447
|
|
@@ -388,7 +456,7 @@
|
|
388
456
|
|
389
457
|
|
390
458
|
<span class="summary_desc"><div class='inline'>
|
391
|
-
<p>
|
459
|
+
<p>Adds user/password to the rest client.</p>
|
392
460
|
</div></span>
|
393
461
|
|
394
462
|
</li>
|
@@ -403,7 +471,7 @@
|
|
403
471
|
<div class="method_details first">
|
404
472
|
<h3 class="signature first" id="initialize-instance_method">
|
405
473
|
|
406
|
-
- (<tt><span class='object_link'><a href="" title="RestBaby::Client (class)">Client</a></span></tt>) <strong>initialize</strong>(url, headers = {})
|
474
|
+
- (<tt><span class='object_link'><a href="" title="RestBaby::Client (class)">Client</a></span></tt>) <strong>initialize</strong>(url, headers = {}, user = nil, password = nil)
|
407
475
|
|
408
476
|
|
409
477
|
|
@@ -413,24 +481,55 @@
|
|
413
481
|
<div class="discussion">
|
414
482
|
|
415
483
|
<p>Creates a new rest client</p>
|
416
|
-
<ul><li>
|
417
|
-
<p><code>url</code> = url of the rest service</p>
|
418
|
-
</li></ul>
|
419
484
|
|
420
485
|
<p>eg. <a
|
421
|
-
href="http://myrestservice.com:80/time">myrestservice.com:80/time</a
|
422
|
-
|
423
|
-
|
424
|
-
</li></ul>
|
425
|
-
|
426
|
-
<p>eg. '{ "Content-Type" =>
|
427
|
-
"application/json"}' can be multiple headers</p>
|
486
|
+
href="http://myrestservice.com:80/time">myrestservice.com:80/time</a> eg.
|
487
|
+
'{ "Content-Type" => "application/json"}'
|
488
|
+
Can be multiple headers separated by commas inside the brackets.</p>
|
428
489
|
|
429
490
|
|
430
491
|
</div>
|
431
492
|
</div>
|
432
493
|
<div class="tags">
|
494
|
+
<p class="tag_title">Parameters:</p>
|
495
|
+
<ul class="param">
|
496
|
+
|
497
|
+
<li>
|
498
|
+
|
499
|
+
<span class='name'>url</span>
|
500
|
+
|
501
|
+
|
502
|
+
<span class='type'>(<tt>String</tt>)</span>
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
—
|
507
|
+
<div class='inline'>
|
508
|
+
<p>url of the rest service</p>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
</li>
|
512
|
+
|
513
|
+
<li>
|
514
|
+
|
515
|
+
<span class='name'>headers</span>
|
516
|
+
|
517
|
+
|
518
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
519
|
+
|
520
|
+
|
521
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
522
|
+
|
523
|
+
|
524
|
+
—
|
525
|
+
<div class='inline'>
|
526
|
+
<p>default headers to use.</p>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
</li>
|
433
530
|
|
531
|
+
</ul>
|
532
|
+
|
434
533
|
|
435
534
|
</div><table class="source_code">
|
436
535
|
<tr>
|
@@ -438,21 +537,23 @@ href="http://myrestservice.com:80/time">myrestservice.com:80/time</a></p>
|
|
438
537
|
<pre class="lines">
|
439
538
|
|
440
539
|
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
540
|
+
37
|
541
|
+
38
|
542
|
+
39
|
543
|
+
40
|
544
|
+
41
|
545
|
+
42
|
546
|
+
43</pre>
|
447
547
|
</td>
|
448
548
|
<td>
|
449
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
450
|
-
|
451
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
549
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 37</span>
|
550
|
+
|
551
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
552
|
+
<span class='ivar'>@url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span>
|
553
|
+
<span class='ivar'>@headers</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span>
|
554
|
+
<span class='ivar'>@user</span> <span class='op'>=</span> <span class='id identifier rubyid_user'>user</span>
|
555
|
+
<span class='ivar'>@password</span> <span class='op'>=</span> <span class='id identifier rubyid_password'>password</span>
|
556
|
+
<span class='ivar'>@verbose</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DEBUG_HTTP</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>false</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
456
557
|
<span class='kw'>end</span></pre>
|
457
558
|
</td>
|
458
559
|
</tr>
|
@@ -461,15 +562,15 @@ href="http://myrestservice.com:80/time">myrestservice.com:80/time</a></p>
|
|
461
562
|
|
462
563
|
</div>
|
463
564
|
|
464
|
-
|
465
|
-
|
466
|
-
<h2>Instance Method Details</h2>
|
467
|
-
|
565
|
+
<div id="instance_attr_details" class="attr_details">
|
566
|
+
<h2>Instance Attribute Details</h2>
|
468
567
|
|
568
|
+
|
569
|
+
<span id=""></span>
|
469
570
|
<div class="method_details first">
|
470
|
-
<h3 class="signature first" id="
|
571
|
+
<h3 class="signature first" id="code-instance_method">
|
471
572
|
|
472
|
-
- (<tt>Object</tt>) <strong>
|
573
|
+
- (<tt>Object</tt>) <strong>code</strong> <span class="extras">(readonly)</span>
|
473
574
|
|
474
575
|
|
475
576
|
|
@@ -478,15 +579,7 @@ href="http://myrestservice.com:80/time">myrestservice.com:80/time</a></p>
|
|
478
579
|
</h3><div class="docstring">
|
479
580
|
<div class="discussion">
|
480
581
|
|
481
|
-
<p>
|
482
|
-
<ul><li>
|
483
|
-
<p><code>url</code> = url to send the command to</p>
|
484
|
-
</li><li>
|
485
|
-
<p><code>headers</code> = header parameters including authorization and
|
486
|
-
Content-Type</p>
|
487
|
-
</li></ul>
|
488
|
-
|
489
|
-
<p>The response from the rest server is returned</p>
|
582
|
+
<p>Response Code</p>
|
490
583
|
|
491
584
|
|
492
585
|
</div>
|
@@ -500,25 +593,27 @@ Content-Type</p>
|
|
500
593
|
<pre class="lines">
|
501
594
|
|
502
595
|
|
503
|
-
|
504
|
-
|
505
|
-
|
596
|
+
28
|
597
|
+
29
|
598
|
+
30</pre>
|
506
599
|
</td>
|
507
600
|
<td>
|
508
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
601
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 28</span>
|
509
602
|
|
510
|
-
<span class='kw'>def</span> <span class='id identifier
|
511
|
-
|
603
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_code'>code</span>
|
604
|
+
<span class='ivar'>@code</span>
|
512
605
|
<span class='kw'>end</span></pre>
|
513
606
|
</td>
|
514
607
|
</tr>
|
515
608
|
</table>
|
516
609
|
</div>
|
517
610
|
|
611
|
+
|
612
|
+
<span id=""></span>
|
518
613
|
<div class="method_details ">
|
519
|
-
<h3 class="signature " id="
|
614
|
+
<h3 class="signature " id="password-instance_method">
|
520
615
|
|
521
|
-
- (<tt>Object</tt>) <strong>
|
616
|
+
- (<tt>Object</tt>) <strong>password</strong> <span class="extras">(readonly)</span>
|
522
617
|
|
523
618
|
|
524
619
|
|
@@ -527,15 +622,7 @@ Content-Type</p>
|
|
527
622
|
</h3><div class="docstring">
|
528
623
|
<div class="discussion">
|
529
624
|
|
530
|
-
<p>
|
531
|
-
<ul><li>
|
532
|
-
<p><code>url</code> = url to send the command to</p>
|
533
|
-
</li><li>
|
534
|
-
<p><code>headers</code> = header parameters including authorization and
|
535
|
-
Content-Type</p>
|
536
|
-
</li></ul>
|
537
|
-
|
538
|
-
<p>The response from the rest server is returned</p>
|
625
|
+
<p>The password for the user (for authentication)</p>
|
539
626
|
|
540
627
|
|
541
628
|
</div>
|
@@ -549,55 +636,70 @@ Content-Type</p>
|
|
549
636
|
<pre class="lines">
|
550
637
|
|
551
638
|
|
552
|
-
|
553
|
-
|
554
|
-
|
639
|
+
26
|
640
|
+
27
|
641
|
+
28</pre>
|
555
642
|
</td>
|
556
643
|
<td>
|
557
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
644
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 26</span>
|
558
645
|
|
559
|
-
<span class='kw'>def</span> <span class='id identifier
|
560
|
-
|
646
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_password'>password</span>
|
647
|
+
<span class='ivar'>@password</span>
|
561
648
|
<span class='kw'>end</span></pre>
|
562
649
|
</td>
|
563
650
|
</tr>
|
564
651
|
</table>
|
565
652
|
</div>
|
566
653
|
|
654
|
+
|
655
|
+
<span id=""></span>
|
567
656
|
<div class="method_details ">
|
568
|
-
<h3 class="signature " id="
|
657
|
+
<h3 class="signature " id="user-instance_method">
|
569
658
|
|
570
|
-
- (<tt>Object</tt>) <strong>
|
659
|
+
- (<tt>Object</tt>) <strong>user</strong> <span class="extras">(readonly)</span>
|
571
660
|
|
572
661
|
|
573
662
|
|
574
663
|
|
575
664
|
|
576
|
-
</h3><
|
665
|
+
</h3><div class="docstring">
|
666
|
+
<div class="discussion">
|
667
|
+
|
668
|
+
<p>The user (for authentication)</p>
|
669
|
+
|
670
|
+
|
671
|
+
</div>
|
672
|
+
</div>
|
673
|
+
<div class="tags">
|
674
|
+
|
675
|
+
|
676
|
+
</div><table class="source_code">
|
577
677
|
<tr>
|
578
678
|
<td>
|
579
679
|
<pre class="lines">
|
580
680
|
|
581
681
|
|
582
|
-
|
583
|
-
|
584
|
-
|
682
|
+
24
|
683
|
+
25
|
684
|
+
26</pre>
|
585
685
|
</td>
|
586
686
|
<td>
|
587
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
687
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 24</span>
|
588
688
|
|
589
|
-
<span class='kw'>def</span> <span class='id identifier
|
590
|
-
|
689
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_user'>user</span>
|
690
|
+
<span class='ivar'>@user</span>
|
591
691
|
<span class='kw'>end</span></pre>
|
592
692
|
</td>
|
593
693
|
</tr>
|
594
694
|
</table>
|
595
695
|
</div>
|
596
696
|
|
697
|
+
|
698
|
+
<span id=""></span>
|
597
699
|
<div class="method_details ">
|
598
|
-
<h3 class="signature " id="
|
700
|
+
<h3 class="signature " id="wsresponse-instance_method">
|
599
701
|
|
600
|
-
- (<tt>Object</tt>) <strong>
|
702
|
+
- (<tt>Object</tt>) <strong>wsresponse</strong> <span class="extras">(readonly)</span>
|
601
703
|
|
602
704
|
|
603
705
|
|
@@ -606,17 +708,7 @@ Content-Type</p>
|
|
606
708
|
</h3><div class="docstring">
|
607
709
|
<div class="discussion">
|
608
710
|
|
609
|
-
<p>
|
610
|
-
<ul><li>
|
611
|
-
<p><code>url</code> = url to send the command to</p>
|
612
|
-
</li><li>
|
613
|
-
<p><code>body</code> = data to put in the body</p>
|
614
|
-
</li><li>
|
615
|
-
<p><code>headers</code> = header parameters including authorization and
|
616
|
-
Content-Type</p>
|
617
|
-
</li></ul>
|
618
|
-
|
619
|
-
<p>The response from the rest server is returned</p>
|
711
|
+
<p>The WebService Response from the last call</p>
|
620
712
|
|
621
713
|
|
622
714
|
</div>
|
@@ -630,25 +722,32 @@ Content-Type</p>
|
|
630
722
|
<pre class="lines">
|
631
723
|
|
632
724
|
|
633
|
-
|
634
|
-
|
635
|
-
|
725
|
+
22
|
726
|
+
23
|
727
|
+
24</pre>
|
636
728
|
</td>
|
637
729
|
<td>
|
638
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
730
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 22</span>
|
639
731
|
|
640
|
-
<span class='kw'>def</span> <span class='id identifier
|
641
|
-
|
732
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_wsresponse'>wsresponse</span>
|
733
|
+
<span class='ivar'>@wsresponse</span>
|
642
734
|
<span class='kw'>end</span></pre>
|
643
735
|
</td>
|
644
736
|
</tr>
|
645
737
|
</table>
|
646
738
|
</div>
|
647
739
|
|
648
|
-
|
649
|
-
|
740
|
+
</div>
|
741
|
+
|
742
|
+
|
743
|
+
<div id="instance_method_details" class="method_details_list">
|
744
|
+
<h2>Instance Method Details</h2>
|
745
|
+
|
746
|
+
|
747
|
+
<div class="method_details first">
|
748
|
+
<h3 class="signature first" id="add_headers-instance_method">
|
650
749
|
|
651
|
-
- (<tt>Object</tt>) <strong>
|
750
|
+
- (<tt>Object</tt>) <strong>add_headers</strong>(headers)
|
652
751
|
|
653
752
|
|
654
753
|
|
@@ -657,15 +756,33 @@ Content-Type</p>
|
|
657
756
|
</h3><div class="docstring">
|
658
757
|
<div class="discussion">
|
659
758
|
|
660
|
-
<p>
|
661
|
-
|
662
|
-
<p>The nice looking output is returned as a string</p>
|
759
|
+
<p>Modifies the headers by merging new headers with current headers.</p>
|
663
760
|
|
664
761
|
|
665
762
|
</div>
|
666
763
|
</div>
|
667
764
|
<div class="tags">
|
765
|
+
<p class="tag_title">Parameters:</p>
|
766
|
+
<ul class="param">
|
767
|
+
|
768
|
+
<li>
|
769
|
+
|
770
|
+
<span class='name'>headers</span>
|
771
|
+
|
772
|
+
|
773
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
—
|
778
|
+
<div class='inline'>
|
779
|
+
<p>new headers to merge with current headers</p>
|
780
|
+
</div>
|
781
|
+
|
782
|
+
</li>
|
668
783
|
|
784
|
+
</ul>
|
785
|
+
|
669
786
|
|
670
787
|
</div><table class="source_code">
|
671
788
|
<tr>
|
@@ -673,33 +790,15 @@ Content-Type</p>
|
|
673
790
|
<pre class="lines">
|
674
791
|
|
675
792
|
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
127
|
680
|
-
128
|
681
|
-
129
|
682
|
-
130
|
683
|
-
131
|
684
|
-
132
|
685
|
-
133
|
686
|
-
134
|
687
|
-
135</pre>
|
793
|
+
57
|
794
|
+
58
|
795
|
+
59</pre>
|
688
796
|
</td>
|
689
797
|
<td>
|
690
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
691
|
-
|
692
|
-
<span class='kw'>def</span> <span class='id identifier
|
693
|
-
|
694
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>MESSAGE = </span><span class='embexpr_beg'>#{</span><span class='ivar'>@wsresponse</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
695
|
-
<span class='ivar'>@wsresponse</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_output'>output</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'> = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
696
|
-
<span class='kw'>begin</span>
|
697
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>BODY = </span><span class='tstring_end'>"</span></span>
|
698
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@wsresponse</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
699
|
-
<span class='kw'>rescue</span>
|
700
|
-
<span class='id identifier rubyid_output'>output</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[Empty]</span><span class='tstring_end'>"</span></span>
|
701
|
-
<span class='kw'>end</span>
|
702
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span>
|
798
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 57</span>
|
799
|
+
|
800
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_headers'>add_headers</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
801
|
+
<span class='ivar'>@headers</span> <span class='op'>=</span> <span class='ivar'>@headers</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
703
802
|
<span class='kw'>end</span></pre>
|
704
803
|
</td>
|
705
804
|
</tr>
|
@@ -707,9 +806,9 @@ Content-Type</p>
|
|
707
806
|
</div>
|
708
807
|
|
709
808
|
<div class="method_details ">
|
710
|
-
<h3 class="signature " id="
|
809
|
+
<h3 class="signature " id="delete-instance_method">
|
711
810
|
|
712
|
-
- (<tt>Object</tt>) <strong>
|
811
|
+
- (<tt>Object</tt>) <strong>delete</strong>(headers = {}, path = '', parameters = {})
|
713
812
|
|
714
813
|
|
715
814
|
|
@@ -718,23 +817,71 @@ Content-Type</p>
|
|
718
817
|
</h3><div class="docstring">
|
719
818
|
<div class="discussion">
|
720
819
|
|
721
|
-
<p>Basic web services
|
722
|
-
<ul><li>
|
723
|
-
<p><code>url</code> = url to send the command to</p>
|
724
|
-
</li><li>
|
725
|
-
<p><code>body</code> = data to put in the body</p>
|
726
|
-
</li><li>
|
727
|
-
<p><code>headers</code> = header parameters including authorization and
|
728
|
-
Content-Type</p>
|
729
|
-
</li></ul>
|
730
|
-
|
731
|
-
<p>The response from the rest server is returned</p>
|
820
|
+
<p>Basic web services Delete command</p>
|
732
821
|
|
733
822
|
|
734
823
|
</div>
|
735
824
|
</div>
|
736
825
|
<div class="tags">
|
826
|
+
<p class="tag_title">Parameters:</p>
|
827
|
+
<ul class="param">
|
737
828
|
|
829
|
+
<li>
|
830
|
+
|
831
|
+
<span class='name'>path</span>
|
832
|
+
|
833
|
+
|
834
|
+
<span class='type'>(<tt>String</tt>)</span>
|
835
|
+
|
836
|
+
|
837
|
+
<em class="default">(defaults to: <tt>''</tt>)</em>
|
838
|
+
|
839
|
+
|
840
|
+
—
|
841
|
+
<div class='inline'>
|
842
|
+
<p>Path of service to send the command to</p>
|
843
|
+
</div>
|
844
|
+
|
845
|
+
</li>
|
846
|
+
|
847
|
+
<li>
|
848
|
+
|
849
|
+
<span class='name'>headers</span>
|
850
|
+
|
851
|
+
|
852
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
853
|
+
|
854
|
+
|
855
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
856
|
+
|
857
|
+
|
858
|
+
—
|
859
|
+
<div class='inline'>
|
860
|
+
<p>header parameters including authorization and Content-Type</p>
|
861
|
+
</div>
|
862
|
+
|
863
|
+
</li>
|
864
|
+
|
865
|
+
</ul>
|
866
|
+
|
867
|
+
<p class="tag_title">Returns:</p>
|
868
|
+
<ul class="return">
|
869
|
+
|
870
|
+
<li>
|
871
|
+
|
872
|
+
|
873
|
+
<span class='type'></span>
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
<div class='inline'>
|
879
|
+
<p>The response from the rest server is returned</p>
|
880
|
+
</div>
|
881
|
+
|
882
|
+
</li>
|
883
|
+
|
884
|
+
</ul>
|
738
885
|
|
739
886
|
</div><table class="source_code">
|
740
887
|
<tr>
|
@@ -742,15 +889,23 @@ Content-Type</p>
|
|
742
889
|
<pre class="lines">
|
743
890
|
|
744
891
|
|
745
|
-
|
746
|
-
|
747
|
-
|
892
|
+
97
|
893
|
+
98
|
894
|
+
99
|
895
|
+
100
|
896
|
+
101
|
897
|
+
102
|
898
|
+
103</pre>
|
748
899
|
</td>
|
749
900
|
<td>
|
750
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
751
|
-
|
752
|
-
<span class='kw'>def</span> <span class='id identifier
|
753
|
-
|
901
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 97</span>
|
902
|
+
|
903
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_parameters'>parameters</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
904
|
+
<span class='id identifier rubyid_full_path'>full_path</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form'>encode_www_form</span><span class='lparen'>(</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>PARAM_STARTER</span><span class='rparen'>)</span>
|
905
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@url</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_full_path'>full_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
906
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Delete</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
|
907
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
908
|
+
<span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_request'>request</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
754
909
|
<span class='kw'>end</span></pre>
|
755
910
|
</td>
|
756
911
|
</tr>
|
@@ -758,9 +913,9 @@ Content-Type</p>
|
|
758
913
|
</div>
|
759
914
|
|
760
915
|
<div class="method_details ">
|
761
|
-
<h3 class="signature " id="
|
916
|
+
<h3 class="signature " id="get-instance_method">
|
762
917
|
|
763
|
-
- (<tt>Object</tt>) <strong>
|
918
|
+
- (<tt>Object</tt>) <strong>get</strong>(headers = {}, path = '', parameters = {})
|
764
919
|
|
765
920
|
|
766
921
|
|
@@ -769,25 +924,214 @@ Content-Type</p>
|
|
769
924
|
</h3><div class="docstring">
|
770
925
|
<div class="discussion">
|
771
926
|
|
772
|
-
<p>
|
773
|
-
|
774
|
-
<p><code>url</code> = url to send the command to</p>
|
775
|
-
</li><li>
|
776
|
-
<p><code>req</code> = command to send as Net::HTTP:<command> class</p>
|
777
|
-
</li><li>
|
778
|
-
<p><code>body</code> = data to put in the body</p>
|
779
|
-
</li><li>
|
780
|
-
<p><code>headers</code> = header parameters including authorization and
|
781
|
-
Content-Type</p>
|
782
|
-
</li></ul>
|
927
|
+
<p>Basic web services Get command</p>
|
928
|
+
|
783
929
|
|
930
|
+
</div>
|
931
|
+
</div>
|
932
|
+
<div class="tags">
|
933
|
+
<p class="tag_title">Parameters:</p>
|
934
|
+
<ul class="param">
|
935
|
+
|
936
|
+
<li>
|
937
|
+
|
938
|
+
<span class='name'>headers</span>
|
939
|
+
|
940
|
+
|
941
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
942
|
+
|
943
|
+
|
944
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
945
|
+
|
946
|
+
|
947
|
+
—
|
948
|
+
<div class='inline'>
|
949
|
+
<p>header parameters including authorization and Content-Type</p>
|
950
|
+
</div>
|
951
|
+
|
952
|
+
</li>
|
953
|
+
|
954
|
+
<li>
|
955
|
+
|
956
|
+
<span class='name'>path</span>
|
957
|
+
|
958
|
+
|
959
|
+
<span class='type'>(<tt>String</tt>)</span>
|
960
|
+
|
961
|
+
|
962
|
+
<em class="default">(defaults to: <tt>''</tt>)</em>
|
963
|
+
|
964
|
+
|
965
|
+
—
|
966
|
+
<div class='inline'>
|
967
|
+
<p>Path of service to send the command to</p>
|
968
|
+
</div>
|
969
|
+
|
970
|
+
</li>
|
971
|
+
|
972
|
+
<li>
|
973
|
+
|
974
|
+
<span class='name'>parameters</span>
|
975
|
+
|
976
|
+
|
977
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
978
|
+
|
979
|
+
|
980
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
981
|
+
|
982
|
+
|
983
|
+
—
|
984
|
+
<div class='inline'>
|
985
|
+
<p>query string that added as part of the URL</p>
|
986
|
+
</div>
|
987
|
+
|
988
|
+
</li>
|
989
|
+
|
990
|
+
</ul>
|
991
|
+
|
992
|
+
<p class="tag_title">Returns:</p>
|
993
|
+
<ul class="return">
|
994
|
+
|
995
|
+
<li>
|
996
|
+
|
997
|
+
|
998
|
+
<span class='type'></span>
|
999
|
+
|
1000
|
+
|
1001
|
+
|
1002
|
+
|
1003
|
+
<div class='inline'>
|
784
1004
|
<p>The response from the rest server is returned</p>
|
1005
|
+
</div>
|
1006
|
+
|
1007
|
+
</li>
|
1008
|
+
|
1009
|
+
</ul>
|
1010
|
+
|
1011
|
+
</div><table class="source_code">
|
1012
|
+
<tr>
|
1013
|
+
<td>
|
1014
|
+
<pre class="lines">
|
1015
|
+
|
1016
|
+
|
1017
|
+
68
|
1018
|
+
69
|
1019
|
+
70
|
1020
|
+
71
|
1021
|
+
72
|
1022
|
+
73
|
1023
|
+
74</pre>
|
1024
|
+
</td>
|
1025
|
+
<td>
|
1026
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 68</span>
|
1027
|
+
|
1028
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_parameters'>parameters</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1029
|
+
<span class='id identifier rubyid_full_path'>full_path</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form'>encode_www_form</span><span class='lparen'>(</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>PARAM_STARTER</span><span class='rparen'>)</span>
|
1030
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@url</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_full_path'>full_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1031
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
|
1032
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1033
|
+
<span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_request'>request</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
1034
|
+
<span class='kw'>end</span></pre>
|
1035
|
+
</td>
|
1036
|
+
</tr>
|
1037
|
+
</table>
|
1038
|
+
</div>
|
1039
|
+
|
1040
|
+
<div class="method_details ">
|
1041
|
+
<h3 class="signature " id="post-instance_method">
|
1042
|
+
|
1043
|
+
- (<tt>Object</tt>) <strong>post</strong>(body = nil, headers = {}, path = '')
|
1044
|
+
|
1045
|
+
|
1046
|
+
|
1047
|
+
|
1048
|
+
|
1049
|
+
</h3><div class="docstring">
|
1050
|
+
<div class="discussion">
|
1051
|
+
|
1052
|
+
<p>Basic web services Post command</p>
|
785
1053
|
|
786
1054
|
|
787
1055
|
</div>
|
788
1056
|
</div>
|
789
1057
|
<div class="tags">
|
1058
|
+
<p class="tag_title">Parameters:</p>
|
1059
|
+
<ul class="param">
|
790
1060
|
|
1061
|
+
<li>
|
1062
|
+
|
1063
|
+
<span class='name'>path</span>
|
1064
|
+
|
1065
|
+
|
1066
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1067
|
+
|
1068
|
+
|
1069
|
+
<em class="default">(defaults to: <tt>''</tt>)</em>
|
1070
|
+
|
1071
|
+
|
1072
|
+
—
|
1073
|
+
<div class='inline'>
|
1074
|
+
<p>Path of service to send the command to</p>
|
1075
|
+
</div>
|
1076
|
+
|
1077
|
+
</li>
|
1078
|
+
|
1079
|
+
<li>
|
1080
|
+
|
1081
|
+
<span class='name'>body</span>
|
1082
|
+
|
1083
|
+
|
1084
|
+
<span class='type'>(<tt>Any type of string</tt>)</span>
|
1085
|
+
|
1086
|
+
|
1087
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1088
|
+
|
1089
|
+
|
1090
|
+
—
|
1091
|
+
<div class='inline'>
|
1092
|
+
<p>Data to put in the body such as json or xml</p>
|
1093
|
+
</div>
|
1094
|
+
|
1095
|
+
</li>
|
1096
|
+
|
1097
|
+
<li>
|
1098
|
+
|
1099
|
+
<span class='name'>headers</span>
|
1100
|
+
|
1101
|
+
|
1102
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1103
|
+
|
1104
|
+
|
1105
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1106
|
+
|
1107
|
+
|
1108
|
+
—
|
1109
|
+
<div class='inline'>
|
1110
|
+
<p>header parameters including authorization and Content-Type</p>
|
1111
|
+
</div>
|
1112
|
+
|
1113
|
+
</li>
|
1114
|
+
|
1115
|
+
</ul>
|
1116
|
+
|
1117
|
+
<p class="tag_title">Returns:</p>
|
1118
|
+
<ul class="return">
|
1119
|
+
|
1120
|
+
<li>
|
1121
|
+
|
1122
|
+
|
1123
|
+
<span class='type'></span>
|
1124
|
+
|
1125
|
+
|
1126
|
+
|
1127
|
+
|
1128
|
+
<div class='inline'>
|
1129
|
+
<p>The response from the rest server is returned</p>
|
1130
|
+
</div>
|
1131
|
+
|
1132
|
+
</li>
|
1133
|
+
|
1134
|
+
</ul>
|
791
1135
|
|
792
1136
|
</div><table class="source_code">
|
793
1137
|
<tr>
|
@@ -795,35 +1139,21 @@ Content-Type</p>
|
|
795
1139
|
<pre class="lines">
|
796
1140
|
|
797
1141
|
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
108
|
805
|
-
109
|
806
|
-
110
|
807
|
-
111
|
808
|
-
112
|
809
|
-
113
|
810
|
-
114</pre>
|
1142
|
+
84
|
1143
|
+
85
|
1144
|
+
86
|
1145
|
+
87
|
1146
|
+
88
|
1147
|
+
89</pre>
|
811
1148
|
</td>
|
812
1149
|
<td>
|
813
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
814
|
-
|
815
|
-
<span class='kw'>def</span> <span class='id identifier
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
<span class='kw'>begin</span>
|
821
|
-
<span class='ivar'>@wsresponse</span> <span class='op'>=</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
|
822
|
-
<span class='comment'># puts print_last_response
|
823
|
-
</span> <span class='kw'>return</span> <span class='ivar'>@wsresponse</span>
|
824
|
-
<span class='kw'>rescue</span> <span class='const'>Timeout</span><span class='op'>::</span><span class='const'>Error</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
825
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
826
|
-
<span class='kw'>end</span>
|
1150
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 84</span>
|
1151
|
+
|
1152
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1153
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@url</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1154
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Post</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
|
1155
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_body'>body</span> <span class='kw'>unless</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1156
|
+
<span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_request'>request</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
827
1157
|
<span class='kw'>end</span></pre>
|
828
1158
|
</td>
|
829
1159
|
</tr>
|
@@ -831,9 +1161,9 @@ Content-Type</p>
|
|
831
1161
|
</div>
|
832
1162
|
|
833
1163
|
<div class="method_details ">
|
834
|
-
<h3 class="signature " id="
|
1164
|
+
<h3 class="signature " id="put-instance_method">
|
835
1165
|
|
836
|
-
- (<tt>Object</tt>) <strong>
|
1166
|
+
- (<tt>Object</tt>) <strong>put</strong>(body = nil, headers = {}, path = '')
|
837
1167
|
|
838
1168
|
|
839
1169
|
|
@@ -842,18 +1172,89 @@ Content-Type</p>
|
|
842
1172
|
</h3><div class="docstring">
|
843
1173
|
<div class="discussion">
|
844
1174
|
|
845
|
-
<p>
|
846
|
-
<ul><li>
|
847
|
-
<p><code>user</code> = authorized username</p>
|
848
|
-
</li><li>
|
849
|
-
<p><code>password</code> = password for the user</p>
|
850
|
-
</li></ul>
|
1175
|
+
<p>Basic web services Put command</p>
|
851
1176
|
|
852
1177
|
|
853
1178
|
</div>
|
854
1179
|
</div>
|
855
1180
|
<div class="tags">
|
1181
|
+
<p class="tag_title">Parameters:</p>
|
1182
|
+
<ul class="param">
|
856
1183
|
|
1184
|
+
<li>
|
1185
|
+
|
1186
|
+
<span class='name'>path</span>
|
1187
|
+
|
1188
|
+
|
1189
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1190
|
+
|
1191
|
+
|
1192
|
+
<em class="default">(defaults to: <tt>''</tt>)</em>
|
1193
|
+
|
1194
|
+
|
1195
|
+
—
|
1196
|
+
<div class='inline'>
|
1197
|
+
<p>Path of service to send the command to</p>
|
1198
|
+
</div>
|
1199
|
+
|
1200
|
+
</li>
|
1201
|
+
|
1202
|
+
<li>
|
1203
|
+
|
1204
|
+
<span class='name'>body</span>
|
1205
|
+
|
1206
|
+
|
1207
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1208
|
+
|
1209
|
+
|
1210
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1211
|
+
|
1212
|
+
|
1213
|
+
—
|
1214
|
+
<div class='inline'>
|
1215
|
+
<p>data to put in the body</p>
|
1216
|
+
</div>
|
1217
|
+
|
1218
|
+
</li>
|
1219
|
+
|
1220
|
+
<li>
|
1221
|
+
|
1222
|
+
<span class='name'>headers</span>
|
1223
|
+
|
1224
|
+
|
1225
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1226
|
+
|
1227
|
+
|
1228
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1229
|
+
|
1230
|
+
|
1231
|
+
—
|
1232
|
+
<div class='inline'>
|
1233
|
+
<p>header parameters including authorization and Content-Type</p>
|
1234
|
+
</div>
|
1235
|
+
|
1236
|
+
</li>
|
1237
|
+
|
1238
|
+
</ul>
|
1239
|
+
|
1240
|
+
<p class="tag_title">Returns:</p>
|
1241
|
+
<ul class="return">
|
1242
|
+
|
1243
|
+
<li>
|
1244
|
+
|
1245
|
+
|
1246
|
+
<span class='type'></span>
|
1247
|
+
|
1248
|
+
|
1249
|
+
|
1250
|
+
|
1251
|
+
<div class='inline'>
|
1252
|
+
<p>Response from the rest server is returned</p>
|
1253
|
+
</div>
|
1254
|
+
|
1255
|
+
</li>
|
1256
|
+
|
1257
|
+
</ul>
|
857
1258
|
|
858
1259
|
</div><table class="source_code">
|
859
1260
|
<tr>
|
@@ -861,17 +1262,21 @@ Content-Type</p>
|
|
861
1262
|
<pre class="lines">
|
862
1263
|
|
863
1264
|
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
1265
|
+
112
|
1266
|
+
113
|
1267
|
+
114
|
1268
|
+
115
|
1269
|
+
116
|
1270
|
+
117</pre>
|
868
1271
|
</td>
|
869
1272
|
<td>
|
870
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
1273
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 112</span>
|
871
1274
|
|
872
|
-
<span class='kw'>def</span> <span class='id identifier
|
873
|
-
|
874
|
-
|
1275
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1276
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@url</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1277
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Put</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
|
1278
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_body'>body</span> <span class='kw'>unless</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1279
|
+
<span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_request'>request</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
875
1280
|
<span class='kw'>end</span></pre>
|
876
1281
|
</td>
|
877
1282
|
</tr>
|
@@ -879,9 +1284,9 @@ Content-Type</p>
|
|
879
1284
|
</div>
|
880
1285
|
|
881
1286
|
<div class="method_details ">
|
882
|
-
<h3 class="signature " id="
|
1287
|
+
<h3 class="signature " id="set_auth-instance_method">
|
883
1288
|
|
884
|
-
- (<tt>Object</tt>) <strong>
|
1289
|
+
- (<tt>Object</tt>) <strong>set_auth</strong>(user, password)
|
885
1290
|
|
886
1291
|
|
887
1292
|
|
@@ -890,16 +1295,49 @@ Content-Type</p>
|
|
890
1295
|
</h3><div class="docstring">
|
891
1296
|
<div class="discussion">
|
892
1297
|
|
893
|
-
<p>
|
894
|
-
<ul><li>
|
895
|
-
<p><code>headers</code> = new headers to merge with current headers</p>
|
896
|
-
</li></ul>
|
1298
|
+
<p>Adds user/password to the rest client</p>
|
897
1299
|
|
898
1300
|
|
899
1301
|
</div>
|
900
1302
|
</div>
|
901
1303
|
<div class="tags">
|
1304
|
+
<p class="tag_title">Parameters:</p>
|
1305
|
+
<ul class="param">
|
902
1306
|
|
1307
|
+
<li>
|
1308
|
+
|
1309
|
+
<span class='name'>user</span>
|
1310
|
+
|
1311
|
+
|
1312
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1313
|
+
|
1314
|
+
|
1315
|
+
|
1316
|
+
—
|
1317
|
+
<div class='inline'>
|
1318
|
+
<p>user that has authorization</p>
|
1319
|
+
</div>
|
1320
|
+
|
1321
|
+
</li>
|
1322
|
+
|
1323
|
+
<li>
|
1324
|
+
|
1325
|
+
<span class='name'>password</span>
|
1326
|
+
|
1327
|
+
|
1328
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1329
|
+
|
1330
|
+
|
1331
|
+
|
1332
|
+
—
|
1333
|
+
<div class='inline'>
|
1334
|
+
<p>authorized user's password</p>
|
1335
|
+
</div>
|
1336
|
+
|
1337
|
+
</li>
|
1338
|
+
|
1339
|
+
</ul>
|
1340
|
+
|
903
1341
|
|
904
1342
|
</div><table class="source_code">
|
905
1343
|
<tr>
|
@@ -907,15 +1345,17 @@ Content-Type</p>
|
|
907
1345
|
<pre class="lines">
|
908
1346
|
|
909
1347
|
|
910
|
-
|
911
|
-
|
912
|
-
|
1348
|
+
49
|
1349
|
+
50
|
1350
|
+
51
|
1351
|
+
52</pre>
|
913
1352
|
</td>
|
914
1353
|
<td>
|
915
|
-
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line
|
1354
|
+
<pre class="code"><span class="info file"># File 'lib/rest_baby.rb', line 49</span>
|
916
1355
|
|
917
|
-
<span class='kw'>def</span> <span class='id identifier
|
918
|
-
|
1356
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_auth'>set_auth</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='comma'>,</span> <span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
1357
|
+
<span class='ivar'>@user</span> <span class='op'>=</span> <span class='id identifier rubyid_user'>user</span>
|
1358
|
+
<span class='ivar'>@password</span> <span class='op'>=</span> <span class='id identifier rubyid_password'>password</span>
|
919
1359
|
<span class='kw'>end</span></pre>
|
920
1360
|
</td>
|
921
1361
|
</tr>
|
@@ -927,9 +1367,9 @@ Content-Type</p>
|
|
927
1367
|
</div>
|
928
1368
|
|
929
1369
|
<div id="footer">
|
930
|
-
Generated on
|
1370
|
+
Generated on Fri Jul 17 23:52:38 2015 by
|
931
1371
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
932
|
-
0.8.7 (ruby-2.0.0).
|
1372
|
+
0.8.7.6 (ruby-2.0.0).
|
933
1373
|
</div>
|
934
1374
|
|
935
1375
|
</body>
|