wrest 1.0.0.beta2-universal-java-1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/CHANGELOG +59 -0
  2. data/LICENCE +7 -0
  3. data/README.rdoc +127 -0
  4. data/bin/wrest +3 -0
  5. data/bin/wrest_shell.rb +21 -0
  6. data/lib/wrest.rb +101 -0
  7. data/lib/wrest.rbc +1900 -0
  8. data/lib/wrest/components.rb +20 -0
  9. data/lib/wrest/components.rbc +217 -0
  10. data/lib/wrest/components/container.rb +185 -0
  11. data/lib/wrest/components/container.rbc +2466 -0
  12. data/lib/wrest/components/container/alias_accessors.rb +66 -0
  13. data/lib/wrest/components/container/alias_accessors.rbc +905 -0
  14. data/lib/wrest/components/container/typecaster.rb +127 -0
  15. data/lib/wrest/components/container/typecaster.rbc +1985 -0
  16. data/lib/wrest/components/mutators.rb +39 -0
  17. data/lib/wrest/components/mutators.rbc +650 -0
  18. data/lib/wrest/components/mutators/base.rb +56 -0
  19. data/lib/wrest/components/mutators/base.rbc +702 -0
  20. data/lib/wrest/components/mutators/camel_to_snake_case.rb +22 -0
  21. data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
  22. data/lib/wrest/components/mutators/xml_mini_type_caster.rb +43 -0
  23. data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
  24. data/lib/wrest/components/mutators/xml_simple_type_caster.rb +37 -0
  25. data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
  26. data/lib/wrest/components/translators.rb +28 -0
  27. data/lib/wrest/components/translators.rbc +517 -0
  28. data/lib/wrest/components/translators/content_types.rb +20 -0
  29. data/lib/wrest/components/translators/content_types.rbc +339 -0
  30. data/lib/wrest/components/translators/json.rb +25 -0
  31. data/lib/wrest/components/translators/json.rbc +462 -0
  32. data/lib/wrest/components/translators/xml.rb +24 -0
  33. data/lib/wrest/components/translators/xml.rbc +457 -0
  34. data/lib/wrest/core_ext/hash.rb +5 -0
  35. data/lib/wrest/core_ext/hash.rbc +182 -0
  36. data/lib/wrest/core_ext/hash/conversions.rb +44 -0
  37. data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
  38. data/lib/wrest/core_ext/string.rb +5 -0
  39. data/lib/wrest/core_ext/string.rbc +182 -0
  40. data/lib/wrest/core_ext/string/conversions.rb +23 -0
  41. data/lib/wrest/core_ext/string/conversions.rbc +471 -0
  42. data/lib/wrest/curl.rb +49 -0
  43. data/lib/wrest/curl.rbc +704 -0
  44. data/lib/wrest/curl/delete.rb +23 -0
  45. data/lib/wrest/curl/get.rb +23 -0
  46. data/lib/wrest/curl/options.rb +16 -0
  47. data/lib/wrest/curl/post.rb +23 -0
  48. data/lib/wrest/curl/put.rb +23 -0
  49. data/lib/wrest/curl/request.rb +97 -0
  50. data/lib/wrest/curl/response.rb +71 -0
  51. data/lib/wrest/curl/session.rb +57 -0
  52. data/lib/wrest/exceptions.rb +33 -0
  53. data/lib/wrest/exceptions.rbc +312 -0
  54. data/lib/wrest/http_shared.rb +23 -0
  55. data/lib/wrest/http_shared.rbc +279 -0
  56. data/lib/wrest/http_shared/headers.rb +343 -0
  57. data/lib/wrest/http_shared/headers.rbc +353 -0
  58. data/lib/wrest/http_shared/standard_headers.rb +21 -0
  59. data/lib/wrest/http_shared/standard_headers.rbc +336 -0
  60. data/lib/wrest/http_shared/standard_tokens.rb +18 -0
  61. data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
  62. data/lib/wrest/multipart.rb +52 -0
  63. data/lib/wrest/native.rb +33 -0
  64. data/lib/wrest/native.rbc +513 -0
  65. data/lib/wrest/native/connection_factory.rb +23 -0
  66. data/lib/wrest/native/connection_factory.rbc +445 -0
  67. data/lib/wrest/native/delete.rb +23 -0
  68. data/lib/wrest/native/delete.rbc +371 -0
  69. data/lib/wrest/native/get.rb +51 -0
  70. data/lib/wrest/native/get.rbc +855 -0
  71. data/lib/wrest/native/options.rb +23 -0
  72. data/lib/wrest/native/options.rbc +347 -0
  73. data/lib/wrest/native/post.rb +23 -0
  74. data/lib/wrest/native/post.rbc +388 -0
  75. data/lib/wrest/native/post_multipart.rb +32 -0
  76. data/lib/wrest/native/put.rb +23 -0
  77. data/lib/wrest/native/put.rbc +388 -0
  78. data/lib/wrest/native/put_multipart.rb +32 -0
  79. data/lib/wrest/native/redirection.rb +38 -0
  80. data/lib/wrest/native/redirection.rbc +520 -0
  81. data/lib/wrest/native/request.rb +94 -0
  82. data/lib/wrest/native/request.rbc +1675 -0
  83. data/lib/wrest/native/response.rb +120 -0
  84. data/lib/wrest/native/response.rbc +2150 -0
  85. data/lib/wrest/native/session.rb +57 -0
  86. data/lib/wrest/native/session.rbc +1372 -0
  87. data/lib/wrest/resource.rb +18 -0
  88. data/lib/wrest/resource.rbc +163 -0
  89. data/lib/wrest/resource/base.rb +99 -0
  90. data/lib/wrest/resource/base.rbc +2115 -0
  91. data/lib/wrest/resource/collection.rb +12 -0
  92. data/lib/wrest/resource/state.rb +6 -0
  93. data/lib/wrest/test.rb +1 -0
  94. data/lib/wrest/test/request_patches.rb +5 -0
  95. data/lib/wrest/uri.rb +160 -0
  96. data/lib/wrest/uri.rbc +2599 -0
  97. data/lib/wrest/uri_template.rb +49 -0
  98. data/lib/wrest/uri_template.rbc +505 -0
  99. data/lib/wrest/version.rb +23 -0
  100. data/lib/wrest/version.rbc +372 -0
  101. metadata +231 -0
data/lib/wrest/curl.rb ADDED
@@ -0,0 +1,49 @@
1
+ # Copyright 2009 Sidu Ponnappa
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ # Unless required by applicable law or agreed to in writing, software distributed under the License
7
+ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
+ # See the License for the specific language governing permissions and limitations under the License.
9
+
10
+ begin
11
+ gem 'patron', '>=0.4.4'
12
+ rescue Gem::LoadError => e
13
+ Wrest.logger.debug "Patron >= 0.4.4 not found. Patron is necessary to use libcurl. To install Patron run `sudo gem install patron` (patron is not available on JRuby, but you shouldn't need it anyway)."
14
+ raise e
15
+ end
16
+ require 'patron'
17
+
18
+ module Wrest
19
+ # Contains all HTTP protocol related classes such as
20
+ # Get, Post, Request, Response etc. and uses Curl for
21
+ # better performance, but works only on CRuby and only on a *nix OS.
22
+ #
23
+ # This functionality is under development and the Wrest API
24
+ # may not cover using it fully.
25
+ #
26
+ # Note:
27
+ # * The Curl based APIs do *not* support the HTTP 'options' verb.
28
+ # * Since auto-redirect is natively supported by Curl, auto-redirect may
29
+ # behave differently from the native implementation for now.
30
+ module Curl
31
+ include Wrest::HttpShared
32
+ end
33
+ end
34
+
35
+ module Patron #:nodoc:
36
+ # Patching Patron::Session#handle_request to make it public.
37
+ class Session
38
+ public :handle_request
39
+ end
40
+ end
41
+
42
+ require "#{Wrest::Root}/wrest/curl/response"
43
+ require "#{Wrest::Root}/wrest/curl/request"
44
+ require "#{Wrest::Root}/wrest/curl/get"
45
+ require "#{Wrest::Root}/wrest/curl/put"
46
+ require "#{Wrest::Root}/wrest/curl/post"
47
+ require "#{Wrest::Root}/wrest/curl/delete"
48
+ require "#{Wrest::Root}/wrest/curl/options"
49
+ # require "#{Wrest::Root}/wrest/curl/session"
@@ -0,0 +1,704 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 273
13
+ 26
14
+ 93
15
+ 0
16
+ 15
17
+ 29
18
+ 21
19
+ 0
20
+ 5
21
+ 7
22
+ 0
23
+ 64
24
+ 7
25
+ 1
26
+ 64
27
+ 47
28
+ 49
29
+ 2
30
+ 2
31
+ 30
32
+ 8
33
+ 73
34
+ 26
35
+ 93
36
+ 1
37
+ 15
38
+ 24
39
+ 13
40
+ 45
41
+ 3
42
+ 4
43
+ 43
44
+ 5
45
+ 12
46
+ 49
47
+ 6
48
+ 1
49
+ 10
50
+ 40
51
+ 8
52
+ 68
53
+ 15
54
+ 24
55
+ 19
56
+ 0
57
+ 15
58
+ 45
59
+ 7
60
+ 8
61
+ 49
62
+ 9
63
+ 0
64
+ 7
65
+ 10
66
+ 64
67
+ 49
68
+ 11
69
+ 1
70
+ 15
71
+ 5
72
+ 20
73
+ 0
74
+ 47
75
+ 49
76
+ 12
77
+ 1
78
+ 25
79
+ 8
80
+ 73
81
+ 15
82
+ 92
83
+ 1
84
+ 27
85
+ 34
86
+ 92
87
+ 0
88
+ 27
89
+ 15
90
+ 5
91
+ 7
92
+ 0
93
+ 64
94
+ 47
95
+ 49
96
+ 13
97
+ 1
98
+ 15
99
+ 99
100
+ 7
101
+ 7
102
+ 65
103
+ 49
104
+ 14
105
+ 2
106
+ 13
107
+ 99
108
+ 12
109
+ 7
110
+ 15
111
+ 12
112
+ 7
113
+ 16
114
+ 12
115
+ 65
116
+ 12
117
+ 49
118
+ 17
119
+ 4
120
+ 15
121
+ 49
122
+ 15
123
+ 0
124
+ 15
125
+ 99
126
+ 7
127
+ 18
128
+ 65
129
+ 49
130
+ 14
131
+ 2
132
+ 13
133
+ 99
134
+ 12
135
+ 7
136
+ 15
137
+ 12
138
+ 7
139
+ 19
140
+ 12
141
+ 65
142
+ 12
143
+ 49
144
+ 17
145
+ 4
146
+ 15
147
+ 49
148
+ 15
149
+ 0
150
+ 15
151
+ 5
152
+ 45
153
+ 7
154
+ 20
155
+ 43
156
+ 21
157
+ 47
158
+ 49
159
+ 22
160
+ 0
161
+ 7
162
+ 23
163
+ 63
164
+ 2
165
+ 47
166
+ 49
167
+ 13
168
+ 1
169
+ 15
170
+ 5
171
+ 45
172
+ 7
173
+ 24
174
+ 43
175
+ 21
176
+ 47
177
+ 49
178
+ 22
179
+ 0
180
+ 7
181
+ 25
182
+ 63
183
+ 2
184
+ 47
185
+ 49
186
+ 13
187
+ 1
188
+ 15
189
+ 5
190
+ 45
191
+ 7
192
+ 26
193
+ 43
194
+ 21
195
+ 47
196
+ 49
197
+ 22
198
+ 0
199
+ 7
200
+ 27
201
+ 63
202
+ 2
203
+ 47
204
+ 49
205
+ 13
206
+ 1
207
+ 15
208
+ 5
209
+ 45
210
+ 7
211
+ 28
212
+ 43
213
+ 21
214
+ 47
215
+ 49
216
+ 22
217
+ 0
218
+ 7
219
+ 29
220
+ 63
221
+ 2
222
+ 47
223
+ 49
224
+ 13
225
+ 1
226
+ 15
227
+ 5
228
+ 45
229
+ 7
230
+ 30
231
+ 43
232
+ 21
233
+ 47
234
+ 49
235
+ 22
236
+ 0
237
+ 7
238
+ 31
239
+ 63
240
+ 2
241
+ 47
242
+ 49
243
+ 13
244
+ 1
245
+ 15
246
+ 5
247
+ 45
248
+ 7
249
+ 32
250
+ 43
251
+ 21
252
+ 47
253
+ 49
254
+ 22
255
+ 0
256
+ 7
257
+ 33
258
+ 63
259
+ 2
260
+ 47
261
+ 49
262
+ 13
263
+ 1
264
+ 15
265
+ 5
266
+ 45
267
+ 7
268
+ 34
269
+ 43
270
+ 21
271
+ 47
272
+ 49
273
+ 22
274
+ 0
275
+ 7
276
+ 35
277
+ 63
278
+ 2
279
+ 47
280
+ 49
281
+ 13
282
+ 1
283
+ 15
284
+ 2
285
+ 11
286
+ I
287
+ 9
288
+ I
289
+ 1
290
+ I
291
+ 0
292
+ I
293
+ 0
294
+ n
295
+ p
296
+ 36
297
+ s
298
+ 6
299
+ patron
300
+ s
301
+ 7
302
+ >=0.4.4
303
+ x
304
+ 3
305
+ gem
306
+ x
307
+ 3
308
+ Gem
309
+ n
310
+ x
311
+ 9
312
+ LoadError
313
+ x
314
+ 3
315
+ ===
316
+ x
317
+ 5
318
+ Wrest
319
+ n
320
+ x
321
+ 6
322
+ logger
323
+ s
324
+ 180
325
+ Patron >= 0.4.4 not found. Patron is necessary to use libcurl. To install Patron run `sudo gem install patron` (patron is not available on JRuby, but you shouldn't need it anyway).
326
+ x
327
+ 5
328
+ debug
329
+ x
330
+ 5
331
+ raise
332
+ x
333
+ 7
334
+ require
335
+ x
336
+ 11
337
+ open_module
338
+ x
339
+ 15
340
+ __module_init__
341
+ M
342
+ 1
343
+ n
344
+ n
345
+ x
346
+ 5
347
+ Wrest
348
+ i
349
+ 28
350
+ 5
351
+ 66
352
+ 99
353
+ 7
354
+ 0
355
+ 65
356
+ 49
357
+ 1
358
+ 2
359
+ 13
360
+ 99
361
+ 12
362
+ 7
363
+ 2
364
+ 12
365
+ 7
366
+ 3
367
+ 12
368
+ 65
369
+ 12
370
+ 49
371
+ 4
372
+ 4
373
+ 15
374
+ 49
375
+ 2
376
+ 0
377
+ 11
378
+ I
379
+ 6
380
+ I
381
+ 0
382
+ I
383
+ 0
384
+ I
385
+ 0
386
+ n
387
+ p
388
+ 5
389
+ x
390
+ 4
391
+ Curl
392
+ x
393
+ 11
394
+ open_module
395
+ x
396
+ 15
397
+ __module_init__
398
+ M
399
+ 1
400
+ n
401
+ n
402
+ x
403
+ 4
404
+ Curl
405
+ i
406
+ 13
407
+ 5
408
+ 66
409
+ 5
410
+ 45
411
+ 0
412
+ 1
413
+ 43
414
+ 2
415
+ 47
416
+ 49
417
+ 3
418
+ 1
419
+ 11
420
+ I
421
+ 2
422
+ I
423
+ 0
424
+ I
425
+ 0
426
+ I
427
+ 0
428
+ n
429
+ p
430
+ 4
431
+ x
432
+ 5
433
+ Wrest
434
+ n
435
+ x
436
+ 10
437
+ HttpShared
438
+ x
439
+ 7
440
+ include
441
+ p
442
+ 3
443
+ I
444
+ 2
445
+ I
446
+ 1f
447
+ I
448
+ d
449
+ x
450
+ 40
451
+ /Users/sidu/Work/wrest/lib/wrest/curl.rb
452
+ p
453
+ 0
454
+ x
455
+ 13
456
+ attach_method
457
+ p
458
+ 3
459
+ I
460
+ 2
461
+ I
462
+ 1e
463
+ I
464
+ 1c
465
+ x
466
+ 40
467
+ /Users/sidu/Work/wrest/lib/wrest/curl.rb
468
+ p
469
+ 0
470
+ x
471
+ 13
472
+ attach_method
473
+ x
474
+ 6
475
+ Patron
476
+ M
477
+ 1
478
+ n
479
+ n
480
+ x
481
+ 6
482
+ Patron
483
+ i
484
+ 29
485
+ 5
486
+ 66
487
+ 99
488
+ 7
489
+ 0
490
+ 1
491
+ 65
492
+ 49
493
+ 1
494
+ 3
495
+ 13
496
+ 99
497
+ 12
498
+ 7
499
+ 2
500
+ 12
501
+ 7
502
+ 3
503
+ 12
504
+ 65
505
+ 12
506
+ 49
507
+ 4
508
+ 4
509
+ 15
510
+ 49
511
+ 2
512
+ 0
513
+ 11
514
+ I
515
+ 6
516
+ I
517
+ 0
518
+ I
519
+ 0
520
+ I
521
+ 0
522
+ n
523
+ p
524
+ 5
525
+ x
526
+ 7
527
+ Session
528
+ x
529
+ 10
530
+ open_class
531
+ x
532
+ 14
533
+ __class_init__
534
+ M
535
+ 1
536
+ n
537
+ n
538
+ x
539
+ 7
540
+ Session
541
+ i
542
+ 10
543
+ 5
544
+ 66
545
+ 5
546
+ 7
547
+ 0
548
+ 47
549
+ 49
550
+ 1
551
+ 1
552
+ 11
553
+ I
554
+ 2
555
+ I
556
+ 0
557
+ I
558
+ 0
559
+ I
560
+ 0
561
+ n
562
+ p
563
+ 2
564
+ x
565
+ 14
566
+ handle_request
567
+ x
568
+ 6
569
+ public
570
+ p
571
+ 3
572
+ I
573
+ 2
574
+ I
575
+ 26
576
+ I
577
+ a
578
+ x
579
+ 40
580
+ /Users/sidu/Work/wrest/lib/wrest/curl.rb
581
+ p
582
+ 0
583
+ x
584
+ 13
585
+ attach_method
586
+ p
587
+ 3
588
+ I
589
+ 2
590
+ I
591
+ 25
592
+ I
593
+ 1d
594
+ x
595
+ 40
596
+ /Users/sidu/Work/wrest/lib/wrest/curl.rb
597
+ p
598
+ 0
599
+ n
600
+ x
601
+ 4
602
+ Root
603
+ x
604
+ 4
605
+ to_s
606
+ s
607
+ 20
608
+ /wrest/curl/response
609
+ n
610
+ s
611
+ 19
612
+ /wrest/curl/request
613
+ n
614
+ s
615
+ 15
616
+ /wrest/curl/get
617
+ n
618
+ s
619
+ 15
620
+ /wrest/curl/put
621
+ n
622
+ s
623
+ 16
624
+ /wrest/curl/post
625
+ n
626
+ s
627
+ 18
628
+ /wrest/curl/delete
629
+ n
630
+ s
631
+ 19
632
+ /wrest/curl/options
633
+ p
634
+ 31
635
+ I
636
+ 0
637
+ I
638
+ b
639
+ I
640
+ 1a
641
+ I
642
+ c
643
+ I
644
+ 29
645
+ I
646
+ f
647
+ I
648
+ 2d
649
+ I
650
+ d
651
+ I
652
+ 3a
653
+ I
654
+ e
655
+ I
656
+ 4d
657
+ I
658
+ 10
659
+ I
660
+ 56
661
+ I
662
+ 12
663
+ I
664
+ 70
665
+ I
666
+ 23
667
+ I
668
+ 8a
669
+ I
670
+ 2a
671
+ I
672
+ 9d
673
+ I
674
+ 2b
675
+ I
676
+ b0
677
+ I
678
+ 2c
679
+ I
680
+ c3
681
+ I
682
+ 2d
683
+ I
684
+ d6
685
+ I
686
+ 2e
687
+ I
688
+ e9
689
+ I
690
+ 2f
691
+ I
692
+ fc
693
+ I
694
+ 30
695
+ I
696
+ 111
697
+ x
698
+ 40
699
+ /Users/sidu/Work/wrest/lib/wrest/curl.rb
700
+ p
701
+ 1
702
+ x
703
+ 1
704
+ e