wrest 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/README.rdoc +5 -2
- data/bin/wrest.compiled.rbc +78 -0
- data/bin/wrest_shell.rbc +642 -0
- data/lib/wrest/native/connection_factory.rb +2 -2
- data/lib/wrest/native/request.rb +10 -8
- data/lib/wrest/uri.rb +8 -8
- data/lib/wrest/version.rb +2 -2
- metadata +19 -28
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,9 @@ Features under the section marked 'Current' are completed but pending release as
|
|
|
2
2
|
|
|
3
3
|
Features under a numbered section are complete and available in the Wrest gem.
|
|
4
4
|
|
|
5
|
+
== 1.4.1
|
|
6
|
+
* GH#66 HTTPS requests using the Net::HTTP backend failing on Ruby 1.8.x
|
|
7
|
+
|
|
5
8
|
== 1.4.0
|
|
6
9
|
* GH#96 Naive implementation of asynchronous requests using Eventmachine
|
|
7
10
|
* GH#93 Since Wrest::Response is immutable, the results of Response#deserialise are cached
|
data/README.rdoc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
= Wrest 1.4.
|
|
1
|
+
= Wrest 1.4.1
|
|
2
2
|
|
|
3
3
|
(c) Copyright 2009-2011 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
|
|
4
4
|
|
|
@@ -243,7 +243,10 @@ You can launch the interactive Wrest shell by running bin/wrest if you have the
|
|
|
243
243
|
=== Testing
|
|
244
244
|
|
|
245
245
|
Start the Sinatra test server for functional test.
|
|
246
|
-
rake -f spec/sample_app/Rakefile
|
|
246
|
+
rake -f spec/sample_app/Rakefile # runs on port 3000
|
|
247
|
+
|
|
248
|
+
Start a memcached daemon/process on port 11211
|
|
249
|
+
/usr/local/bin/memcached
|
|
247
250
|
|
|
248
251
|
Run the tests in a different terminal:
|
|
249
252
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
!RBIX
|
|
2
|
+
0
|
|
3
|
+
x
|
|
4
|
+
M
|
|
5
|
+
1
|
|
6
|
+
n
|
|
7
|
+
n
|
|
8
|
+
x
|
|
9
|
+
10
|
|
10
|
+
__script__
|
|
11
|
+
i
|
|
12
|
+
23
|
|
13
|
+
5
|
|
14
|
+
45
|
|
15
|
+
0
|
|
16
|
+
1
|
|
17
|
+
65
|
|
18
|
+
49
|
|
19
|
+
2
|
|
20
|
+
0
|
|
21
|
+
49
|
|
22
|
+
3
|
|
23
|
+
1
|
|
24
|
+
7
|
|
25
|
+
4
|
|
26
|
+
64
|
|
27
|
+
81
|
|
28
|
+
5
|
|
29
|
+
47
|
|
30
|
+
49
|
|
31
|
+
6
|
|
32
|
+
1
|
|
33
|
+
15
|
|
34
|
+
2
|
|
35
|
+
11
|
|
36
|
+
I
|
|
37
|
+
3
|
|
38
|
+
I
|
|
39
|
+
0
|
|
40
|
+
I
|
|
41
|
+
0
|
|
42
|
+
I
|
|
43
|
+
0
|
|
44
|
+
n
|
|
45
|
+
p
|
|
46
|
+
7
|
|
47
|
+
x
|
|
48
|
+
4
|
|
49
|
+
File
|
|
50
|
+
n
|
|
51
|
+
x
|
|
52
|
+
11
|
|
53
|
+
active_path
|
|
54
|
+
x
|
|
55
|
+
7
|
|
56
|
+
dirname
|
|
57
|
+
s
|
|
58
|
+
15
|
|
59
|
+
/wrest_shell.rb
|
|
60
|
+
x
|
|
61
|
+
1
|
|
62
|
+
+
|
|
63
|
+
x
|
|
64
|
+
4
|
|
65
|
+
load
|
|
66
|
+
p
|
|
67
|
+
3
|
|
68
|
+
I
|
|
69
|
+
0
|
|
70
|
+
I
|
|
71
|
+
3
|
|
72
|
+
I
|
|
73
|
+
17
|
|
74
|
+
x
|
|
75
|
+
32
|
|
76
|
+
/Users/sidu/Work/wrest/bin/wrest
|
|
77
|
+
p
|
|
78
|
+
0
|
data/bin/wrest_shell.rbc
ADDED
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
!RBIX
|
|
2
|
+
0
|
|
3
|
+
x
|
|
4
|
+
M
|
|
5
|
+
1
|
|
6
|
+
n
|
|
7
|
+
n
|
|
8
|
+
x
|
|
9
|
+
10
|
|
10
|
+
__script__
|
|
11
|
+
i
|
|
12
|
+
233
|
|
13
|
+
5
|
|
14
|
+
7
|
|
15
|
+
0
|
|
16
|
+
45
|
|
17
|
+
1
|
|
18
|
+
2
|
|
19
|
+
47
|
|
20
|
+
49
|
|
21
|
+
3
|
|
22
|
+
0
|
|
23
|
+
7
|
|
24
|
+
4
|
|
25
|
+
45
|
|
26
|
+
5
|
|
27
|
+
6
|
|
28
|
+
47
|
|
29
|
+
49
|
|
30
|
+
3
|
|
31
|
+
0
|
|
32
|
+
7
|
|
33
|
+
4
|
|
34
|
+
45
|
|
35
|
+
7
|
|
36
|
+
8
|
|
37
|
+
47
|
|
38
|
+
49
|
|
39
|
+
3
|
|
40
|
+
0
|
|
41
|
+
63
|
|
42
|
+
6
|
|
43
|
+
47
|
|
44
|
+
49
|
|
45
|
+
9
|
|
46
|
+
1
|
|
47
|
+
15
|
|
48
|
+
45
|
|
49
|
+
10
|
|
50
|
+
11
|
|
51
|
+
65
|
|
52
|
+
49
|
|
53
|
+
12
|
|
54
|
+
0
|
|
55
|
+
49
|
|
56
|
+
13
|
|
57
|
+
1
|
|
58
|
+
47
|
|
59
|
+
49
|
|
60
|
+
3
|
|
61
|
+
0
|
|
62
|
+
7
|
|
63
|
+
14
|
|
64
|
+
63
|
|
65
|
+
2
|
|
66
|
+
19
|
|
67
|
+
0
|
|
68
|
+
15
|
|
69
|
+
45
|
|
70
|
+
10
|
|
71
|
+
15
|
|
72
|
+
65
|
|
73
|
+
49
|
|
74
|
+
12
|
|
75
|
+
0
|
|
76
|
+
49
|
|
77
|
+
13
|
|
78
|
+
1
|
|
79
|
+
47
|
|
80
|
+
49
|
|
81
|
+
3
|
|
82
|
+
0
|
|
83
|
+
7
|
|
84
|
+
16
|
|
85
|
+
63
|
|
86
|
+
2
|
|
87
|
+
19
|
|
88
|
+
1
|
|
89
|
+
15
|
|
90
|
+
45
|
|
91
|
+
7
|
|
92
|
+
17
|
|
93
|
+
7
|
|
94
|
+
18
|
|
95
|
+
13
|
|
96
|
+
70
|
|
97
|
+
9
|
|
98
|
+
98
|
|
99
|
+
15
|
|
100
|
+
44
|
|
101
|
+
43
|
|
102
|
+
19
|
|
103
|
+
7
|
|
104
|
+
20
|
|
105
|
+
78
|
|
106
|
+
49
|
|
107
|
+
21
|
|
108
|
+
2
|
|
109
|
+
6
|
|
110
|
+
18
|
|
111
|
+
49
|
|
112
|
+
22
|
|
113
|
+
1
|
|
114
|
+
9
|
|
115
|
+
108
|
|
116
|
+
7
|
|
117
|
+
23
|
|
118
|
+
64
|
|
119
|
+
8
|
|
120
|
+
111
|
|
121
|
+
7
|
|
122
|
+
24
|
|
123
|
+
64
|
|
124
|
+
19
|
|
125
|
+
2
|
|
126
|
+
15
|
|
127
|
+
5
|
|
128
|
+
7
|
|
129
|
+
25
|
|
130
|
+
64
|
|
131
|
+
47
|
|
132
|
+
49
|
|
133
|
+
26
|
|
134
|
+
1
|
|
135
|
+
15
|
|
136
|
+
44
|
|
137
|
+
43
|
|
138
|
+
27
|
|
139
|
+
79
|
|
140
|
+
49
|
|
141
|
+
28
|
|
142
|
+
1
|
|
143
|
+
13
|
|
144
|
+
7
|
|
145
|
+
29
|
|
146
|
+
20
|
|
147
|
+
2
|
|
148
|
+
49
|
|
149
|
+
30
|
|
150
|
+
2
|
|
151
|
+
15
|
|
152
|
+
19
|
|
153
|
+
3
|
|
154
|
+
15
|
|
155
|
+
45
|
|
156
|
+
31
|
|
157
|
+
32
|
|
158
|
+
56
|
|
159
|
+
33
|
|
160
|
+
50
|
|
161
|
+
21
|
|
162
|
+
0
|
|
163
|
+
15
|
|
164
|
+
7
|
|
165
|
+
34
|
|
166
|
+
64
|
|
167
|
+
19
|
|
168
|
+
4
|
|
169
|
+
15
|
|
170
|
+
20
|
|
171
|
+
4
|
|
172
|
+
7
|
|
173
|
+
35
|
|
174
|
+
20
|
|
175
|
+
0
|
|
176
|
+
47
|
|
177
|
+
49
|
|
178
|
+
3
|
|
179
|
+
0
|
|
180
|
+
63
|
|
181
|
+
2
|
|
182
|
+
49
|
|
183
|
+
36
|
|
184
|
+
1
|
|
185
|
+
15
|
|
186
|
+
5
|
|
187
|
+
20
|
|
188
|
+
1
|
|
189
|
+
47
|
|
190
|
+
49
|
|
191
|
+
26
|
|
192
|
+
1
|
|
193
|
+
15
|
|
194
|
+
5
|
|
195
|
+
7
|
|
196
|
+
37
|
|
197
|
+
45
|
|
198
|
+
38
|
|
199
|
+
39
|
|
200
|
+
43
|
|
201
|
+
40
|
|
202
|
+
43
|
|
203
|
+
41
|
|
204
|
+
47
|
|
205
|
+
49
|
|
206
|
+
3
|
|
207
|
+
0
|
|
208
|
+
63
|
|
209
|
+
2
|
|
210
|
+
47
|
|
211
|
+
49
|
|
212
|
+
9
|
|
213
|
+
1
|
|
214
|
+
15
|
|
215
|
+
5
|
|
216
|
+
20
|
|
217
|
+
3
|
|
218
|
+
7
|
|
219
|
+
29
|
|
220
|
+
49
|
|
221
|
+
42
|
|
222
|
+
1
|
|
223
|
+
47
|
|
224
|
+
49
|
|
225
|
+
3
|
|
226
|
+
0
|
|
227
|
+
7
|
|
228
|
+
43
|
|
229
|
+
20
|
|
230
|
+
4
|
|
231
|
+
47
|
|
232
|
+
49
|
|
233
|
+
3
|
|
234
|
+
0
|
|
235
|
+
7
|
|
236
|
+
44
|
|
237
|
+
63
|
|
238
|
+
4
|
|
239
|
+
47
|
|
240
|
+
49
|
|
241
|
+
45
|
|
242
|
+
1
|
|
243
|
+
15
|
|
244
|
+
2
|
|
245
|
+
11
|
|
246
|
+
I
|
|
247
|
+
c
|
|
248
|
+
I
|
|
249
|
+
5
|
|
250
|
+
I
|
|
251
|
+
0
|
|
252
|
+
I
|
|
253
|
+
0
|
|
254
|
+
n
|
|
255
|
+
p
|
|
256
|
+
46
|
|
257
|
+
s
|
|
258
|
+
5
|
|
259
|
+
Ruby
|
|
260
|
+
x
|
|
261
|
+
12
|
|
262
|
+
RUBY_VERSION
|
|
263
|
+
n
|
|
264
|
+
x
|
|
265
|
+
4
|
|
266
|
+
to_s
|
|
267
|
+
s
|
|
268
|
+
2
|
|
269
|
+
,
|
|
270
|
+
x
|
|
271
|
+
17
|
|
272
|
+
RUBY_RELEASE_DATE
|
|
273
|
+
n
|
|
274
|
+
x
|
|
275
|
+
13
|
|
276
|
+
RUBY_PLATFORM
|
|
277
|
+
n
|
|
278
|
+
x
|
|
279
|
+
4
|
|
280
|
+
puts
|
|
281
|
+
x
|
|
282
|
+
4
|
|
283
|
+
File
|
|
284
|
+
n
|
|
285
|
+
x
|
|
286
|
+
11
|
|
287
|
+
active_path
|
|
288
|
+
x
|
|
289
|
+
7
|
|
290
|
+
dirname
|
|
291
|
+
s
|
|
292
|
+
16
|
|
293
|
+
/../lib/wrest.rb
|
|
294
|
+
n
|
|
295
|
+
s
|
|
296
|
+
24
|
|
297
|
+
/../lib/wrest/version.rb
|
|
298
|
+
n
|
|
299
|
+
n
|
|
300
|
+
x
|
|
301
|
+
6
|
|
302
|
+
Regexp
|
|
303
|
+
s
|
|
304
|
+
15
|
|
305
|
+
(:?mswin|mingw)
|
|
306
|
+
x
|
|
307
|
+
3
|
|
308
|
+
new
|
|
309
|
+
x
|
|
310
|
+
2
|
|
311
|
+
=~
|
|
312
|
+
s
|
|
313
|
+
7
|
|
314
|
+
irb.bat
|
|
315
|
+
s
|
|
316
|
+
3
|
|
317
|
+
irb
|
|
318
|
+
s
|
|
319
|
+
8
|
|
320
|
+
optparse
|
|
321
|
+
x
|
|
322
|
+
7
|
|
323
|
+
require
|
|
324
|
+
x
|
|
325
|
+
4
|
|
326
|
+
Hash
|
|
327
|
+
x
|
|
328
|
+
16
|
|
329
|
+
new_from_literal
|
|
330
|
+
x
|
|
331
|
+
3
|
|
332
|
+
irb
|
|
333
|
+
x
|
|
334
|
+
3
|
|
335
|
+
[]=
|
|
336
|
+
x
|
|
337
|
+
12
|
|
338
|
+
OptionParser
|
|
339
|
+
n
|
|
340
|
+
M
|
|
341
|
+
1
|
|
342
|
+
p
|
|
343
|
+
2
|
|
344
|
+
x
|
|
345
|
+
9
|
|
346
|
+
for_block
|
|
347
|
+
t
|
|
348
|
+
n
|
|
349
|
+
x
|
|
350
|
+
9
|
|
351
|
+
__block__
|
|
352
|
+
i
|
|
353
|
+
50
|
|
354
|
+
57
|
|
355
|
+
19
|
|
356
|
+
0
|
|
357
|
+
15
|
|
358
|
+
20
|
|
359
|
+
0
|
|
360
|
+
7
|
|
361
|
+
0
|
|
362
|
+
64
|
|
363
|
+
13
|
|
364
|
+
18
|
|
365
|
+
2
|
|
366
|
+
49
|
|
367
|
+
1
|
|
368
|
+
1
|
|
369
|
+
15
|
|
370
|
+
15
|
|
371
|
+
20
|
|
372
|
+
0
|
|
373
|
+
7
|
|
374
|
+
2
|
|
375
|
+
21
|
|
376
|
+
1
|
|
377
|
+
2
|
|
378
|
+
47
|
|
379
|
+
49
|
|
380
|
+
3
|
|
381
|
+
0
|
|
382
|
+
7
|
|
383
|
+
4
|
|
384
|
+
63
|
|
385
|
+
3
|
|
386
|
+
7
|
|
387
|
+
5
|
|
388
|
+
64
|
|
389
|
+
56
|
|
390
|
+
6
|
|
391
|
+
50
|
|
392
|
+
7
|
|
393
|
+
2
|
|
394
|
+
15
|
|
395
|
+
20
|
|
396
|
+
0
|
|
397
|
+
45
|
|
398
|
+
8
|
|
399
|
+
9
|
|
400
|
+
49
|
|
401
|
+
10
|
|
402
|
+
1
|
|
403
|
+
11
|
|
404
|
+
I
|
|
405
|
+
6
|
|
406
|
+
I
|
|
407
|
+
1
|
|
408
|
+
I
|
|
409
|
+
1
|
|
410
|
+
I
|
|
411
|
+
1
|
|
412
|
+
n
|
|
413
|
+
p
|
|
414
|
+
11
|
|
415
|
+
s
|
|
416
|
+
24
|
|
417
|
+
Usage: console [options]
|
|
418
|
+
x
|
|
419
|
+
7
|
|
420
|
+
banner=
|
|
421
|
+
s
|
|
422
|
+
7
|
|
423
|
+
--irb=[
|
|
424
|
+
x
|
|
425
|
+
4
|
|
426
|
+
to_s
|
|
427
|
+
s
|
|
428
|
+
1
|
|
429
|
+
]
|
|
430
|
+
s
|
|
431
|
+
23
|
|
432
|
+
Invoke a different irb.
|
|
433
|
+
M
|
|
434
|
+
1
|
|
435
|
+
p
|
|
436
|
+
2
|
|
437
|
+
x
|
|
438
|
+
9
|
|
439
|
+
for_block
|
|
440
|
+
t
|
|
441
|
+
n
|
|
442
|
+
x
|
|
443
|
+
9
|
|
444
|
+
__block__
|
|
445
|
+
i
|
|
446
|
+
19
|
|
447
|
+
57
|
|
448
|
+
19
|
|
449
|
+
0
|
|
450
|
+
15
|
|
451
|
+
21
|
|
452
|
+
2
|
|
453
|
+
3
|
|
454
|
+
7
|
|
455
|
+
0
|
|
456
|
+
20
|
|
457
|
+
0
|
|
458
|
+
13
|
|
459
|
+
18
|
|
460
|
+
3
|
|
461
|
+
49
|
|
462
|
+
1
|
|
463
|
+
2
|
|
464
|
+
15
|
|
465
|
+
11
|
|
466
|
+
I
|
|
467
|
+
6
|
|
468
|
+
I
|
|
469
|
+
1
|
|
470
|
+
I
|
|
471
|
+
1
|
|
472
|
+
I
|
|
473
|
+
1
|
|
474
|
+
n
|
|
475
|
+
p
|
|
476
|
+
2
|
|
477
|
+
x
|
|
478
|
+
3
|
|
479
|
+
irb
|
|
480
|
+
x
|
|
481
|
+
3
|
|
482
|
+
[]=
|
|
483
|
+
p
|
|
484
|
+
3
|
|
485
|
+
I
|
|
486
|
+
0
|
|
487
|
+
I
|
|
488
|
+
c
|
|
489
|
+
I
|
|
490
|
+
13
|
|
491
|
+
x
|
|
492
|
+
41
|
|
493
|
+
/Users/sidu/Work/wrest/bin/wrest_shell.rb
|
|
494
|
+
p
|
|
495
|
+
1
|
|
496
|
+
x
|
|
497
|
+
1
|
|
498
|
+
v
|
|
499
|
+
x
|
|
500
|
+
2
|
|
501
|
+
on
|
|
502
|
+
x
|
|
503
|
+
4
|
|
504
|
+
ARGV
|
|
505
|
+
n
|
|
506
|
+
x
|
|
507
|
+
6
|
|
508
|
+
parse!
|
|
509
|
+
p
|
|
510
|
+
9
|
|
511
|
+
I
|
|
512
|
+
0
|
|
513
|
+
I
|
|
514
|
+
a
|
|
515
|
+
I
|
|
516
|
+
4
|
|
517
|
+
I
|
|
518
|
+
b
|
|
519
|
+
I
|
|
520
|
+
11
|
|
521
|
+
I
|
|
522
|
+
c
|
|
523
|
+
I
|
|
524
|
+
29
|
|
525
|
+
I
|
|
526
|
+
d
|
|
527
|
+
I
|
|
528
|
+
32
|
|
529
|
+
x
|
|
530
|
+
41
|
|
531
|
+
/Users/sidu/Work/wrest/bin/wrest_shell.rb
|
|
532
|
+
p
|
|
533
|
+
1
|
|
534
|
+
x
|
|
535
|
+
3
|
|
536
|
+
opt
|
|
537
|
+
s
|
|
538
|
+
18
|
|
539
|
+
-r irb/completion
|
|
540
|
+
s
|
|
541
|
+
4
|
|
542
|
+
-r
|
|
543
|
+
x
|
|
544
|
+
2
|
|
545
|
+
<<
|
|
546
|
+
s
|
|
547
|
+
14
|
|
548
|
+
Loading Wrest
|
|
549
|
+
x
|
|
550
|
+
5
|
|
551
|
+
Wrest
|
|
552
|
+
n
|
|
553
|
+
x
|
|
554
|
+
7
|
|
555
|
+
VERSION
|
|
556
|
+
x
|
|
557
|
+
6
|
|
558
|
+
STRING
|
|
559
|
+
x
|
|
560
|
+
2
|
|
561
|
+
[]
|
|
562
|
+
s
|
|
563
|
+
1
|
|
564
|
+
|
|
565
|
+
s
|
|
566
|
+
16
|
|
567
|
+
--simple-prompt
|
|
568
|
+
x
|
|
569
|
+
4
|
|
570
|
+
exec
|
|
571
|
+
p
|
|
572
|
+
25
|
|
573
|
+
I
|
|
574
|
+
0
|
|
575
|
+
I
|
|
576
|
+
1
|
|
577
|
+
I
|
|
578
|
+
23
|
|
579
|
+
I
|
|
580
|
+
3
|
|
581
|
+
I
|
|
582
|
+
38
|
|
583
|
+
I
|
|
584
|
+
4
|
|
585
|
+
I
|
|
586
|
+
4d
|
|
587
|
+
I
|
|
588
|
+
6
|
|
589
|
+
I
|
|
590
|
+
72
|
|
591
|
+
I
|
|
592
|
+
8
|
|
593
|
+
I
|
|
594
|
+
7b
|
|
595
|
+
I
|
|
596
|
+
9
|
|
597
|
+
I
|
|
598
|
+
8e
|
|
599
|
+
I
|
|
600
|
+
a
|
|
601
|
+
I
|
|
602
|
+
97
|
|
603
|
+
I
|
|
604
|
+
10
|
|
605
|
+
I
|
|
606
|
+
9d
|
|
607
|
+
I
|
|
608
|
+
11
|
|
609
|
+
I
|
|
610
|
+
ad
|
|
611
|
+
I
|
|
612
|
+
13
|
|
613
|
+
I
|
|
614
|
+
b5
|
|
615
|
+
I
|
|
616
|
+
14
|
|
617
|
+
I
|
|
618
|
+
ca
|
|
619
|
+
I
|
|
620
|
+
15
|
|
621
|
+
I
|
|
622
|
+
e9
|
|
623
|
+
x
|
|
624
|
+
41
|
|
625
|
+
/Users/sidu/Work/wrest/bin/wrest_shell.rb
|
|
626
|
+
p
|
|
627
|
+
5
|
|
628
|
+
x
|
|
629
|
+
11
|
|
630
|
+
entry_point
|
|
631
|
+
x
|
|
632
|
+
7
|
|
633
|
+
version
|
|
634
|
+
x
|
|
635
|
+
3
|
|
636
|
+
irb
|
|
637
|
+
x
|
|
638
|
+
7
|
|
639
|
+
options
|
|
640
|
+
x
|
|
641
|
+
4
|
|
642
|
+
libs
|
|
@@ -15,8 +15,8 @@ module Wrest::Native
|
|
|
15
15
|
connection.read_timeout = options[:timeout]
|
|
16
16
|
if self.https?
|
|
17
17
|
connection.use_ssl = true
|
|
18
|
-
connection.verify_mode = options[:verify_mode]? options[:verify_mode] : OpenSSL::SSL::VERIFY_PEER
|
|
19
|
-
|
|
18
|
+
connection.verify_mode = options[:verify_mode] ? options[:verify_mode] : OpenSSL::SSL::VERIFY_PEER
|
|
19
|
+
connection.ca_path = options[:ca_path] if options[:ca_path]
|
|
20
20
|
end
|
|
21
21
|
connection
|
|
22
22
|
end
|
data/lib/wrest/native/request.rb
CHANGED
|
@@ -13,7 +13,8 @@ module Wrest::Native
|
|
|
13
13
|
# or Wrest::Native::Get etc. instead.
|
|
14
14
|
class Request
|
|
15
15
|
attr_reader :http_request, :uri, :body, :headers, :username, :password, :follow_redirects,
|
|
16
|
-
:follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters,
|
|
16
|
+
:follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters,
|
|
17
|
+
:cache_store, :verify_mode, :options, :ca_path
|
|
17
18
|
# Valid tuples for the options are:
|
|
18
19
|
# :username => String, defaults to nil
|
|
19
20
|
# :password => String, defaults to nil
|
|
@@ -31,15 +32,15 @@ module Wrest::Native
|
|
|
31
32
|
# in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
|
|
32
33
|
# :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
|
|
33
34
|
# used for multiple requests.
|
|
34
|
-
# :verify_mode => The verification mode to be used for Net::HTTP https connections. Defaults to OpenSSL::SSL::VERIFY_PEER
|
|
35
35
|
# :cache_store => The object which should be used as cache store for cacheable responses. If not supplied, caching will be disabled.
|
|
36
|
-
# :detailed_http_logging => nil/$stdout/$stderr or File/Logger/IO object. Defaults to nil (recommended).
|
|
37
36
|
# :callback => A Hash whose keys are the response codes (or Range of response codes),
|
|
38
37
|
# and the values are the callback functions to be executed.
|
|
39
38
|
# eg: { <response code> => lambda { |response| some_operation } }
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
39
|
+
# The following options are Net::HTTP specific config options
|
|
40
|
+
# :detailed_http_logging => nil/$stdout/$stderr or File/Logger/IO object. Defaults to nil (recommended).
|
|
41
|
+
# *WARNING* : detailed_http_logging causes a serious security hole. Never use it in production code.
|
|
42
|
+
# :verify_mode => The verification mode to be used for Net::HTTP https connections. Defaults to OpenSSL::SSL::VERIFY_PEER
|
|
43
|
+
# :ca_path => The path to the certificates
|
|
43
44
|
def initialize(wrest_uri, http_request_klass, parameters = {}, body = nil, headers = {}, options = {})
|
|
44
45
|
@uri = wrest_uri
|
|
45
46
|
@headers = headers.stringify_keys
|
|
@@ -54,8 +55,9 @@ module Wrest::Native
|
|
|
54
55
|
@timeout = @options[:timeout]
|
|
55
56
|
@connection = @options[:connection]
|
|
56
57
|
@http_request = self.build_request(http_request_klass, @uri, @parameters, @headers)
|
|
57
|
-
@cache_store = options[:cache_store]
|
|
58
|
+
@cache_store = @options[:cache_store]
|
|
58
59
|
@verify_mode = @options[:verify_mode]
|
|
60
|
+
@ca_path = @options[:ca_path]
|
|
59
61
|
@detailed_http_logging = options[:detailed_http_logging]
|
|
60
62
|
@callback = @options[:callback] || Wrest::Callback.new({})
|
|
61
63
|
@callback = @callback.merge(Wrest::Callback.new(@options[:callback_block] || {}))
|
|
@@ -82,7 +84,7 @@ module Wrest::Native
|
|
|
82
84
|
# This is followed by the response code, the payload size and the time taken.
|
|
83
85
|
def invoke
|
|
84
86
|
response = nil
|
|
85
|
-
@connection ||= @uri.create_connection(
|
|
87
|
+
@connection ||= @uri.create_connection(:timeout => timeout, :verify_mode => verify_mode, :ca_path => ca_path)
|
|
86
88
|
@connection.set_debug_output @detailed_http_logging
|
|
87
89
|
http_request.basic_auth username, password unless username.nil? || password.nil?
|
|
88
90
|
|
data/lib/wrest/uri.rb
CHANGED
|
@@ -88,14 +88,6 @@ module Wrest #:nodoc:
|
|
|
88
88
|
uri_string
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
# Make a GET request to this URI. This is a convenience API
|
|
92
|
-
# that creates a Wrest::Native::Get, executes it and returns a Wrest::Native::Response.
|
|
93
|
-
#
|
|
94
|
-
# Remember to escape all parameter strings if necessary, using URI.escape
|
|
95
|
-
def get(parameters = {}, headers = {}, &block)
|
|
96
|
-
Http::Get.new(self, parameters, headers, block ? @options.merge(:callback_block => block) : @options).invoke
|
|
97
|
-
end
|
|
98
|
-
|
|
99
91
|
# Returns a Uri object that uses threads to perform asynchronous requests.
|
|
100
92
|
def using_threads
|
|
101
93
|
options = @options.clone
|
|
@@ -133,6 +125,14 @@ module Wrest #:nodoc:
|
|
|
133
125
|
Uri.new(uri_string, options)
|
|
134
126
|
end
|
|
135
127
|
|
|
128
|
+
# Make a GET request to this URI. This is a convenience API
|
|
129
|
+
# that creates a Wrest::Native::Get, executes it and returns a Wrest::Native::Response.
|
|
130
|
+
#
|
|
131
|
+
# Remember to escape all parameter strings if necessary, using URI.escape
|
|
132
|
+
def get(parameters = {}, headers = {}, &block)
|
|
133
|
+
Http::Get.new(self, parameters, headers, block ? @options.merge(:callback_block => block) : @options).invoke
|
|
134
|
+
end
|
|
135
|
+
|
|
136
136
|
# Make a GET request to this URI. This is a convenience API
|
|
137
137
|
# that creates a Wrest::Native::Get.
|
|
138
138
|
#
|
data/lib/wrest/version.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2009 Sidu Ponnappa
|
|
1
|
+
# Copyright 2009-2011 Sidu Ponnappa
|
|
2
2
|
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
# See the License for the specific language governing permissions and limitations under the License.
|
|
9
9
|
|
|
10
10
|
module Wrest
|
|
11
|
-
VERSION = "1.4.
|
|
11
|
+
VERSION = "1.4.1"
|
|
12
12
|
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: wrest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 1.4.
|
|
5
|
+
version: 1.4.1
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Sidu Ponnappa
|
|
@@ -11,7 +11,7 @@ autorequire:
|
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
|
|
14
|
-
date: 2011-
|
|
14
|
+
date: 2011-03-07 00:00:00 +05:30
|
|
15
15
|
default_executable:
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
@@ -25,94 +25,83 @@ dependencies:
|
|
|
25
25
|
version: "0"
|
|
26
26
|
type: :development
|
|
27
27
|
version_requirements: *id001
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: hanna
|
|
30
|
-
prerelease: false
|
|
31
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
|
32
|
-
none: false
|
|
33
|
-
requirements:
|
|
34
|
-
- - ">="
|
|
35
|
-
- !ruby/object:Gem::Version
|
|
36
|
-
version: "0"
|
|
37
|
-
type: :development
|
|
38
|
-
version_requirements: *id002
|
|
39
28
|
- !ruby/object:Gem::Dependency
|
|
40
29
|
name: rspec
|
|
41
30
|
prerelease: false
|
|
42
|
-
requirement: &
|
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
43
32
|
none: false
|
|
44
33
|
requirements:
|
|
45
34
|
- - ~>
|
|
46
35
|
- !ruby/object:Gem::Version
|
|
47
36
|
version: 2.4.0
|
|
48
37
|
type: :development
|
|
49
|
-
version_requirements: *
|
|
38
|
+
version_requirements: *id002
|
|
50
39
|
- !ruby/object:Gem::Dependency
|
|
51
40
|
name: sinatra
|
|
52
41
|
prerelease: false
|
|
53
|
-
requirement: &
|
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
54
43
|
none: false
|
|
55
44
|
requirements:
|
|
56
45
|
- - ~>
|
|
57
46
|
- !ruby/object:Gem::Version
|
|
58
47
|
version: 1.0.0
|
|
59
48
|
type: :development
|
|
60
|
-
version_requirements: *
|
|
49
|
+
version_requirements: *id003
|
|
61
50
|
- !ruby/object:Gem::Dependency
|
|
62
51
|
name: metric_fu
|
|
63
52
|
prerelease: false
|
|
64
|
-
requirement: &
|
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
65
54
|
none: false
|
|
66
55
|
requirements:
|
|
67
56
|
- - ">="
|
|
68
57
|
- !ruby/object:Gem::Version
|
|
69
58
|
version: "0"
|
|
70
59
|
type: :development
|
|
71
|
-
version_requirements: *
|
|
60
|
+
version_requirements: *id004
|
|
72
61
|
- !ruby/object:Gem::Dependency
|
|
73
62
|
name: activesupport
|
|
74
63
|
prerelease: false
|
|
75
|
-
requirement: &
|
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
76
65
|
none: false
|
|
77
66
|
requirements:
|
|
78
67
|
- - ~>
|
|
79
68
|
- !ruby/object:Gem::Version
|
|
80
69
|
version: 3.0.0
|
|
81
70
|
type: :runtime
|
|
82
|
-
version_requirements: *
|
|
71
|
+
version_requirements: *id005
|
|
83
72
|
- !ruby/object:Gem::Dependency
|
|
84
73
|
name: builder
|
|
85
74
|
prerelease: false
|
|
86
|
-
requirement: &
|
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
87
76
|
none: false
|
|
88
77
|
requirements:
|
|
89
78
|
- - ~>
|
|
90
79
|
- !ruby/object:Gem::Version
|
|
91
80
|
version: 2.1.2
|
|
92
81
|
type: :runtime
|
|
93
|
-
version_requirements: *
|
|
82
|
+
version_requirements: *id006
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
|
95
84
|
name: i18n
|
|
96
85
|
prerelease: false
|
|
97
|
-
requirement: &
|
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
|
98
87
|
none: false
|
|
99
88
|
requirements:
|
|
100
89
|
- - ">="
|
|
101
90
|
- !ruby/object:Gem::Version
|
|
102
91
|
version: 0.4.1
|
|
103
92
|
type: :runtime
|
|
104
|
-
version_requirements: *
|
|
93
|
+
version_requirements: *id007
|
|
105
94
|
- !ruby/object:Gem::Dependency
|
|
106
95
|
name: json
|
|
107
96
|
prerelease: false
|
|
108
|
-
requirement: &
|
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
|
109
98
|
none: false
|
|
110
99
|
requirements:
|
|
111
100
|
- - ~>
|
|
112
101
|
- !ruby/object:Gem::Version
|
|
113
102
|
version: 1.4.6
|
|
114
103
|
type: :runtime
|
|
115
|
-
version_requirements: *
|
|
104
|
+
version_requirements: *id008
|
|
116
105
|
description: Wrest is a fluent, easy-to-use, object oriented Ruby HTTP/REST client library with support for RFC2616 HTTP caching, multiple HTTP backends and async calls using EventMachine. It runs on CRuby, JRuby and Rubinius.
|
|
117
106
|
email:
|
|
118
107
|
- sidu@c42.in
|
|
@@ -124,7 +113,9 @@ extra_rdoc_files:
|
|
|
124
113
|
- README.rdoc
|
|
125
114
|
files:
|
|
126
115
|
- bin/wrest
|
|
116
|
+
- bin/wrest.compiled.rbc
|
|
127
117
|
- bin/wrest_shell.rb
|
|
118
|
+
- bin/wrest_shell.rbc
|
|
128
119
|
- lib/wrest/async_request/event_machine_backend.rb
|
|
129
120
|
- lib/wrest/async_request/thread_backend.rb
|
|
130
121
|
- lib/wrest/async_request.rb
|
|
@@ -227,7 +218,7 @@ requirements:
|
|
|
227
218
|
- To use curl as the http engine, install the 'patron' gem. This feature is not available (and should be unneccessary) on jruby.
|
|
228
219
|
- To use eventmachine as a parallel backend, install the 'eventmachine' gem.
|
|
229
220
|
rubyforge_project: wrest
|
|
230
|
-
rubygems_version: 1.
|
|
221
|
+
rubygems_version: 1.6.1
|
|
231
222
|
signing_key:
|
|
232
223
|
specification_version: 3
|
|
233
224
|
summary: Wrest is a fluent, object oriented HTTP client library for 1.8, 1.9, JRuby and Rubinius.
|