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