wrest 1.0.0.beta2-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.
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
@@ -0,0 +1,38 @@
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
+ module Wrest #:nodoc:
11
+ module Native #:nodoc:
12
+ # Constructed by Wrest::Response.new if the HTTP response code is 3xx
13
+ # (http://en.wikipedia.org/wiki/300_Multiple_Choices#3xx_Redirection)
14
+ #
15
+ # This class is necessary because Net::HTTP doesn't seem to support
16
+ # redirection natively.
17
+ class Redirection < Response
18
+
19
+ # A get is invoked on the url stored in the response headers
20
+ # under the key 'location' and the new Response is returned.
21
+ #
22
+ # The follow_redirects_count and follow_redirects_limit options
23
+ # should be present. follow_redirects_count will be incremented by 1.
24
+ #
25
+ # This method will raise a Wrest::Exceptions::AutoRedirectLimitExceeded
26
+ # if the follow_redirects_count equals the follow_redirects_limit.
27
+ def follow(redirect_request_options = {})
28
+ target = self['location']
29
+ redirect_request_options = redirect_request_options.clone
30
+
31
+ raise Wrest::Exceptions::AutoRedirectLimitExceeded if (redirect_request_options[:follow_redirects_count] += 1) >= redirect_request_options[:follow_redirects_limit]
32
+
33
+ Wrest.logger.debug "--| Redirecting to #{target}"
34
+ target.to_uri(redirect_request_options).get
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,520 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 28
13
+ 99
14
+ 7
15
+ 0
16
+ 65
17
+ 49
18
+ 1
19
+ 2
20
+ 13
21
+ 99
22
+ 12
23
+ 7
24
+ 2
25
+ 12
26
+ 7
27
+ 3
28
+ 12
29
+ 65
30
+ 12
31
+ 49
32
+ 4
33
+ 4
34
+ 15
35
+ 49
36
+ 2
37
+ 0
38
+ 15
39
+ 2
40
+ 11
41
+ I
42
+ 6
43
+ I
44
+ 0
45
+ I
46
+ 0
47
+ I
48
+ 0
49
+ n
50
+ p
51
+ 5
52
+ x
53
+ 5
54
+ Wrest
55
+ x
56
+ 11
57
+ open_module
58
+ x
59
+ 15
60
+ __module_init__
61
+ M
62
+ 1
63
+ n
64
+ n
65
+ x
66
+ 5
67
+ Wrest
68
+ i
69
+ 28
70
+ 5
71
+ 66
72
+ 99
73
+ 7
74
+ 0
75
+ 65
76
+ 49
77
+ 1
78
+ 2
79
+ 13
80
+ 99
81
+ 12
82
+ 7
83
+ 2
84
+ 12
85
+ 7
86
+ 3
87
+ 12
88
+ 65
89
+ 12
90
+ 49
91
+ 4
92
+ 4
93
+ 15
94
+ 49
95
+ 2
96
+ 0
97
+ 11
98
+ I
99
+ 6
100
+ I
101
+ 0
102
+ I
103
+ 0
104
+ I
105
+ 0
106
+ n
107
+ p
108
+ 5
109
+ x
110
+ 6
111
+ Native
112
+ x
113
+ 11
114
+ open_module
115
+ x
116
+ 15
117
+ __module_init__
118
+ M
119
+ 1
120
+ n
121
+ n
122
+ x
123
+ 6
124
+ Native
125
+ i
126
+ 31
127
+ 5
128
+ 66
129
+ 99
130
+ 7
131
+ 0
132
+ 45
133
+ 1
134
+ 2
135
+ 65
136
+ 49
137
+ 3
138
+ 3
139
+ 13
140
+ 99
141
+ 12
142
+ 7
143
+ 4
144
+ 12
145
+ 7
146
+ 5
147
+ 12
148
+ 65
149
+ 12
150
+ 49
151
+ 6
152
+ 4
153
+ 15
154
+ 49
155
+ 4
156
+ 0
157
+ 11
158
+ I
159
+ 6
160
+ I
161
+ 0
162
+ I
163
+ 0
164
+ I
165
+ 0
166
+ n
167
+ p
168
+ 7
169
+ x
170
+ 11
171
+ Redirection
172
+ x
173
+ 8
174
+ Response
175
+ n
176
+ x
177
+ 10
178
+ open_class
179
+ x
180
+ 14
181
+ __class_init__
182
+ M
183
+ 1
184
+ n
185
+ n
186
+ x
187
+ 11
188
+ Redirection
189
+ i
190
+ 16
191
+ 5
192
+ 66
193
+ 99
194
+ 7
195
+ 0
196
+ 7
197
+ 1
198
+ 65
199
+ 67
200
+ 49
201
+ 2
202
+ 0
203
+ 49
204
+ 3
205
+ 4
206
+ 11
207
+ I
208
+ 5
209
+ I
210
+ 0
211
+ I
212
+ 0
213
+ I
214
+ 0
215
+ n
216
+ p
217
+ 4
218
+ x
219
+ 6
220
+ follow
221
+ M
222
+ 1
223
+ n
224
+ n
225
+ x
226
+ 6
227
+ follow
228
+ i
229
+ 112
230
+ 23
231
+ 0
232
+ 10
233
+ 14
234
+ 44
235
+ 43
236
+ 0
237
+ 78
238
+ 49
239
+ 1
240
+ 1
241
+ 19
242
+ 0
243
+ 15
244
+ 5
245
+ 7
246
+ 2
247
+ 64
248
+ 47
249
+ 49
250
+ 3
251
+ 1
252
+ 19
253
+ 1
254
+ 15
255
+ 20
256
+ 0
257
+ 49
258
+ 4
259
+ 0
260
+ 19
261
+ 0
262
+ 15
263
+ 20
264
+ 0
265
+ 7
266
+ 5
267
+ 14
268
+ 2
269
+ 49
270
+ 3
271
+ 1
272
+ 79
273
+ 49
274
+ 6
275
+ 1
276
+ 13
277
+ 18
278
+ 3
279
+ 49
280
+ 7
281
+ 2
282
+ 15
283
+ 20
284
+ 0
285
+ 7
286
+ 8
287
+ 49
288
+ 3
289
+ 1
290
+ 49
291
+ 9
292
+ 1
293
+ 9
294
+ 79
295
+ 5
296
+ 45
297
+ 10
298
+ 11
299
+ 43
300
+ 12
301
+ 43
302
+ 13
303
+ 47
304
+ 49
305
+ 14
306
+ 1
307
+ 8
308
+ 80
309
+ 1
310
+ 15
311
+ 45
312
+ 10
313
+ 15
314
+ 49
315
+ 16
316
+ 0
317
+ 7
318
+ 17
319
+ 20
320
+ 1
321
+ 47
322
+ 49
323
+ 18
324
+ 0
325
+ 63
326
+ 2
327
+ 49
328
+ 19
329
+ 1
330
+ 15
331
+ 20
332
+ 1
333
+ 20
334
+ 0
335
+ 49
336
+ 20
337
+ 1
338
+ 49
339
+ 21
340
+ 0
341
+ 11
342
+ I
343
+ 6
344
+ I
345
+ 2
346
+ I
347
+ 0
348
+ I
349
+ 1
350
+ n
351
+ p
352
+ 22
353
+ x
354
+ 4
355
+ Hash
356
+ x
357
+ 16
358
+ new_from_literal
359
+ s
360
+ 8
361
+ location
362
+ x
363
+ 2
364
+ []
365
+ x
366
+ 5
367
+ clone
368
+ x
369
+ 22
370
+ follow_redirects_count
371
+ x
372
+ 1
373
+ +
374
+ x
375
+ 3
376
+ []=
377
+ x
378
+ 22
379
+ follow_redirects_limit
380
+ x
381
+ 2
382
+ >=
383
+ x
384
+ 5
385
+ Wrest
386
+ n
387
+ x
388
+ 10
389
+ Exceptions
390
+ x
391
+ 25
392
+ AutoRedirectLimitExceeded
393
+ x
394
+ 5
395
+ raise
396
+ n
397
+ x
398
+ 6
399
+ logger
400
+ s
401
+ 19
402
+ --| Redirecting to
403
+ x
404
+ 4
405
+ to_s
406
+ x
407
+ 5
408
+ debug
409
+ x
410
+ 6
411
+ to_uri
412
+ x
413
+ 3
414
+ get
415
+ p
416
+ 13
417
+ I
418
+ 0
419
+ I
420
+ 1b
421
+ I
422
+ e
423
+ I
424
+ 1c
425
+ I
426
+ 19
427
+ I
428
+ 1d
429
+ I
430
+ 21
431
+ I
432
+ 1f
433
+ I
434
+ 51
435
+ I
436
+ 21
437
+ I
438
+ 65
439
+ I
440
+ 22
441
+ I
442
+ 70
443
+ x
444
+ 54
445
+ /Users/sidu/Work/wrest/lib/wrest/native/redirection.rb
446
+ p
447
+ 2
448
+ x
449
+ 24
450
+ redirect_request_options
451
+ x
452
+ 6
453
+ target
454
+ x
455
+ 17
456
+ method_visibility
457
+ x
458
+ 15
459
+ add_defn_method
460
+ p
461
+ 3
462
+ I
463
+ 2
464
+ I
465
+ 1b
466
+ I
467
+ 10
468
+ x
469
+ 54
470
+ /Users/sidu/Work/wrest/lib/wrest/native/redirection.rb
471
+ p
472
+ 0
473
+ x
474
+ 13
475
+ attach_method
476
+ p
477
+ 3
478
+ I
479
+ 2
480
+ I
481
+ 11
482
+ I
483
+ 1f
484
+ x
485
+ 54
486
+ /Users/sidu/Work/wrest/lib/wrest/native/redirection.rb
487
+ p
488
+ 0
489
+ x
490
+ 13
491
+ attach_method
492
+ p
493
+ 3
494
+ I
495
+ 2
496
+ I
497
+ b
498
+ I
499
+ 1c
500
+ x
501
+ 54
502
+ /Users/sidu/Work/wrest/lib/wrest/native/redirection.rb
503
+ p
504
+ 0
505
+ x
506
+ 13
507
+ attach_method
508
+ p
509
+ 3
510
+ I
511
+ 0
512
+ I
513
+ a
514
+ I
515
+ 1c
516
+ x
517
+ 54
518
+ /Users/sidu/Work/wrest/lib/wrest/native/redirection.rb
519
+ p
520
+ 0