restfulie 1.0.0.beta1 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/Gemfile +8 -10
  2. data/Gemfile.lock +59 -85
  3. data/README.textile +22 -57
  4. data/Rakefile +1 -3
  5. data/lib/restfulie/client/cache/basic.rb +7 -5
  6. data/lib/restfulie/client/cache/restrictions.rb +2 -0
  7. data/lib/restfulie/client/dsl.rb +7 -22
  8. data/lib/restfulie/client/entry_point.rb +1 -1
  9. data/lib/restfulie/client/ext/link_ext.rb +11 -0
  10. data/lib/restfulie/client/ext/open_search_ext.rb +26 -0
  11. data/lib/restfulie/client/ext.rb +3 -0
  12. data/lib/restfulie/client/feature/base_request.rb +2 -2
  13. data/lib/restfulie/client/feature/cache.rb +2 -2
  14. data/lib/restfulie/client/feature/conneg_when_unaccepted.rb +25 -0
  15. data/lib/restfulie/client/feature/enhance_response.rb +2 -2
  16. data/lib/restfulie/client/feature/follow_request.rb +2 -2
  17. data/lib/restfulie/client/feature/history_request.rb +2 -2
  18. data/lib/restfulie/client/feature/retry_when_unavailable.rb +25 -0
  19. data/lib/restfulie/client/feature/serialize_body.rb +7 -4
  20. data/lib/restfulie/client/feature/setup_header.rb +2 -2
  21. data/lib/restfulie/client/feature/throw_error.rb +2 -2
  22. data/lib/restfulie/client/http/link_header.rb +39 -0
  23. data/lib/restfulie/client/http/response_holder.rb +2 -2
  24. data/lib/restfulie/client/stack_navigator.rb +39 -0
  25. data/lib/restfulie/client.rb +3 -5
  26. data/lib/restfulie/common.rb +5 -6
  27. data/lib/restfulie/server/action_controller/base.rb +1 -1
  28. data/lib/restfulie/server/core_ext/array.rb +1 -27
  29. data/lib/restfulie/server/tokamak.rb +6 -0
  30. data/lib/restfulie/server.rb +11 -10
  31. data/lib/restfulie/version.rb +1 -1
  32. metadata +24 -95
  33. data/lib/restfulie/client/ext/atom_ext.rb +0 -14
  34. data/lib/restfulie/client/ext/json_ext.rb +0 -16
  35. data/lib/restfulie/common/converter/atom/base.rb +0 -91
  36. data/lib/restfulie/common/converter/atom/builder.rb +0 -111
  37. data/lib/restfulie/common/converter/atom/helpers.rb +0 -17
  38. data/lib/restfulie/common/converter/atom.rb +0 -12
  39. data/lib/restfulie/common/converter/form_url_encoded.rb +0 -16
  40. data/lib/restfulie/common/converter/json/base.rb +0 -87
  41. data/lib/restfulie/common/converter/json/builder.rb +0 -102
  42. data/lib/restfulie/common/converter/json/helpers.rb +0 -17
  43. data/lib/restfulie/common/converter/json.rb +0 -12
  44. data/lib/restfulie/common/converter/open_search/descriptor.rb +0 -32
  45. data/lib/restfulie/common/converter/open_search.rb +0 -16
  46. data/lib/restfulie/common/converter/values.rb +0 -33
  47. data/lib/restfulie/common/converter/xml/base.rb +0 -63
  48. data/lib/restfulie/common/converter/xml/builder.rb +0 -113
  49. data/lib/restfulie/common/converter/xml/helpers.rb +0 -17
  50. data/lib/restfulie/common/converter/xml/link.rb +0 -30
  51. data/lib/restfulie/common/converter/xml/links.rb +0 -21
  52. data/lib/restfulie/common/converter/xml.rb +0 -14
  53. data/lib/restfulie/common/converter.rb +0 -43
  54. data/lib/restfulie/common/core_ext/hash.rb +0 -18
  55. data/lib/restfulie/common/core_ext.rb +0 -1
  56. data/lib/restfulie/common/links.rb +0 -9
  57. data/lib/restfulie/common/representation/atom/atom.rng +0 -597
  58. data/lib/restfulie/common/representation/atom/base.rb +0 -142
  59. data/lib/restfulie/common/representation/atom/category.rb +0 -41
  60. data/lib/restfulie/common/representation/atom/entry.rb +0 -59
  61. data/lib/restfulie/common/representation/atom/factory.rb +0 -43
  62. data/lib/restfulie/common/representation/atom/feed.rb +0 -110
  63. data/lib/restfulie/common/representation/atom/link.rb +0 -68
  64. data/lib/restfulie/common/representation/atom/person.rb +0 -48
  65. data/lib/restfulie/common/representation/atom/source.rb +0 -59
  66. data/lib/restfulie/common/representation/atom/tag_collection.rb +0 -38
  67. data/lib/restfulie/common/representation/atom/xml.rb +0 -90
  68. data/lib/restfulie/common/representation/atom.rb +0 -20
  69. data/lib/restfulie/common/representation/generic.rb +0 -22
  70. data/lib/restfulie/common/representation/json/base.rb +0 -27
  71. data/lib/restfulie/common/representation/json/keys_as_methods.rb +0 -74
  72. data/lib/restfulie/common/representation/json/link.rb +0 -29
  73. data/lib/restfulie/common/representation/json/link_collection.rb +0 -23
  74. data/lib/restfulie/common/representation/json.rb +0 -13
  75. data/lib/restfulie/common/representation/links.rb +0 -11
  76. data/lib/restfulie/common/representation.rb +0 -3
  77. data/lib/restfulie/server/action_view/helpers.rb +0 -50
  78. data/lib/restfulie/server/action_view/template_handlers/tokamak.rb +0 -21
  79. data/lib/restfulie/server/action_view/template_handlers.rb +0 -30
  80. data/lib/restfulie/server/action_view.rb +0 -10
@@ -1,597 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- -*- rnc -*-
4
- RELAX NG Compact Syntax Grammar for the
5
- Atom Format Specification Version 11
6
- -->
7
- <grammar xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://www.ascc.net/xml/schematron" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
8
- <start>
9
- <choice>
10
- <ref name="atomFeed"/>
11
- <ref name="atomEntry"/>
12
- </choice>
13
- </start>
14
- <!-- Common attributes -->
15
- <define name="atomCommonAttributes">
16
- <optional>
17
- <attribute name="xml:base">
18
- <ref name="atomUri"/>
19
- </attribute>
20
- </optional>
21
- <optional>
22
- <attribute name="xml:lang">
23
- <ref name="atomLanguageTag"/>
24
- </attribute>
25
- </optional>
26
- <zeroOrMore>
27
- <ref name="undefinedAttribute"/>
28
- </zeroOrMore>
29
- </define>
30
- <!-- Text Constructs -->
31
- <define name="atomPlainTextConstruct">
32
- <ref name="atomCommonAttributes"/>
33
- <optional>
34
- <attribute name="type">
35
- <choice>
36
- <value>text</value>
37
- <value>html</value>
38
- </choice>
39
- </attribute>
40
- </optional>
41
- <text/>
42
- </define>
43
- <define name="atomXHTMLTextConstruct">
44
- <ref name="atomCommonAttributes"/>
45
- <attribute name="type">
46
- <value>xhtml</value>
47
- </attribute>
48
- <ref name="xhtmlDiv"/>
49
- </define>
50
- <define name="atomTextConstruct">
51
- <choice>
52
- <ref name="atomPlainTextConstruct"/>
53
- <ref name="atomXHTMLTextConstruct"/>
54
- </choice>
55
- </define>
56
- <!-- Person Construct -->
57
- <define name="atomPersonConstruct">
58
- <ref name="atomCommonAttributes"/>
59
- <interleave>
60
- <element name="atom:name">
61
- <text/>
62
- </element>
63
- <optional>
64
- <element name="atom:uri">
65
- <ref name="atomUri"/>
66
- </element>
67
- </optional>
68
- <optional>
69
- <element name="atom:email">
70
- <ref name="atomEmailAddress"/>
71
- </element>
72
- </optional>
73
- <zeroOrMore>
74
- <ref name="extensionElement"/>
75
- </zeroOrMore>
76
- </interleave>
77
- </define>
78
- <!-- Date Construct -->
79
- <define name="atomDateConstruct">
80
- <ref name="atomCommonAttributes"/>
81
- <data type="dateTime"/>
82
- </define>
83
- <!-- atom:feed -->
84
- <define name="atomFeed">
85
- <element name="atom:feed">
86
- <s:rule context="atom:feed">
87
- <s:assert test="atom:author or not(atom:entry[not(atom:author)])">An atom:feed must have an atom:author unless all of its atom:entry children have an atom:author.</s:assert>
88
- </s:rule>
89
- <ref name="atomCommonAttributes"/>
90
- <interleave>
91
- <zeroOrMore>
92
- <ref name="atomAuthor"/>
93
- </zeroOrMore>
94
- <zeroOrMore>
95
- <ref name="atomCategory"/>
96
- </zeroOrMore>
97
- <zeroOrMore>
98
- <ref name="atomContributor"/>
99
- </zeroOrMore>
100
- <optional>
101
- <ref name="atomGenerator"/>
102
- </optional>
103
- <optional>
104
- <ref name="atomIcon"/>
105
- </optional>
106
- <ref name="atomId"/>
107
- <zeroOrMore>
108
- <ref name="atomLink"/>
109
- </zeroOrMore>
110
- <optional>
111
- <ref name="atomLogo"/>
112
- </optional>
113
- <optional>
114
- <ref name="atomRights"/>
115
- </optional>
116
- <optional>
117
- <ref name="atomSubtitle"/>
118
- </optional>
119
- <ref name="atomTitle"/>
120
- <ref name="atomUpdated"/>
121
- <zeroOrMore>
122
- <ref name="extensionElement"/>
123
- </zeroOrMore>
124
- </interleave>
125
- <zeroOrMore>
126
- <ref name="atomEntry"/>
127
- </zeroOrMore>
128
- </element>
129
- </define>
130
- <!-- atom:entry -->
131
- <define name="atomEntry">
132
- <element name="atom:entry">
133
- <s:rule context="atom:entry">
134
- <s:assert test="atom:link[@rel='alternate'] or atom:link[not(@rel)] or atom:content">An atom:entry must have at least one atom:link element with a rel attribute of 'alternate' or an atom:content.</s:assert>
135
- </s:rule>
136
- <s:rule context="atom:entry">
137
- <s:assert test="atom:author or ../atom:author or atom:source/atom:author">An atom:entry must have an atom:author if its feed does not.</s:assert>
138
- </s:rule>
139
- <ref name="atomCommonAttributes"/>
140
- <interleave>
141
- <zeroOrMore>
142
- <ref name="atomAuthor"/>
143
- </zeroOrMore>
144
- <zeroOrMore>
145
- <ref name="atomCategory"/>
146
- </zeroOrMore>
147
- <optional>
148
- <ref name="atomContent"/>
149
- </optional>
150
- <zeroOrMore>
151
- <ref name="atomContributor"/>
152
- </zeroOrMore>
153
- <ref name="atomId"/>
154
- <zeroOrMore>
155
- <ref name="atomLink"/>
156
- </zeroOrMore>
157
- <optional>
158
- <ref name="atomPublished"/>
159
- </optional>
160
- <optional>
161
- <ref name="atomRights"/>
162
- </optional>
163
- <optional>
164
- <ref name="atomSource"/>
165
- </optional>
166
- <optional>
167
- <ref name="atomSummary"/>
168
- </optional>
169
- <ref name="atomTitle"/>
170
- <ref name="atomUpdated"/>
171
- <zeroOrMore>
172
- <ref name="extensionElement"/>
173
- </zeroOrMore>
174
- </interleave>
175
- </element>
176
- </define>
177
- <!-- atom:content -->
178
- <define name="atomInlineTextContent">
179
- <element name="atom:content">
180
- <ref name="atomCommonAttributes"/>
181
- <optional>
182
- <attribute name="type">
183
- <choice>
184
- <value>text</value>
185
- <value>html</value>
186
- </choice>
187
- </attribute>
188
- </optional>
189
- <zeroOrMore>
190
- <text/>
191
- </zeroOrMore>
192
- </element>
193
- </define>
194
- <define name="atomInlineXHTMLContent">
195
- <element name="atom:content">
196
- <ref name="atomCommonAttributes"/>
197
- <attribute name="type">
198
- <value>xhtml</value>
199
- </attribute>
200
- <ref name="xhtmlDiv"/>
201
- </element>
202
- </define>
203
- <define name="atomInlineOtherContent">
204
- <element name="atom:content">
205
- <ref name="atomCommonAttributes"/>
206
- <optional>
207
- <attribute name="type">
208
- <ref name="atomMediaType"/>
209
- </attribute>
210
- </optional>
211
- <zeroOrMore>
212
- <choice>
213
- <text/>
214
- <ref name="anyElement"/>
215
- </choice>
216
- </zeroOrMore>
217
- </element>
218
- </define>
219
- <define name="atomOutOfLineContent">
220
- <element name="atom:content">
221
- <ref name="atomCommonAttributes"/>
222
- <optional>
223
- <attribute name="type">
224
- <ref name="atomMediaType"/>
225
- </attribute>
226
- </optional>
227
- <attribute name="src">
228
- <ref name="atomUri"/>
229
- </attribute>
230
- <empty/>
231
- </element>
232
- </define>
233
- <define name="atomContent">
234
- <choice>
235
- <ref name="atomInlineTextContent"/>
236
- <ref name="atomInlineXHTMLContent"/>
237
- <ref name="atomInlineOtherContent"/>
238
- <ref name="atomOutOfLineContent"/>
239
- </choice>
240
- </define>
241
- <!-- atom:author -->
242
- <define name="atomAuthor">
243
- <element name="atom:author">
244
- <ref name="atomPersonConstruct"/>
245
- </element>
246
- </define>
247
- <!-- atom:category -->
248
- <define name="atomCategory">
249
- <element name="atom:category">
250
- <ref name="atomCommonAttributes"/>
251
- <attribute name="term"/>
252
- <optional>
253
- <attribute name="scheme">
254
- <ref name="atomUri"/>
255
- </attribute>
256
- </optional>
257
- <optional>
258
- <attribute name="label"/>
259
- </optional>
260
- <ref name="undefinedContent"/>
261
- </element>
262
- </define>
263
- <!-- atom:contributor -->
264
- <define name="atomContributor">
265
- <element name="atom:contributor">
266
- <ref name="atomPersonConstruct"/>
267
- </element>
268
- </define>
269
- <!-- atom:generator -->
270
- <define name="atomGenerator">
271
- <element name="atom:generator">
272
- <ref name="atomCommonAttributes"/>
273
- <optional>
274
- <attribute name="uri">
275
- <ref name="atomUri"/>
276
- </attribute>
277
- </optional>
278
- <optional>
279
- <attribute name="version"/>
280
- </optional>
281
- <text/>
282
- </element>
283
- </define>
284
- <!-- atom:icon -->
285
- <define name="atomIcon">
286
- <element name="atom:icon">
287
- <ref name="atomCommonAttributes"/>
288
- <ref name="atomUri"/>
289
- </element>
290
- </define>
291
- <!-- atom:id -->
292
- <define name="atomId">
293
- <element name="atom:id">
294
- <ref name="atomCommonAttributes"/>
295
- <ref name="atomUri"/>
296
- </element>
297
- </define>
298
- <!-- atom:logo -->
299
- <define name="atomLogo">
300
- <element name="atom:logo">
301
- <ref name="atomCommonAttributes"/>
302
- <ref name="atomUri"/>
303
- </element>
304
- </define>
305
- <!-- atom:link -->
306
- <define name="atomLink">
307
- <element name="atom:link">
308
- <ref name="atomCommonAttributes"/>
309
- <attribute name="href">
310
- <ref name="atomUri"/>
311
- </attribute>
312
- <optional>
313
- <attribute name="rel">
314
- <choice>
315
- <ref name="atomNCName"/>
316
- <ref name="atomUri"/>
317
- </choice>
318
- </attribute>
319
- </optional>
320
- <optional>
321
- <attribute name="type">
322
- <ref name="atomMediaType"/>
323
- </attribute>
324
- </optional>
325
- <optional>
326
- <attribute name="hreflang">
327
- <ref name="atomLanguageTag"/>
328
- </attribute>
329
- </optional>
330
- <optional>
331
- <attribute name="title"/>
332
- </optional>
333
- <optional>
334
- <attribute name="length"/>
335
- </optional>
336
- <ref name="undefinedContent"/>
337
- </element>
338
- </define>
339
- <!-- atom:published -->
340
- <define name="atomPublished">
341
- <element name="atom:published">
342
- <ref name="atomDateConstruct"/>
343
- </element>
344
- </define>
345
- <!-- atom:rights -->
346
- <define name="atomRights">
347
- <element name="atom:rights">
348
- <ref name="atomTextConstruct"/>
349
- </element>
350
- </define>
351
- <!-- atom:source -->
352
- <define name="atomSource">
353
- <element name="atom:source">
354
- <ref name="atomCommonAttributes"/>
355
- <interleave>
356
- <zeroOrMore>
357
- <ref name="atomAuthor"/>
358
- </zeroOrMore>
359
- <zeroOrMore>
360
- <ref name="atomCategory"/>
361
- </zeroOrMore>
362
- <zeroOrMore>
363
- <ref name="atomContributor"/>
364
- </zeroOrMore>
365
- <optional>
366
- <ref name="atomGenerator"/>
367
- </optional>
368
- <optional>
369
- <ref name="atomIcon"/>
370
- </optional>
371
- <optional>
372
- <ref name="atomId"/>
373
- </optional>
374
- <zeroOrMore>
375
- <ref name="atomLink"/>
376
- </zeroOrMore>
377
- <optional>
378
- <ref name="atomLogo"/>
379
- </optional>
380
- <optional>
381
- <ref name="atomRights"/>
382
- </optional>
383
- <optional>
384
- <ref name="atomSubtitle"/>
385
- </optional>
386
- <optional>
387
- <ref name="atomTitle"/>
388
- </optional>
389
- <optional>
390
- <ref name="atomUpdated"/>
391
- </optional>
392
- <zeroOrMore>
393
- <ref name="extensionElement"/>
394
- </zeroOrMore>
395
- </interleave>
396
- </element>
397
- </define>
398
- <!-- atom:subtitle -->
399
- <define name="atomSubtitle">
400
- <element name="atom:subtitle">
401
- <ref name="atomTextConstruct"/>
402
- </element>
403
- </define>
404
- <!-- atom:summary -->
405
- <define name="atomSummary">
406
- <element name="atom:summary">
407
- <ref name="atomTextConstruct"/>
408
- </element>
409
- </define>
410
- <!-- atom:title -->
411
- <define name="atomTitle">
412
- <element name="atom:title">
413
- <ref name="atomTextConstruct"/>
414
- </element>
415
- </define>
416
- <!-- atom:updated -->
417
- <define name="atomUpdated">
418
- <element name="atom:updated">
419
- <ref name="atomDateConstruct"/>
420
- </element>
421
- </define>
422
- <!-- Low-level simple types -->
423
- <define name="atomNCName">
424
- <data type="string">
425
- <param name="minLength">1</param>
426
- <param name="pattern">[^:]*</param>
427
- </data>
428
- </define>
429
- <!-- Whatever a media type is, it contains at least one slash -->
430
- <define name="atomMediaType">
431
- <data type="string">
432
- <param name="pattern">.+/.+</param>
433
- </data>
434
- </define>
435
- <!-- As defined in RFC 3066 -->
436
- <define name="atomLanguageTag">
437
- <data type="string">
438
- <param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param>
439
- </data>
440
- </define>
441
- <!--
442
- Unconstrained; it's not entirely clear how IRI fit into
443
- xsd:anyURI so let's not try to constrain it here
444
- -->
445
- <define name="atomUri">
446
- <text/>
447
- </define>
448
- <!-- Whatever an email address is, it contains at least one @ -->
449
- <define name="atomEmailAddress">
450
- <data type="string">
451
- <param name="pattern">.+@.+</param>
452
- </data>
453
- </define>
454
- <!-- Simple Extension -->
455
- <define name="simpleExtensionElement">
456
- <element>
457
- <anyName>
458
- <except>
459
- <nsName ns="http://www.w3.org/2005/Atom"/>
460
- </except>
461
- </anyName>
462
- <text/>
463
- </element>
464
- </define>
465
- <!-- Structured Extension -->
466
- <define name="structuredExtensionElement">
467
- <element>
468
- <anyName>
469
- <except>
470
- <nsName ns="http://www.w3.org/2005/Atom"/>
471
- </except>
472
- </anyName>
473
- <choice>
474
- <group>
475
- <oneOrMore>
476
- <attribute>
477
- <anyName/>
478
- </attribute>
479
- </oneOrMore>
480
- <zeroOrMore>
481
- <choice>
482
- <text/>
483
- <ref name="anyElement"/>
484
- </choice>
485
- </zeroOrMore>
486
- </group>
487
- <group>
488
- <zeroOrMore>
489
- <attribute>
490
- <anyName/>
491
- </attribute>
492
- </zeroOrMore>
493
- <group>
494
- <optional>
495
- <text/>
496
- </optional>
497
- <oneOrMore>
498
- <ref name="anyElement"/>
499
- </oneOrMore>
500
- <zeroOrMore>
501
- <choice>
502
- <text/>
503
- <ref name="anyElement"/>
504
- </choice>
505
- </zeroOrMore>
506
- </group>
507
- </group>
508
- </choice>
509
- </element>
510
- </define>
511
- <!-- Other Extensibility -->
512
- <define name="extensionElement">
513
- <choice>
514
- <ref name="simpleExtensionElement"/>
515
- <ref name="structuredExtensionElement"/>
516
- </choice>
517
- </define>
518
- <define name="undefinedAttribute">
519
- <attribute>
520
- <anyName>
521
- <except>
522
- <name>xml:base</name>
523
- <name>xml:lang</name>
524
- <nsName ns=""/>
525
- </except>
526
- </anyName>
527
- </attribute>
528
- </define>
529
- <define name="undefinedContent">
530
- <zeroOrMore>
531
- <choice>
532
- <text/>
533
- <ref name="anyForeignElement"/>
534
- </choice>
535
- </zeroOrMore>
536
- </define>
537
- <define name="anyElement">
538
- <element>
539
- <anyName/>
540
- <zeroOrMore>
541
- <choice>
542
- <attribute>
543
- <anyName/>
544
- </attribute>
545
- <text/>
546
- <ref name="anyElement"/>
547
- </choice>
548
- </zeroOrMore>
549
- </element>
550
- </define>
551
- <define name="anyForeignElement">
552
- <element>
553
- <anyName>
554
- <except>
555
- <nsName ns="http://www.w3.org/2005/Atom"/>
556
- </except>
557
- </anyName>
558
- <zeroOrMore>
559
- <choice>
560
- <attribute>
561
- <anyName/>
562
- </attribute>
563
- <text/>
564
- <ref name="anyElement"/>
565
- </choice>
566
- </zeroOrMore>
567
- </element>
568
- </define>
569
- <!-- XHTML -->
570
- <define name="anyXHTML">
571
- <element>
572
- <nsName ns="http://www.w3.org/1999/xhtml"/>
573
- <zeroOrMore>
574
- <choice>
575
- <attribute>
576
- <anyName/>
577
- </attribute>
578
- <text/>
579
- <ref name="anyXHTML"/>
580
- </choice>
581
- </zeroOrMore>
582
- </element>
583
- </define>
584
- <define name="xhtmlDiv">
585
- <element name="xhtml:div">
586
- <zeroOrMore>
587
- <choice>
588
- <attribute>
589
- <anyName/>
590
- </attribute>
591
- <text/>
592
- <ref name="anyXHTML"/>
593
- </choice>
594
- </zeroOrMore>
595
- </element>
596
- </define>
597
- </grammar>