wrest 1.0.0.beta1 → 1.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +14 -2
- data/LICENCE +7 -0
- data/README.rdoc +15 -69
- data/lib/wrest/components/container/alias_accessors.rb +1 -1
- data/lib/wrest/components/container/alias_accessors.rbc +905 -0
- data/lib/wrest/components/container/typecaster.rb +5 -5
- data/lib/wrest/components/container/typecaster.rbc +1985 -0
- data/lib/wrest/components/container.rb +11 -12
- data/lib/wrest/components/container.rbc +2466 -0
- data/lib/wrest/components/mutators/base.rbc +702 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
- data/lib/wrest/components/mutators.rbc +650 -0
- data/lib/wrest/components/translators/content_types.rbc +339 -0
- data/lib/wrest/components/translators/json.rbc +462 -0
- data/lib/wrest/components/translators/xml.rbc +457 -0
- data/lib/wrest/components/translators.rbc +517 -0
- data/lib/wrest/components.rbc +217 -0
- data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
- data/lib/wrest/core_ext/hash.rbc +182 -0
- data/lib/wrest/core_ext/string/conversions.rbc +471 -0
- data/lib/wrest/core_ext/string.rbc +182 -0
- data/lib/wrest/curl/response.rb +8 -0
- data/lib/wrest/curl.rbc +704 -0
- data/lib/wrest/exceptions.rbc +312 -0
- data/lib/wrest/http_shared/headers.rb +0 -7
- data/lib/wrest/http_shared/headers.rbc +353 -0
- data/lib/wrest/http_shared/standard_headers.rbc +336 -0
- data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
- data/lib/wrest/http_shared.rbc +279 -0
- data/lib/wrest/native/connection_factory.rbc +445 -0
- data/lib/wrest/native/delete.rbc +371 -0
- data/lib/wrest/native/get.rb +26 -0
- data/lib/wrest/native/get.rbc +855 -0
- data/lib/wrest/native/options.rbc +347 -0
- data/lib/wrest/native/post.rbc +388 -0
- data/lib/wrest/native/put.rbc +388 -0
- data/lib/wrest/native/redirection.rbc +520 -0
- data/lib/wrest/native/request.rb +4 -2
- data/lib/wrest/native/request.rbc +1675 -0
- data/lib/wrest/native/response.rb +53 -2
- data/lib/wrest/native/response.rbc +2150 -0
- data/lib/wrest/native/session.rbc +1372 -0
- data/lib/wrest/native.rbc +513 -0
- data/lib/wrest/resource/base.rbc +2115 -0
- data/lib/wrest/resource.rbc +163 -0
- data/lib/wrest/uri.rbc +2599 -0
- data/lib/wrest/uri_template.rbc +505 -0
- data/lib/wrest/version.rb +1 -1
- data/lib/wrest/version.rbc +372 -0
- data/lib/wrest.rb +1 -1
- data/lib/wrest.rbc +1900 -0
- metadata +99 -102
- data/Rakefile +0 -495
- data/VERSION.yml +0 -5
- data/bin/jwrest +0 -3
- data/examples/delicious.rb +0 -72
- data/examples/facebook.rb +0 -101
- data/examples/imgur_multipart.rb +0 -24
- data/examples/keep_alive.rb +0 -37
- data/examples/redirection.rb +0 -27
- data/examples/twitter.rb +0 -78
- data/examples/twitter_public_timeline.rb +0 -32
- data/examples/wow_realm_status.rb +0 -67
- data/init.rb +0 -0
- data/spec/custom_matchers/custom_matchers.rb +0 -2
- data/spec/rcov.opts +0 -4
- data/spec/spec.opts.disable +0 -6
- data/spec/unit/spec_helper.rb +0 -35
- data/spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb +0 -49
- data/spec/unit/wrest/components/attributes_container/typecaster_spec.rb +0 -83
- data/spec/unit/wrest/components/attributes_container_spec.rb +0 -254
- data/spec/unit/wrest/components/mutators/base_spec.rb +0 -42
- data/spec/unit/wrest/components/mutators/camel_to_snake_spec.rb +0 -22
- data/spec/unit/wrest/components/mutators/xml_mini_type_caster_spec.rb +0 -75
- data/spec/unit/wrest/components/mutators/xml_simple_type_caster_spec.rb +0 -47
- data/spec/unit/wrest/components/mutators_spec.rb +0 -21
- data/spec/unit/wrest/components/translators/xml_spec.rb +0 -16
- data/spec/unit/wrest/components/translators_spec.rb +0 -18
- data/spec/unit/wrest/core_ext/hash/conversions_spec.rb +0 -22
- data/spec/unit/wrest/core_ext/string/conversions_spec.rb +0 -39
- data/spec/unit/wrest/curl/request_spec.rb +0 -19
- data/spec/unit/wrest/curl/response_spec.rb +0 -16
- data/spec/unit/wrest/http/response_spec.rb +0 -24
- data/spec/unit/wrest/native/redirection_spec.rb +0 -42
- data/spec/unit/wrest/native/request_spec.rb +0 -71
- data/spec/unit/wrest/native/response_spec.rb +0 -72
- data/spec/unit/wrest/native/session_spec.rb +0 -74
- data/spec/unit/wrest/resource/base_spec.rb +0 -274
- data/spec/unit/wrest/uri_spec.rb +0 -273
- data/spec/unit/wrest/uri_template_spec.rb +0 -38
- data/wrest.gemspec +0 -168
@@ -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
|
data/lib/wrest/native/request.rb
CHANGED
@@ -13,7 +13,7 @@ module Wrest::Native
|
|
13
13
|
# or Wrest::Native::Get etc. instead.
|
14
14
|
class Request
|
15
15
|
attr_reader :http_request, :uri, :body, :headers, :username, :password, :follow_redirects,
|
16
|
-
:follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters
|
16
|
+
:follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters, :cache_store
|
17
17
|
# Valid tuples for the options are:
|
18
18
|
# :username => String, defaults to nil
|
19
19
|
# :password => String, defaults to nil
|
@@ -31,6 +31,7 @@ module Wrest::Native
|
|
31
31
|
# in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
|
32
32
|
# :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
|
33
33
|
# used for multiple requests.
|
34
|
+
# :cache_store => The object which should be used as cache store for cacheable responses
|
34
35
|
def initialize(wrest_uri, http_request_klass, parameters = {}, body = nil, headers = {}, options = {})
|
35
36
|
@uri = wrest_uri
|
36
37
|
@headers = headers.stringify_keys
|
@@ -45,6 +46,7 @@ module Wrest::Native
|
|
45
46
|
@timeout = @options[:timeout]
|
46
47
|
@connection = @options[:connection]
|
47
48
|
@http_request = self.build_request(http_request_klass, @uri, @parameters, @headers)
|
49
|
+
@cache_store = options[:cache_store]
|
48
50
|
end
|
49
51
|
|
50
52
|
# Makes a request and returns a Wrest::Native::Response.
|
@@ -68,7 +70,7 @@ module Wrest::Native
|
|
68
70
|
response = nil
|
69
71
|
|
70
72
|
@connection ||= @uri.create_connection(timeout)
|
71
|
-
http_request.basic_auth username, password
|
73
|
+
http_request.basic_auth username, password unless username.nil? || password.nil?
|
72
74
|
|
73
75
|
prefix = "#{http_request.method} #{http_request.hash} #{@connection.hash}"
|
74
76
|
|