atom-tools 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README +3 -3
  2. data/Rakefile +1 -1
  3. data/bin/atom-client.rb +13 -10
  4. data/lib/atom/collection.rb +2 -2
  5. data/lib/atom/element.rb +5 -1
  6. data/lib/atom/entry.rb +9 -2
  7. data/lib/atom/feed.rb +11 -6
  8. data/lib/atom/http.rb +157 -38
  9. data/lib/atom/service.rb +170 -0
  10. data/lib/atom/text.rb +15 -2
  11. data/lib/atom/xml.rb +1 -1
  12. data/test/conformance/updated.rb +2 -1
  13. data/test/test_constructs.rb +45 -2
  14. data/test/test_feed.rb +27 -0
  15. data/test/test_http.rb +116 -20
  16. data/test/test_protocol.rb +77 -13
  17. data/test/test_xml.rb +15 -1
  18. metadata +3 -38
  19. data/bin/atom-server.rb~ +0 -71
  20. data/doc/classes/Atom/App.html +0 -217
  21. data/doc/classes/Atom/Author.html +0 -130
  22. data/doc/classes/Atom/Category.html +0 -128
  23. data/doc/classes/Atom/Collection.html +0 -322
  24. data/doc/classes/Atom/Content.html +0 -129
  25. data/doc/classes/Atom/Contributor.html +0 -119
  26. data/doc/classes/Atom/Element.html +0 -325
  27. data/doc/classes/Atom/Entry.html +0 -365
  28. data/doc/classes/Atom/Feed.html +0 -585
  29. data/doc/classes/Atom/HTTP.html +0 -374
  30. data/doc/classes/Atom/Link.html +0 -137
  31. data/doc/classes/Atom/Text.html +0 -229
  32. data/doc/classes/XHTML.html +0 -118
  33. data/doc/created.rid +0 -1
  34. data/doc/files/README.html +0 -213
  35. data/doc/files/lib/atom/app_rb.html +0 -110
  36. data/doc/files/lib/atom/collection_rb.html +0 -110
  37. data/doc/files/lib/atom/element_rb.html +0 -109
  38. data/doc/files/lib/atom/entry_rb.html +0 -111
  39. data/doc/files/lib/atom/feed_rb.html +0 -112
  40. data/doc/files/lib/atom/http_rb.html +0 -109
  41. data/doc/files/lib/atom/text_rb.html +0 -108
  42. data/doc/files/lib/atom/xml_rb.html +0 -110
  43. data/doc/files/lib/atom/yaml_rb.html +0 -109
  44. data/doc/fr_class_index.html +0 -39
  45. data/doc/fr_file_index.html +0 -36
  46. data/doc/fr_method_index.html +0 -62
  47. data/doc/index.html +0 -24
  48. data/doc/rdoc-style.css +0 -208
  49. data/lib/atom/app.rb +0 -87
@@ -1,374 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Atom::HTTP</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Atom::HTTP</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/atom/collection_rb.html">
59
- lib/atom/collection.rb
60
- </a>
61
- <br />
62
- <a href="../../files/lib/atom/http_rb.html">
63
- lib/atom/http.rb
64
- </a>
65
- <br />
66
- </td>
67
- </tr>
68
-
69
- <tr class="top-aligned-row">
70
- <td><strong>Parent:</strong></td>
71
- <td>
72
- Object
73
- </td>
74
- </tr>
75
- </table>
76
- </div>
77
- <!-- banner header -->
78
-
79
- <div id="bodyContent">
80
-
81
-
82
-
83
- <div id="contextContent">
84
-
85
- <div id="description">
86
- <p>
87
- An object which handles the details of <a href="HTTP.html">HTTP</a> -
88
- particularly authentication and caching (neither of which are fully
89
- implemented).
90
- </p>
91
- <p>
92
- This object can be used on its own, or passed to an <a
93
- href="App.html">Atom::App</a>, <a
94
- href="Collection.html">Atom::Collection</a> or <a
95
- href="Feed.html">Atom::Feed</a>, where it will be used for requests.
96
- </p>
97
- <p>
98
- All its <a href="HTTP.html">HTTP</a> methods return a Net::HTTPResponse
99
- </p>
100
-
101
- </div>
102
-
103
-
104
- </div>
105
-
106
- <div id="method-list">
107
- <h3 class="section-bar">Methods</h3>
108
-
109
- <div class="name-list">
110
- <a href="#M000024">delete</a>&nbsp;&nbsp;
111
- <a href="#M000021">get</a>&nbsp;&nbsp;
112
- <a href="#M000019">get_atom_entry</a>&nbsp;&nbsp;
113
- <a href="#M000022">post</a>&nbsp;&nbsp;
114
- <a href="#M000023">put</a>&nbsp;&nbsp;
115
- <a href="#M000020">put_atom_entry</a>&nbsp;&nbsp;
116
- <a href="#M000025">when_auth</a>&nbsp;&nbsp;
117
- </div>
118
- </div>
119
-
120
- </div>
121
-
122
-
123
- <!-- if includes -->
124
-
125
- <div id="section">
126
-
127
-
128
-
129
-
130
-
131
- <div id="attribute-list">
132
- <h3 class="section-bar">Attributes</h3>
133
-
134
- <div class="name-list">
135
- <table>
136
- <tr class="top-aligned-row context-row">
137
- <td class="context-item-name">pass</td>
138
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
139
- <td class="context-item-desc">
140
- used by the default <a href="HTTP.html#M000025">when_auth</a>
141
-
142
- </td>
143
- </tr>
144
- <tr class="top-aligned-row context-row">
145
- <td class="context-item-name">user</td>
146
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
147
- <td class="context-item-desc">
148
- used by the default <a href="HTTP.html#M000025">when_auth</a>
149
-
150
- </td>
151
- </tr>
152
- </table>
153
- </div>
154
- </div>
155
-
156
-
157
-
158
- <!-- if method_list -->
159
- <div id="methods">
160
- <h3 class="section-bar">Public Instance methods</h3>
161
-
162
- <div id="method-M000024" class="method-detail">
163
- <a name="M000024"></a>
164
-
165
- <div class="method-heading">
166
- <a href="#M000024" class="method-signature">
167
- <span class="method-name">delete</span><span class="method-args">(url, body = nil, headers = {})</span>
168
- </a>
169
- </div>
170
-
171
- <div class="method-description">
172
- <p>
173
- DELETEs to url
174
- </p>
175
- <p><a class="source-toggle" href="#"
176
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
177
- <div class="method-source-code" id="M000024-source">
178
- <pre>
179
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 54</span>
180
- 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span> <span class="ruby-identifier">url</span>, <span class="ruby-identifier">body</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">headers</span> = {}
181
- 55: <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">url</span>, <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Delete</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">headers</span>)
182
- 56: <span class="ruby-keyword kw">end</span>
183
- </pre>
184
- </div>
185
- </div>
186
- </div>
187
-
188
- <div id="method-M000021" class="method-detail">
189
- <a name="M000021"></a>
190
-
191
- <div class="method-heading">
192
- <a href="#M000021" class="method-signature">
193
- <span class="method-name">get</span><span class="method-args">(url, headers = {})</span>
194
- </a>
195
- </div>
196
-
197
- <div class="method-description">
198
- <p>
199
- GETs an url
200
- </p>
201
- <p><a class="source-toggle" href="#"
202
- onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
203
- <div class="method-source-code" id="M000021-source">
204
- <pre>
205
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 39</span>
206
- 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span> <span class="ruby-identifier">url</span>, <span class="ruby-identifier">headers</span> = {}
207
- 40: <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">url</span>, <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">headers</span>)
208
- 41: <span class="ruby-keyword kw">end</span>
209
- </pre>
210
- </div>
211
- </div>
212
- </div>
213
-
214
- <div id="method-M000019" class="method-detail">
215
- <a name="M000019"></a>
216
-
217
- <div class="method-heading">
218
- <a href="#M000019" class="method-signature">
219
- <span class="method-name">get_atom_entry</span><span class="method-args">(url)</span>
220
- </a>
221
- </div>
222
-
223
- <div class="method-description">
224
- <p>
225
- GET a URL and turn it into an <a href="Entry.html">Atom::Entry</a>
226
- </p>
227
- <p><a class="source-toggle" href="#"
228
- onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
229
- <div class="method-source-code" id="M000019-source">
230
- <pre>
231
- <span class="ruby-comment cmt"># File lib/atom/collection.rb, line 57</span>
232
- 57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_atom_entry</span>(<span class="ruby-identifier">url</span>)
233
- 58: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>)
234
- 59:
235
- 60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;200&quot;</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">content_type</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;application/atom+xml&quot;</span>
236
- 61: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPException</span>, <span class="ruby-value str">&quot;expected Atom::Entry, didn't get it&quot;</span>
237
- 62: <span class="ruby-keyword kw">end</span>
238
- 63:
239
- 64: <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">Entry</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>, <span class="ruby-identifier">url</span>)
240
- 65: <span class="ruby-keyword kw">end</span>
241
- </pre>
242
- </div>
243
- </div>
244
- </div>
245
-
246
- <div id="method-M000022" class="method-detail">
247
- <a name="M000022"></a>
248
-
249
- <div class="method-heading">
250
- <a href="#M000022" class="method-signature">
251
- <span class="method-name">post</span><span class="method-args">(url, body, headers = {})</span>
252
- </a>
253
- </div>
254
-
255
- <div class="method-description">
256
- <p>
257
- POSTs body to an url
258
- </p>
259
- <p><a class="source-toggle" href="#"
260
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
261
- <div class="method-source-code" id="M000022-source">
262
- <pre>
263
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 44</span>
264
- 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post</span> <span class="ruby-identifier">url</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">headers</span> = {}
265
- 45: <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">url</span>, <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">headers</span>)
266
- 46: <span class="ruby-keyword kw">end</span>
267
- </pre>
268
- </div>
269
- </div>
270
- </div>
271
-
272
- <div id="method-M000023" class="method-detail">
273
- <a name="M000023"></a>
274
-
275
- <div class="method-heading">
276
- <a href="#M000023" class="method-signature">
277
- <span class="method-name">put</span><span class="method-args">(url, body, headers = {})</span>
278
- </a>
279
- </div>
280
-
281
- <div class="method-description">
282
- <p>
283
- PUTs body to an url
284
- </p>
285
- <p><a class="source-toggle" href="#"
286
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
287
- <div class="method-source-code" id="M000023-source">
288
- <pre>
289
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 49</span>
290
- 49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put</span> <span class="ruby-identifier">url</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">headers</span> = {}
291
- 50: <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">url</span>, <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Put</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">headers</span>)
292
- 51: <span class="ruby-keyword kw">end</span>
293
- </pre>
294
- </div>
295
- </div>
296
- </div>
297
-
298
- <div id="method-M000020" class="method-detail">
299
- <a name="M000020"></a>
300
-
301
- <div class="method-heading">
302
- <a href="#M000020" class="method-signature">
303
- <span class="method-name">put_atom_entry</span><span class="method-args">(entry, url = entry.edit_url)</span>
304
- </a>
305
- </div>
306
-
307
- <div class="method-description">
308
- <p>
309
- PUT an <a href="Entry.html">Atom::Entry</a> to a URL
310
- </p>
311
- <p><a class="source-toggle" href="#"
312
- onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
313
- <div class="method-source-code" id="M000020-source">
314
- <pre>
315
- <span class="ruby-comment cmt"># File lib/atom/collection.rb, line 68</span>
316
- 68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_atom_entry</span>(<span class="ruby-identifier">entry</span>, <span class="ruby-identifier">url</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">edit_url</span>)
317
- 69: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Cowardly refusing to PUT a non-Atom::Entry (#{entry.class})&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">Entry</span>
318
- 70: <span class="ruby-identifier">headers</span> = {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/atom+xml&quot;</span> }
319
- 71:
320
- 72: <span class="ruby-identifier">put</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">headers</span>)
321
- 73: <span class="ruby-keyword kw">end</span>
322
- </pre>
323
- </div>
324
- </div>
325
- </div>
326
-
327
- <div id="method-M000025" class="method-detail">
328
- <a name="M000025"></a>
329
-
330
- <div class="method-heading">
331
- <a href="#M000025" class="method-signature">
332
- <span class="method-name">when_auth</span><span class="method-args">(&amp;block)</span>
333
- </a>
334
- </div>
335
-
336
- <div class="method-description">
337
- <p>
338
- a block that will be called when a remote server responds with 401
339
- Unauthorized, so that your application can prompt for authentication
340
- details
341
- </p>
342
- <p>
343
- it will be called with the base URL of the requested URL, and the realm
344
- used in the WWW-Authenticate header.
345
- </p>
346
- <p>
347
- it should return a value of the form [username, password]
348
- </p>
349
- <p><a class="source-toggle" href="#"
350
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
351
- <div class="method-source-code" id="M000025-source">
352
- <pre>
353
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 65</span>
354
- 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">when_auth</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
355
- 66: <span class="ruby-ivar">@get_auth_details</span> = <span class="ruby-identifier">block</span>
356
- 67: <span class="ruby-keyword kw">end</span>
357
- </pre>
358
- </div>
359
- </div>
360
- </div>
361
-
362
-
363
- </div>
364
-
365
-
366
- </div>
367
-
368
-
369
- <div id="validator-badges">
370
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
371
- </div>
372
-
373
- </body>
374
- </html>
@@ -1,137 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Atom::Link</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Atom::Link</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/atom/element_rb.html">
59
- lib/atom/element.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Atom::AttrEl
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- A link has the following attributes:
84
- </p>
85
- <table>
86
- <tr><td valign="top">href (required):</td><td>the link&#8217;s IRI
87
-
88
- </td></tr>
89
- <tr><td valign="top">rel:</td><td>the relationship of the linked item to the current item
90
-
91
- </td></tr>
92
- <tr><td valign="top">type:</td><td>a hint about the media type of the linked item
93
-
94
- </td></tr>
95
- <tr><td valign="top">hreflang:</td><td>the language of the linked item (RFC3066)
96
-
97
- </td></tr>
98
- <tr><td valign="top">title:</td><td>human-readable information about the link
99
-
100
- </td></tr>
101
- <tr><td valign="top">length:</td><td>a hint about the length (in octets) of the linked item
102
-
103
- </td></tr>
104
- </table>
105
-
106
- </div>
107
-
108
-
109
- </div>
110
-
111
-
112
- </div>
113
-
114
-
115
- <!-- if includes -->
116
-
117
- <div id="section">
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
- <!-- if method_list -->
127
-
128
-
129
- </div>
130
-
131
-
132
- <div id="validator-badges">
133
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
134
- </div>
135
-
136
- </body>
137
- </html>