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.
- data/CHANGELOG +59 -0
- data/LICENCE +7 -0
- data/README.rdoc +127 -0
- data/bin/wrest +3 -0
- data/bin/wrest_shell.rb +21 -0
- data/lib/wrest.rb +101 -0
- data/lib/wrest.rbc +1900 -0
- data/lib/wrest/components.rb +20 -0
- data/lib/wrest/components.rbc +217 -0
- data/lib/wrest/components/container.rb +185 -0
- data/lib/wrest/components/container.rbc +2466 -0
- data/lib/wrest/components/container/alias_accessors.rb +66 -0
- data/lib/wrest/components/container/alias_accessors.rbc +905 -0
- data/lib/wrest/components/container/typecaster.rb +127 -0
- data/lib/wrest/components/container/typecaster.rbc +1985 -0
- data/lib/wrest/components/mutators.rb +39 -0
- data/lib/wrest/components/mutators.rbc +650 -0
- data/lib/wrest/components/mutators/base.rb +56 -0
- data/lib/wrest/components/mutators/base.rbc +702 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rb +22 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rb +43 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rb +37 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
- data/lib/wrest/components/translators.rb +28 -0
- data/lib/wrest/components/translators.rbc +517 -0
- data/lib/wrest/components/translators/content_types.rb +20 -0
- data/lib/wrest/components/translators/content_types.rbc +339 -0
- data/lib/wrest/components/translators/json.rb +25 -0
- data/lib/wrest/components/translators/json.rbc +462 -0
- data/lib/wrest/components/translators/xml.rb +24 -0
- data/lib/wrest/components/translators/xml.rbc +457 -0
- data/lib/wrest/core_ext/hash.rb +5 -0
- data/lib/wrest/core_ext/hash.rbc +182 -0
- data/lib/wrest/core_ext/hash/conversions.rb +44 -0
- data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
- data/lib/wrest/core_ext/string.rb +5 -0
- data/lib/wrest/core_ext/string.rbc +182 -0
- data/lib/wrest/core_ext/string/conversions.rb +23 -0
- data/lib/wrest/core_ext/string/conversions.rbc +471 -0
- data/lib/wrest/curl.rb +49 -0
- data/lib/wrest/curl.rbc +704 -0
- data/lib/wrest/curl/delete.rb +23 -0
- data/lib/wrest/curl/get.rb +23 -0
- data/lib/wrest/curl/options.rb +16 -0
- data/lib/wrest/curl/post.rb +23 -0
- data/lib/wrest/curl/put.rb +23 -0
- data/lib/wrest/curl/request.rb +97 -0
- data/lib/wrest/curl/response.rb +71 -0
- data/lib/wrest/curl/session.rb +57 -0
- data/lib/wrest/exceptions.rb +33 -0
- data/lib/wrest/exceptions.rbc +312 -0
- data/lib/wrest/http_shared.rb +23 -0
- data/lib/wrest/http_shared.rbc +279 -0
- data/lib/wrest/http_shared/headers.rb +343 -0
- data/lib/wrest/http_shared/headers.rbc +353 -0
- data/lib/wrest/http_shared/standard_headers.rb +21 -0
- data/lib/wrest/http_shared/standard_headers.rbc +336 -0
- data/lib/wrest/http_shared/standard_tokens.rb +18 -0
- data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
- data/lib/wrest/multipart.rb +52 -0
- data/lib/wrest/native.rb +33 -0
- data/lib/wrest/native.rbc +513 -0
- data/lib/wrest/native/connection_factory.rb +23 -0
- data/lib/wrest/native/connection_factory.rbc +445 -0
- data/lib/wrest/native/delete.rb +23 -0
- data/lib/wrest/native/delete.rbc +371 -0
- data/lib/wrest/native/get.rb +51 -0
- data/lib/wrest/native/get.rbc +855 -0
- data/lib/wrest/native/options.rb +23 -0
- data/lib/wrest/native/options.rbc +347 -0
- data/lib/wrest/native/post.rb +23 -0
- data/lib/wrest/native/post.rbc +388 -0
- data/lib/wrest/native/post_multipart.rb +32 -0
- data/lib/wrest/native/put.rb +23 -0
- data/lib/wrest/native/put.rbc +388 -0
- data/lib/wrest/native/put_multipart.rb +32 -0
- data/lib/wrest/native/redirection.rb +38 -0
- data/lib/wrest/native/redirection.rbc +520 -0
- data/lib/wrest/native/request.rb +94 -0
- data/lib/wrest/native/request.rbc +1675 -0
- data/lib/wrest/native/response.rb +120 -0
- data/lib/wrest/native/response.rbc +2150 -0
- data/lib/wrest/native/session.rb +57 -0
- data/lib/wrest/native/session.rbc +1372 -0
- data/lib/wrest/resource.rb +18 -0
- data/lib/wrest/resource.rbc +163 -0
- data/lib/wrest/resource/base.rb +99 -0
- data/lib/wrest/resource/base.rbc +2115 -0
- data/lib/wrest/resource/collection.rb +12 -0
- data/lib/wrest/resource/state.rb +6 -0
- data/lib/wrest/test.rb +1 -0
- data/lib/wrest/test/request_patches.rb +5 -0
- data/lib/wrest/uri.rb +160 -0
- data/lib/wrest/uri.rbc +2599 -0
- data/lib/wrest/uri_template.rb +49 -0
- data/lib/wrest/uri_template.rbc +505 -0
- data/lib/wrest/version.rb +23 -0
- data/lib/wrest/version.rbc +372 -0
- metadata +231 -0
@@ -0,0 +1,37 @@
|
|
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
|
11
|
+
module Components
|
12
|
+
# This mutator undertands how do type casting
|
13
|
+
# using the type data embedded in a hash
|
14
|
+
# created by deserialising an xml using
|
15
|
+
# xml-simple
|
16
|
+
class Mutators::XmlSimpleTypeCaster < Mutators::Base
|
17
|
+
def do_mutate(tuple)
|
18
|
+
out_key = tuple.first
|
19
|
+
in_value = tuple.last[0]
|
20
|
+
out_value = in_value
|
21
|
+
|
22
|
+
case in_value
|
23
|
+
when Hash
|
24
|
+
if in_value['nil'] == 'true'
|
25
|
+
out_value = nil
|
26
|
+
elsif in_value.key?('type')
|
27
|
+
out_value = ActiveSupport::XmlMini::PARSING[in_value['type']].call(in_value['content'])
|
28
|
+
else
|
29
|
+
out_value = in_value.mutate_using(self)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
[out_key, out_value]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,559 @@
|
|
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
|
+
10
|
111
|
+
Components
|
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
|
+
10
|
124
|
+
Components
|
125
|
+
i
|
126
|
+
35
|
127
|
+
5
|
128
|
+
66
|
129
|
+
99
|
130
|
+
7
|
131
|
+
0
|
132
|
+
45
|
133
|
+
1
|
134
|
+
2
|
135
|
+
43
|
136
|
+
3
|
137
|
+
45
|
138
|
+
1
|
139
|
+
4
|
140
|
+
49
|
141
|
+
5
|
142
|
+
3
|
143
|
+
13
|
144
|
+
99
|
145
|
+
12
|
146
|
+
7
|
147
|
+
6
|
148
|
+
12
|
149
|
+
7
|
150
|
+
7
|
151
|
+
12
|
152
|
+
65
|
153
|
+
12
|
154
|
+
49
|
155
|
+
8
|
156
|
+
4
|
157
|
+
15
|
158
|
+
49
|
159
|
+
6
|
160
|
+
0
|
161
|
+
11
|
162
|
+
I
|
163
|
+
6
|
164
|
+
I
|
165
|
+
0
|
166
|
+
I
|
167
|
+
0
|
168
|
+
I
|
169
|
+
0
|
170
|
+
n
|
171
|
+
p
|
172
|
+
9
|
173
|
+
x
|
174
|
+
19
|
175
|
+
XmlSimpleTypeCaster
|
176
|
+
x
|
177
|
+
8
|
178
|
+
Mutators
|
179
|
+
n
|
180
|
+
x
|
181
|
+
4
|
182
|
+
Base
|
183
|
+
n
|
184
|
+
x
|
185
|
+
16
|
186
|
+
open_class_under
|
187
|
+
x
|
188
|
+
14
|
189
|
+
__class_init__
|
190
|
+
M
|
191
|
+
1
|
192
|
+
n
|
193
|
+
n
|
194
|
+
x
|
195
|
+
19
|
196
|
+
XmlSimpleTypeCaster
|
197
|
+
i
|
198
|
+
16
|
199
|
+
5
|
200
|
+
66
|
201
|
+
99
|
202
|
+
7
|
203
|
+
0
|
204
|
+
7
|
205
|
+
1
|
206
|
+
65
|
207
|
+
67
|
208
|
+
49
|
209
|
+
2
|
210
|
+
0
|
211
|
+
49
|
212
|
+
3
|
213
|
+
4
|
214
|
+
11
|
215
|
+
I
|
216
|
+
5
|
217
|
+
I
|
218
|
+
0
|
219
|
+
I
|
220
|
+
0
|
221
|
+
I
|
222
|
+
0
|
223
|
+
n
|
224
|
+
p
|
225
|
+
4
|
226
|
+
x
|
227
|
+
9
|
228
|
+
do_mutate
|
229
|
+
M
|
230
|
+
1
|
231
|
+
n
|
232
|
+
n
|
233
|
+
x
|
234
|
+
9
|
235
|
+
do_mutate
|
236
|
+
i
|
237
|
+
121
|
238
|
+
20
|
239
|
+
0
|
240
|
+
49
|
241
|
+
0
|
242
|
+
0
|
243
|
+
19
|
244
|
+
1
|
245
|
+
15
|
246
|
+
20
|
247
|
+
0
|
248
|
+
49
|
249
|
+
1
|
250
|
+
0
|
251
|
+
78
|
252
|
+
49
|
253
|
+
2
|
254
|
+
1
|
255
|
+
19
|
256
|
+
2
|
257
|
+
15
|
258
|
+
20
|
259
|
+
2
|
260
|
+
19
|
261
|
+
3
|
262
|
+
15
|
263
|
+
20
|
264
|
+
2
|
265
|
+
13
|
266
|
+
45
|
267
|
+
3
|
268
|
+
4
|
269
|
+
12
|
270
|
+
49
|
271
|
+
5
|
272
|
+
1
|
273
|
+
9
|
274
|
+
111
|
275
|
+
15
|
276
|
+
20
|
277
|
+
2
|
278
|
+
7
|
279
|
+
6
|
280
|
+
64
|
281
|
+
49
|
282
|
+
2
|
283
|
+
1
|
284
|
+
7
|
285
|
+
7
|
286
|
+
64
|
287
|
+
83
|
288
|
+
8
|
289
|
+
9
|
290
|
+
58
|
291
|
+
1
|
292
|
+
19
|
293
|
+
3
|
294
|
+
8
|
295
|
+
109
|
296
|
+
20
|
297
|
+
2
|
298
|
+
7
|
299
|
+
9
|
300
|
+
64
|
301
|
+
49
|
302
|
+
10
|
303
|
+
1
|
304
|
+
9
|
305
|
+
101
|
306
|
+
45
|
307
|
+
11
|
308
|
+
12
|
309
|
+
43
|
310
|
+
13
|
311
|
+
43
|
312
|
+
14
|
313
|
+
20
|
314
|
+
2
|
315
|
+
7
|
316
|
+
9
|
317
|
+
64
|
318
|
+
49
|
319
|
+
2
|
320
|
+
1
|
321
|
+
49
|
322
|
+
2
|
323
|
+
1
|
324
|
+
20
|
325
|
+
2
|
326
|
+
7
|
327
|
+
15
|
328
|
+
64
|
329
|
+
49
|
330
|
+
2
|
331
|
+
1
|
332
|
+
49
|
333
|
+
16
|
334
|
+
1
|
335
|
+
19
|
336
|
+
3
|
337
|
+
8
|
338
|
+
109
|
339
|
+
20
|
340
|
+
2
|
341
|
+
5
|
342
|
+
49
|
343
|
+
17
|
344
|
+
1
|
345
|
+
19
|
346
|
+
3
|
347
|
+
8
|
348
|
+
113
|
349
|
+
15
|
350
|
+
1
|
351
|
+
15
|
352
|
+
20
|
353
|
+
1
|
354
|
+
20
|
355
|
+
3
|
356
|
+
35
|
357
|
+
2
|
358
|
+
11
|
359
|
+
I
|
360
|
+
7
|
361
|
+
I
|
362
|
+
4
|
363
|
+
I
|
364
|
+
1
|
365
|
+
I
|
366
|
+
1
|
367
|
+
n
|
368
|
+
p
|
369
|
+
18
|
370
|
+
x
|
371
|
+
5
|
372
|
+
first
|
373
|
+
x
|
374
|
+
4
|
375
|
+
last
|
376
|
+
x
|
377
|
+
2
|
378
|
+
[]
|
379
|
+
x
|
380
|
+
4
|
381
|
+
Hash
|
382
|
+
n
|
383
|
+
x
|
384
|
+
3
|
385
|
+
===
|
386
|
+
s
|
387
|
+
3
|
388
|
+
nil
|
389
|
+
s
|
390
|
+
4
|
391
|
+
true
|
392
|
+
x
|
393
|
+
2
|
394
|
+
==
|
395
|
+
s
|
396
|
+
4
|
397
|
+
type
|
398
|
+
x
|
399
|
+
4
|
400
|
+
key?
|
401
|
+
x
|
402
|
+
13
|
403
|
+
ActiveSupport
|
404
|
+
n
|
405
|
+
x
|
406
|
+
7
|
407
|
+
XmlMini
|
408
|
+
x
|
409
|
+
7
|
410
|
+
PARSING
|
411
|
+
s
|
412
|
+
7
|
413
|
+
content
|
414
|
+
x
|
415
|
+
4
|
416
|
+
call
|
417
|
+
x
|
418
|
+
12
|
419
|
+
mutate_using
|
420
|
+
p
|
421
|
+
27
|
422
|
+
I
|
423
|
+
0
|
424
|
+
I
|
425
|
+
11
|
426
|
+
I
|
427
|
+
0
|
428
|
+
I
|
429
|
+
12
|
430
|
+
I
|
431
|
+
8
|
432
|
+
I
|
433
|
+
13
|
434
|
+
I
|
435
|
+
14
|
436
|
+
I
|
437
|
+
14
|
438
|
+
I
|
439
|
+
19
|
440
|
+
I
|
441
|
+
16
|
442
|
+
I
|
443
|
+
1c
|
444
|
+
I
|
445
|
+
17
|
446
|
+
I
|
447
|
+
26
|
448
|
+
I
|
449
|
+
18
|
450
|
+
I
|
451
|
+
35
|
452
|
+
I
|
453
|
+
19
|
454
|
+
I
|
455
|
+
3a
|
456
|
+
I
|
457
|
+
1a
|
458
|
+
I
|
459
|
+
44
|
460
|
+
I
|
461
|
+
1b
|
462
|
+
I
|
463
|
+
65
|
464
|
+
I
|
465
|
+
1d
|
466
|
+
I
|
467
|
+
70
|
468
|
+
I
|
469
|
+
16
|
470
|
+
I
|
471
|
+
72
|
472
|
+
I
|
473
|
+
21
|
474
|
+
I
|
475
|
+
79
|
476
|
+
x
|
477
|
+
78
|
478
|
+
/Users/sidu/Work/wrest/lib/wrest/components/mutators/xml_simple_type_caster.rb
|
479
|
+
p
|
480
|
+
4
|
481
|
+
x
|
482
|
+
5
|
483
|
+
tuple
|
484
|
+
x
|
485
|
+
7
|
486
|
+
out_key
|
487
|
+
x
|
488
|
+
8
|
489
|
+
in_value
|
490
|
+
x
|
491
|
+
9
|
492
|
+
out_value
|
493
|
+
x
|
494
|
+
17
|
495
|
+
method_visibility
|
496
|
+
x
|
497
|
+
15
|
498
|
+
add_defn_method
|
499
|
+
p
|
500
|
+
3
|
501
|
+
I
|
502
|
+
2
|
503
|
+
I
|
504
|
+
11
|
505
|
+
I
|
506
|
+
10
|
507
|
+
x
|
508
|
+
78
|
509
|
+
/Users/sidu/Work/wrest/lib/wrest/components/mutators/xml_simple_type_caster.rb
|
510
|
+
p
|
511
|
+
0
|
512
|
+
x
|
513
|
+
13
|
514
|
+
attach_method
|
515
|
+
p
|
516
|
+
3
|
517
|
+
I
|
518
|
+
2
|
519
|
+
I
|
520
|
+
10
|
521
|
+
I
|
522
|
+
23
|
523
|
+
x
|
524
|
+
78
|
525
|
+
/Users/sidu/Work/wrest/lib/wrest/components/mutators/xml_simple_type_caster.rb
|
526
|
+
p
|
527
|
+
0
|
528
|
+
x
|
529
|
+
13
|
530
|
+
attach_method
|
531
|
+
p
|
532
|
+
3
|
533
|
+
I
|
534
|
+
2
|
535
|
+
I
|
536
|
+
b
|
537
|
+
I
|
538
|
+
1c
|
539
|
+
x
|
540
|
+
78
|
541
|
+
/Users/sidu/Work/wrest/lib/wrest/components/mutators/xml_simple_type_caster.rb
|
542
|
+
p
|
543
|
+
0
|
544
|
+
x
|
545
|
+
13
|
546
|
+
attach_method
|
547
|
+
p
|
548
|
+
3
|
549
|
+
I
|
550
|
+
0
|
551
|
+
I
|
552
|
+
a
|
553
|
+
I
|
554
|
+
1c
|
555
|
+
x
|
556
|
+
78
|
557
|
+
/Users/sidu/Work/wrest/lib/wrest/components/mutators/xml_simple_type_caster.rb
|
558
|
+
p
|
559
|
+
0
|