wrest 1.0.2-universal-java-1.6 → 1.1.0-universal-java-1.6

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 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.1
6
+ * Caching support introduced. Includes Memcached support for the cache store. (GH# 69, 83, 87)
7
+
5
8
  == 1.0.2
6
9
  * GH#12 Post Multipart support when using the Patron adapter
7
10
  * GH#72 Response code checkers: ok?, redirect?, created? etc.
data/README.rdoc CHANGED
@@ -1,14 +1,14 @@
1
- = Wrest 1.0.2
1
+ = Wrest 1.1.0
2
2
 
3
- (c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
3
+ (c) Copyright 2009-2011 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
4
4
 
5
5
  Wrest is a ruby REST/HTTP client library which
6
6
 
7
7
  * Allows you to quickly build object oriented wrappers around any web service
8
8
  * Designed to be used as a library, not just a command line REST client (fewer class/static methods, more object oriented)
9
9
  * Is spec driven, strongly favours immutable objects and avoids class methods and setters making it better suited for use as a library, especially in multi-threaded environments
10
- * Runs on Ruby 1.8, Ruby 1.9.2, JRuby and Rubinius with MacRuby and IronRuby support on the way
11
- * Provides convenient HTTP wrappers, redirect handling, serialisation and deserialisation with response caching in the works
10
+ * Runs on Ruby 1.8, Ruby 1.9.2, JRuby and Rubinius with MacRuby and IronRuby support on the way ({Continuous Integration server}[http://ci.c42.in])
11
+ * Provides convenient HTTP wrappers, redirect handling, serialisation, deserialisation and response {caching}[https://github.com/kaiwren/wrest/blob/caching/Caching.markdown]
12
12
  * Supports using either Net::HTTP or libcurl as the underlying HTTP library
13
13
 
14
14
  To receive notifications whenever new features are added to Wrest, please subscribe to my {twitter feed}[http://twitter.com/ponnappa].
@@ -36,7 +36,7 @@ For Facebook, Twitter, Delicious, GitHub and other API examples, see http://gith
36
36
  'http://google.com'.to_uri(:follow_redirects_limit => 1).get
37
37
 
38
38
  :follow_redirects_limit defaults to 5 if not specified.
39
-
39
+
40
40
  * Deserialise with XPath filtering
41
41
 
42
42
  ActiveSupport::XmlMini.backend = 'REXML'
@@ -101,6 +101,31 @@ To find out what actions are permitted on a URI:
101
101
 
102
102
  'http://www.yahoo.com'.to_uri.options.headers['allow']
103
103
 
104
+ ==== Caching
105
+
106
+ Wrest supports caching with pluggable back-ends.
107
+
108
+ Wrest.always_cache_using_hash! # Hash should NEVER be used in a production environment. It is unbounded and will keep increasing in size.
109
+ c42 = "http://c42.in".to_uri.get
110
+
111
+ A Memcached based caching back-end is available in Wrest. You can get instructions on how to install Memcached on your system {here}[http://code.google.com/p/memcached/wiki/NewInstallFromPackage].
112
+ The Dalli gem is used by Wrest to interface with Memcached. Install dalli using 'gem install dalli'.
113
+
114
+ Use the following method to enable caching for all requests, and set Memcached as the default back-end.
115
+
116
+ Wrest.always_cache_using_memcached!
117
+
118
+ For fine-grained control over the cache store (or to use multiple cache stores in the same codebase), you can use this API:
119
+ memcache_store = Wrest::Components::CacheStore::Memcached.new("localhost:11211")
120
+ hash_store = {}
121
+
122
+ r1 = "http://c42.in".to_uri(:cache_store => memcache_store).get
123
+ r2 = "http://c42.in".to_uri(:cache_store => hash_store).get
124
+
125
+ A detailed writeup regarding caching as defined by RFC 2616, and how Wrest implements caching is at {Wrest Caching Doc}[https://github.com/kaiwren/wrest/blob/master/Caching.markdown]
126
+
127
+ You can create your own back-ends for Wrest caching by implementing the interface implemented in https://github.com/kaiwren/wrest/blob/master/lib/wrest/components/cache_store/memcached.rb
128
+
104
129
  ==== Callbacks
105
130
 
106
131
  You can define a set of callbacks that are invoked based on the http code of the response.
@@ -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
+ 31
76
+ /home/jasim/C42/wrest/bin/wrest
77
+ p
78
+ 0
data/bin/wrest_shell.rb CHANGED
@@ -17,5 +17,5 @@ libs = " -r irb/completion"
17
17
  libs << " -r #{entry_point}"
18
18
 
19
19
  require version
20
- puts "Loading Wrest #{Wrest::VERSION::STRING}"
20
+ puts "Loading Wrest #{Wrest::VERSION}"
21
21
  exec "#{options[:irb]} #{libs} --simple-prompt"
@@ -0,0 +1,659 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 245
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
+ 45
52
+ 10
53
+ 12
54
+ 65
55
+ 49
56
+ 13
57
+ 0
58
+ 49
59
+ 14
60
+ 1
61
+ 47
62
+ 49
63
+ 3
64
+ 0
65
+ 7
66
+ 15
67
+ 63
68
+ 2
69
+ 49
70
+ 16
71
+ 1
72
+ 19
73
+ 0
74
+ 15
75
+ 45
76
+ 10
77
+ 17
78
+ 45
79
+ 10
80
+ 18
81
+ 65
82
+ 49
83
+ 13
84
+ 0
85
+ 49
86
+ 14
87
+ 1
88
+ 47
89
+ 49
90
+ 3
91
+ 0
92
+ 7
93
+ 19
94
+ 63
95
+ 2
96
+ 49
97
+ 16
98
+ 1
99
+ 19
100
+ 1
101
+ 15
102
+ 45
103
+ 7
104
+ 20
105
+ 7
106
+ 21
107
+ 13
108
+ 70
109
+ 9
110
+ 110
111
+ 15
112
+ 44
113
+ 43
114
+ 22
115
+ 7
116
+ 23
117
+ 78
118
+ 49
119
+ 24
120
+ 2
121
+ 6
122
+ 21
123
+ 49
124
+ 25
125
+ 1
126
+ 9
127
+ 120
128
+ 7
129
+ 26
130
+ 64
131
+ 8
132
+ 123
133
+ 7
134
+ 27
135
+ 64
136
+ 19
137
+ 2
138
+ 15
139
+ 5
140
+ 7
141
+ 28
142
+ 64
143
+ 47
144
+ 49
145
+ 29
146
+ 1
147
+ 15
148
+ 44
149
+ 43
150
+ 30
151
+ 79
152
+ 49
153
+ 31
154
+ 1
155
+ 13
156
+ 7
157
+ 32
158
+ 20
159
+ 2
160
+ 49
161
+ 33
162
+ 2
163
+ 15
164
+ 19
165
+ 3
166
+ 15
167
+ 45
168
+ 34
169
+ 35
170
+ 56
171
+ 36
172
+ 50
173
+ 24
174
+ 0
175
+ 15
176
+ 7
177
+ 37
178
+ 64
179
+ 19
180
+ 4
181
+ 15
182
+ 20
183
+ 4
184
+ 7
185
+ 38
186
+ 20
187
+ 0
188
+ 47
189
+ 49
190
+ 3
191
+ 0
192
+ 63
193
+ 2
194
+ 49
195
+ 39
196
+ 1
197
+ 15
198
+ 5
199
+ 20
200
+ 1
201
+ 47
202
+ 49
203
+ 29
204
+ 1
205
+ 15
206
+ 5
207
+ 7
208
+ 40
209
+ 45
210
+ 41
211
+ 42
212
+ 43
213
+ 43
214
+ 43
215
+ 44
216
+ 47
217
+ 49
218
+ 3
219
+ 0
220
+ 63
221
+ 2
222
+ 47
223
+ 49
224
+ 9
225
+ 1
226
+ 15
227
+ 5
228
+ 20
229
+ 3
230
+ 7
231
+ 32
232
+ 49
233
+ 45
234
+ 1
235
+ 47
236
+ 49
237
+ 3
238
+ 0
239
+ 7
240
+ 46
241
+ 20
242
+ 4
243
+ 47
244
+ 49
245
+ 3
246
+ 0
247
+ 7
248
+ 47
249
+ 63
250
+ 4
251
+ 47
252
+ 49
253
+ 48
254
+ 1
255
+ 15
256
+ 2
257
+ 11
258
+ I
259
+ c
260
+ I
261
+ 5
262
+ I
263
+ 0
264
+ I
265
+ 0
266
+ n
267
+ p
268
+ 49
269
+ s
270
+ 5
271
+ Ruby
272
+ x
273
+ 12
274
+ RUBY_VERSION
275
+ n
276
+ x
277
+ 4
278
+ to_s
279
+ s
280
+ 2
281
+ ,
282
+ x
283
+ 17
284
+ RUBY_RELEASE_DATE
285
+ n
286
+ x
287
+ 13
288
+ RUBY_PLATFORM
289
+ n
290
+ x
291
+ 4
292
+ puts
293
+ x
294
+ 4
295
+ File
296
+ n
297
+ n
298
+ x
299
+ 11
300
+ active_path
301
+ x
302
+ 7
303
+ dirname
304
+ s
305
+ 16
306
+ /../lib/wrest.rb
307
+ x
308
+ 11
309
+ expand_path
310
+ n
311
+ n
312
+ s
313
+ 24
314
+ /../lib/wrest/version.rb
315
+ n
316
+ n
317
+ x
318
+ 6
319
+ Regexp
320
+ s
321
+ 15
322
+ (:?mswin|mingw)
323
+ x
324
+ 3
325
+ new
326
+ x
327
+ 2
328
+ =~
329
+ s
330
+ 7
331
+ irb.bat
332
+ s
333
+ 3
334
+ irb
335
+ s
336
+ 8
337
+ optparse
338
+ x
339
+ 7
340
+ require
341
+ x
342
+ 4
343
+ Hash
344
+ x
345
+ 16
346
+ new_from_literal
347
+ x
348
+ 3
349
+ irb
350
+ x
351
+ 3
352
+ []=
353
+ x
354
+ 12
355
+ OptionParser
356
+ n
357
+ M
358
+ 1
359
+ p
360
+ 2
361
+ x
362
+ 9
363
+ for_block
364
+ t
365
+ n
366
+ x
367
+ 9
368
+ __block__
369
+ i
370
+ 50
371
+ 57
372
+ 19
373
+ 0
374
+ 15
375
+ 20
376
+ 0
377
+ 7
378
+ 0
379
+ 64
380
+ 13
381
+ 18
382
+ 2
383
+ 49
384
+ 1
385
+ 1
386
+ 15
387
+ 15
388
+ 20
389
+ 0
390
+ 7
391
+ 2
392
+ 21
393
+ 1
394
+ 2
395
+ 47
396
+ 49
397
+ 3
398
+ 0
399
+ 7
400
+ 4
401
+ 63
402
+ 3
403
+ 7
404
+ 5
405
+ 64
406
+ 56
407
+ 6
408
+ 50
409
+ 7
410
+ 2
411
+ 15
412
+ 20
413
+ 0
414
+ 45
415
+ 8
416
+ 9
417
+ 49
418
+ 10
419
+ 1
420
+ 11
421
+ I
422
+ 6
423
+ I
424
+ 1
425
+ I
426
+ 1
427
+ I
428
+ 1
429
+ n
430
+ p
431
+ 11
432
+ s
433
+ 24
434
+ Usage: console [options]
435
+ x
436
+ 7
437
+ banner=
438
+ s
439
+ 7
440
+ --irb=[
441
+ x
442
+ 4
443
+ to_s
444
+ s
445
+ 1
446
+ ]
447
+ s
448
+ 23
449
+ Invoke a different irb.
450
+ M
451
+ 1
452
+ p
453
+ 2
454
+ x
455
+ 9
456
+ for_block
457
+ t
458
+ n
459
+ x
460
+ 9
461
+ __block__
462
+ i
463
+ 19
464
+ 57
465
+ 19
466
+ 0
467
+ 15
468
+ 21
469
+ 2
470
+ 3
471
+ 7
472
+ 0
473
+ 20
474
+ 0
475
+ 13
476
+ 18
477
+ 3
478
+ 49
479
+ 1
480
+ 2
481
+ 15
482
+ 11
483
+ I
484
+ 6
485
+ I
486
+ 1
487
+ I
488
+ 1
489
+ I
490
+ 1
491
+ n
492
+ p
493
+ 2
494
+ x
495
+ 3
496
+ irb
497
+ x
498
+ 3
499
+ []=
500
+ p
501
+ 3
502
+ I
503
+ 0
504
+ I
505
+ c
506
+ I
507
+ 13
508
+ x
509
+ 40
510
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
511
+ p
512
+ 1
513
+ x
514
+ 1
515
+ v
516
+ x
517
+ 2
518
+ on
519
+ x
520
+ 4
521
+ ARGV
522
+ n
523
+ x
524
+ 6
525
+ parse!
526
+ p
527
+ 9
528
+ I
529
+ 0
530
+ I
531
+ a
532
+ I
533
+ 4
534
+ I
535
+ b
536
+ I
537
+ 11
538
+ I
539
+ c
540
+ I
541
+ 29
542
+ I
543
+ d
544
+ I
545
+ 32
546
+ x
547
+ 40
548
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
549
+ p
550
+ 1
551
+ x
552
+ 3
553
+ opt
554
+ s
555
+ 18
556
+ -r irb/completion
557
+ s
558
+ 4
559
+ -r
560
+ x
561
+ 2
562
+ <<
563
+ s
564
+ 14
565
+ Loading Wrest
566
+ x
567
+ 5
568
+ Wrest
569
+ n
570
+ x
571
+ 7
572
+ VERSION
573
+ x
574
+ 6
575
+ STRING
576
+ x
577
+ 2
578
+ []
579
+ s
580
+ 1
581
+
582
+ s
583
+ 16
584
+ --simple-prompt
585
+ x
586
+ 4
587
+ exec
588
+ p
589
+ 25
590
+ I
591
+ 0
592
+ I
593
+ 1
594
+ I
595
+ 23
596
+ I
597
+ 3
598
+ I
599
+ 3e
600
+ I
601
+ 4
602
+ I
603
+ 59
604
+ I
605
+ 6
606
+ I
607
+ 7e
608
+ I
609
+ 8
610
+ I
611
+ 87
612
+ I
613
+ 9
614
+ I
615
+ 9a
616
+ I
617
+ a
618
+ I
619
+ a3
620
+ I
621
+ 10
622
+ I
623
+ a9
624
+ I
625
+ 11
626
+ I
627
+ b9
628
+ I
629
+ 13
630
+ I
631
+ c1
632
+ I
633
+ 14
634
+ I
635
+ d6
636
+ I
637
+ 15
638
+ I
639
+ f5
640
+ x
641
+ 40
642
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
643
+ p
644
+ 5
645
+ x
646
+ 11
647
+ entry_point
648
+ x
649
+ 7
650
+ version
651
+ x
652
+ 3
653
+ irb
654
+ x
655
+ 7
656
+ options
657
+ x
658
+ 4
659
+ libs