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.
Files changed (93) hide show
  1. data/CHANGELOG +14 -2
  2. data/LICENCE +7 -0
  3. data/README.rdoc +15 -69
  4. data/lib/wrest/components/container/alias_accessors.rb +1 -1
  5. data/lib/wrest/components/container/alias_accessors.rbc +905 -0
  6. data/lib/wrest/components/container/typecaster.rb +5 -5
  7. data/lib/wrest/components/container/typecaster.rbc +1985 -0
  8. data/lib/wrest/components/container.rb +11 -12
  9. data/lib/wrest/components/container.rbc +2466 -0
  10. data/lib/wrest/components/mutators/base.rbc +702 -0
  11. data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
  12. data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
  13. data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
  14. data/lib/wrest/components/mutators.rbc +650 -0
  15. data/lib/wrest/components/translators/content_types.rbc +339 -0
  16. data/lib/wrest/components/translators/json.rbc +462 -0
  17. data/lib/wrest/components/translators/xml.rbc +457 -0
  18. data/lib/wrest/components/translators.rbc +517 -0
  19. data/lib/wrest/components.rbc +217 -0
  20. data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
  21. data/lib/wrest/core_ext/hash.rbc +182 -0
  22. data/lib/wrest/core_ext/string/conversions.rbc +471 -0
  23. data/lib/wrest/core_ext/string.rbc +182 -0
  24. data/lib/wrest/curl/response.rb +8 -0
  25. data/lib/wrest/curl.rbc +704 -0
  26. data/lib/wrest/exceptions.rbc +312 -0
  27. data/lib/wrest/http_shared/headers.rb +0 -7
  28. data/lib/wrest/http_shared/headers.rbc +353 -0
  29. data/lib/wrest/http_shared/standard_headers.rbc +336 -0
  30. data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
  31. data/lib/wrest/http_shared.rbc +279 -0
  32. data/lib/wrest/native/connection_factory.rbc +445 -0
  33. data/lib/wrest/native/delete.rbc +371 -0
  34. data/lib/wrest/native/get.rb +26 -0
  35. data/lib/wrest/native/get.rbc +855 -0
  36. data/lib/wrest/native/options.rbc +347 -0
  37. data/lib/wrest/native/post.rbc +388 -0
  38. data/lib/wrest/native/put.rbc +388 -0
  39. data/lib/wrest/native/redirection.rbc +520 -0
  40. data/lib/wrest/native/request.rb +4 -2
  41. data/lib/wrest/native/request.rbc +1675 -0
  42. data/lib/wrest/native/response.rb +53 -2
  43. data/lib/wrest/native/response.rbc +2150 -0
  44. data/lib/wrest/native/session.rbc +1372 -0
  45. data/lib/wrest/native.rbc +513 -0
  46. data/lib/wrest/resource/base.rbc +2115 -0
  47. data/lib/wrest/resource.rbc +163 -0
  48. data/lib/wrest/uri.rbc +2599 -0
  49. data/lib/wrest/uri_template.rbc +505 -0
  50. data/lib/wrest/version.rb +1 -1
  51. data/lib/wrest/version.rbc +372 -0
  52. data/lib/wrest.rb +1 -1
  53. data/lib/wrest.rbc +1900 -0
  54. metadata +99 -102
  55. data/Rakefile +0 -495
  56. data/VERSION.yml +0 -5
  57. data/bin/jwrest +0 -3
  58. data/examples/delicious.rb +0 -72
  59. data/examples/facebook.rb +0 -101
  60. data/examples/imgur_multipart.rb +0 -24
  61. data/examples/keep_alive.rb +0 -37
  62. data/examples/redirection.rb +0 -27
  63. data/examples/twitter.rb +0 -78
  64. data/examples/twitter_public_timeline.rb +0 -32
  65. data/examples/wow_realm_status.rb +0 -67
  66. data/init.rb +0 -0
  67. data/spec/custom_matchers/custom_matchers.rb +0 -2
  68. data/spec/rcov.opts +0 -4
  69. data/spec/spec.opts.disable +0 -6
  70. data/spec/unit/spec_helper.rb +0 -35
  71. data/spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb +0 -49
  72. data/spec/unit/wrest/components/attributes_container/typecaster_spec.rb +0 -83
  73. data/spec/unit/wrest/components/attributes_container_spec.rb +0 -254
  74. data/spec/unit/wrest/components/mutators/base_spec.rb +0 -42
  75. data/spec/unit/wrest/components/mutators/camel_to_snake_spec.rb +0 -22
  76. data/spec/unit/wrest/components/mutators/xml_mini_type_caster_spec.rb +0 -75
  77. data/spec/unit/wrest/components/mutators/xml_simple_type_caster_spec.rb +0 -47
  78. data/spec/unit/wrest/components/mutators_spec.rb +0 -21
  79. data/spec/unit/wrest/components/translators/xml_spec.rb +0 -16
  80. data/spec/unit/wrest/components/translators_spec.rb +0 -18
  81. data/spec/unit/wrest/core_ext/hash/conversions_spec.rb +0 -22
  82. data/spec/unit/wrest/core_ext/string/conversions_spec.rb +0 -39
  83. data/spec/unit/wrest/curl/request_spec.rb +0 -19
  84. data/spec/unit/wrest/curl/response_spec.rb +0 -16
  85. data/spec/unit/wrest/http/response_spec.rb +0 -24
  86. data/spec/unit/wrest/native/redirection_spec.rb +0 -42
  87. data/spec/unit/wrest/native/request_spec.rb +0 -71
  88. data/spec/unit/wrest/native/response_spec.rb +0 -72
  89. data/spec/unit/wrest/native/session_spec.rb +0 -74
  90. data/spec/unit/wrest/resource/base_spec.rb +0 -274
  91. data/spec/unit/wrest/uri_spec.rb +0 -273
  92. data/spec/unit/wrest/uri_template_spec.rb +0 -38
  93. data/wrest.gemspec +0 -168
@@ -0,0 +1,371 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 30
13
+ 99
14
+ 7
15
+ 0
16
+ 45
17
+ 1
18
+ 2
19
+ 49
20
+ 3
21
+ 2
22
+ 13
23
+ 99
24
+ 12
25
+ 7
26
+ 4
27
+ 12
28
+ 7
29
+ 5
30
+ 12
31
+ 65
32
+ 12
33
+ 49
34
+ 6
35
+ 4
36
+ 15
37
+ 49
38
+ 4
39
+ 0
40
+ 15
41
+ 2
42
+ 11
43
+ I
44
+ 6
45
+ I
46
+ 0
47
+ I
48
+ 0
49
+ I
50
+ 0
51
+ n
52
+ p
53
+ 7
54
+ x
55
+ 6
56
+ Native
57
+ x
58
+ 5
59
+ Wrest
60
+ n
61
+ x
62
+ 17
63
+ open_module_under
64
+ x
65
+ 15
66
+ __module_init__
67
+ M
68
+ 1
69
+ n
70
+ n
71
+ x
72
+ 6
73
+ Native
74
+ i
75
+ 31
76
+ 5
77
+ 66
78
+ 99
79
+ 7
80
+ 0
81
+ 45
82
+ 1
83
+ 2
84
+ 65
85
+ 49
86
+ 3
87
+ 3
88
+ 13
89
+ 99
90
+ 12
91
+ 7
92
+ 4
93
+ 12
94
+ 7
95
+ 5
96
+ 12
97
+ 65
98
+ 12
99
+ 49
100
+ 6
101
+ 4
102
+ 15
103
+ 49
104
+ 4
105
+ 0
106
+ 11
107
+ I
108
+ 6
109
+ I
110
+ 0
111
+ I
112
+ 0
113
+ I
114
+ 0
115
+ n
116
+ p
117
+ 7
118
+ x
119
+ 6
120
+ Delete
121
+ x
122
+ 7
123
+ Request
124
+ n
125
+ x
126
+ 10
127
+ open_class
128
+ x
129
+ 14
130
+ __class_init__
131
+ M
132
+ 1
133
+ n
134
+ n
135
+ x
136
+ 6
137
+ Delete
138
+ i
139
+ 16
140
+ 5
141
+ 66
142
+ 99
143
+ 7
144
+ 0
145
+ 7
146
+ 1
147
+ 65
148
+ 67
149
+ 49
150
+ 2
151
+ 0
152
+ 49
153
+ 3
154
+ 4
155
+ 11
156
+ I
157
+ 5
158
+ I
159
+ 0
160
+ I
161
+ 0
162
+ I
163
+ 0
164
+ n
165
+ p
166
+ 4
167
+ x
168
+ 10
169
+ initialize
170
+ M
171
+ 1
172
+ n
173
+ n
174
+ x
175
+ 10
176
+ initialize
177
+ i
178
+ 63
179
+ 23
180
+ 1
181
+ 10
182
+ 14
183
+ 44
184
+ 43
185
+ 0
186
+ 78
187
+ 49
188
+ 1
189
+ 1
190
+ 19
191
+ 1
192
+ 15
193
+ 23
194
+ 2
195
+ 10
196
+ 28
197
+ 44
198
+ 43
199
+ 0
200
+ 78
201
+ 49
202
+ 1
203
+ 1
204
+ 19
205
+ 2
206
+ 15
207
+ 23
208
+ 3
209
+ 10
210
+ 42
211
+ 44
212
+ 43
213
+ 0
214
+ 78
215
+ 49
216
+ 1
217
+ 1
218
+ 19
219
+ 3
220
+ 15
221
+ 20
222
+ 0
223
+ 45
224
+ 2
225
+ 3
226
+ 43
227
+ 4
228
+ 43
229
+ 5
230
+ 20
231
+ 1
232
+ 1
233
+ 20
234
+ 2
235
+ 20
236
+ 3
237
+ 54
238
+ 52
239
+ 6
240
+ 6
241
+ 11
242
+ I
243
+ b
244
+ I
245
+ 4
246
+ I
247
+ 1
248
+ I
249
+ 4
250
+ n
251
+ p
252
+ 7
253
+ x
254
+ 4
255
+ Hash
256
+ x
257
+ 16
258
+ new_from_literal
259
+ x
260
+ 3
261
+ Net
262
+ n
263
+ x
264
+ 4
265
+ HTTP
266
+ x
267
+ 6
268
+ Delete
269
+ x
270
+ 10
271
+ initialize
272
+ p
273
+ 15
274
+ I
275
+ 0
276
+ I
277
+ c
278
+ I
279
+ 2a
280
+ I
281
+ e
282
+ I
283
+ 2c
284
+ I
285
+ f
286
+ I
287
+ 33
288
+ I
289
+ 10
290
+ I
291
+ 35
292
+ I
293
+ 11
294
+ I
295
+ 36
296
+ I
297
+ 12
298
+ I
299
+ 38
300
+ I
301
+ 13
302
+ I
303
+ 3f
304
+ x
305
+ 49
306
+ /Users/sidu/Work/wrest/lib/wrest/native/delete.rb
307
+ p
308
+ 4
309
+ x
310
+ 9
311
+ wrest_uri
312
+ x
313
+ 10
314
+ parameters
315
+ x
316
+ 7
317
+ headers
318
+ x
319
+ 7
320
+ options
321
+ x
322
+ 17
323
+ method_visibility
324
+ x
325
+ 15
326
+ add_defn_method
327
+ p
328
+ 3
329
+ I
330
+ 2
331
+ I
332
+ c
333
+ I
334
+ 10
335
+ x
336
+ 49
337
+ /Users/sidu/Work/wrest/lib/wrest/native/delete.rb
338
+ p
339
+ 0
340
+ x
341
+ 13
342
+ attach_method
343
+ p
344
+ 3
345
+ I
346
+ 2
347
+ I
348
+ b
349
+ I
350
+ 1f
351
+ x
352
+ 49
353
+ /Users/sidu/Work/wrest/lib/wrest/native/delete.rb
354
+ p
355
+ 0
356
+ x
357
+ 13
358
+ attach_method
359
+ p
360
+ 3
361
+ I
362
+ 0
363
+ I
364
+ a
365
+ I
366
+ 1e
367
+ x
368
+ 49
369
+ /Users/sidu/Work/wrest/lib/wrest/native/delete.rb
370
+ p
371
+ 0
@@ -12,6 +12,7 @@ module Wrest::Native
12
12
  def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
13
13
  follow_redirects = options[:follow_redirects]
14
14
  options[:follow_redirects] = (follow_redirects == nil ? true : follow_redirects)
15
+ options[:cache_store] ||= {}
15
16
  super(
16
17
  wrest_uri,
17
18
  Net::HTTP::Get,
@@ -21,5 +22,30 @@ module Wrest::Native
21
22
  options
22
23
  )
23
24
  end
25
+
26
+ def invoke_with_cache_check
27
+ cached_response = get_cached_response
28
+ if cached_response.nil? then
29
+ response = invoke_without_cache_check
30
+ cache_response(response) if !response.nil? && response.cacheable?
31
+ response
32
+ else
33
+ cached_response
34
+ end
35
+ end
36
+
37
+ def get_cached_response
38
+ response = nil
39
+ if cache_store.has_key?(@uri)
40
+ response = cache_store.fetch(@uri)
41
+ end
42
+ response
43
+ end
44
+
45
+ def cache_response(response)
46
+ cache_store[@uri] = response
47
+ end
48
+
49
+ alias_method_chain :invoke, :cache_check
24
50
  end
25
51
  end