atom-tools 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/COPYING +18 -0
  2. data/README +103 -0
  3. data/Rakefile +77 -0
  4. data/bin/atom-client.rb +246 -0
  5. data/bin/atom-server.rb~ +71 -0
  6. data/doc/classes/Atom/App.html +217 -0
  7. data/doc/classes/Atom/Author.html +130 -0
  8. data/doc/classes/Atom/Category.html +128 -0
  9. data/doc/classes/Atom/Collection.html +322 -0
  10. data/doc/classes/Atom/Content.html +129 -0
  11. data/doc/classes/Atom/Contributor.html +119 -0
  12. data/doc/classes/Atom/Element.html +325 -0
  13. data/doc/classes/Atom/Entry.html +365 -0
  14. data/doc/classes/Atom/Feed.html +585 -0
  15. data/doc/classes/Atom/HTTP.html +374 -0
  16. data/doc/classes/Atom/Link.html +137 -0
  17. data/doc/classes/Atom/Text.html +229 -0
  18. data/doc/classes/XHTML.html +118 -0
  19. data/doc/created.rid +1 -0
  20. data/doc/files/README.html +213 -0
  21. data/doc/files/lib/atom/app_rb.html +110 -0
  22. data/doc/files/lib/atom/collection_rb.html +110 -0
  23. data/doc/files/lib/atom/element_rb.html +109 -0
  24. data/doc/files/lib/atom/entry_rb.html +111 -0
  25. data/doc/files/lib/atom/feed_rb.html +112 -0
  26. data/doc/files/lib/atom/http_rb.html +109 -0
  27. data/doc/files/lib/atom/text_rb.html +108 -0
  28. data/doc/files/lib/atom/xml_rb.html +110 -0
  29. data/doc/files/lib/atom/yaml_rb.html +109 -0
  30. data/doc/fr_class_index.html +39 -0
  31. data/doc/fr_file_index.html +36 -0
  32. data/doc/fr_method_index.html +62 -0
  33. data/doc/index.html +24 -0
  34. data/doc/rdoc-style.css +208 -0
  35. data/lib/atom/app.rb +87 -0
  36. data/lib/atom/collection.rb +75 -0
  37. data/lib/atom/element.rb +277 -0
  38. data/lib/atom/entry.rb +135 -0
  39. data/lib/atom/feed.rb +229 -0
  40. data/lib/atom/http.rb +132 -0
  41. data/lib/atom/text.rb +163 -0
  42. data/lib/atom/xml.rb +200 -0
  43. data/lib/atom/yaml.rb +101 -0
  44. data/setup.rb +1585 -0
  45. data/test/conformance/order.rb +117 -0
  46. data/test/conformance/title.rb +108 -0
  47. data/test/conformance/updated.rb +33 -0
  48. data/test/conformance/xhtmlcontentdiv.rb +18 -0
  49. data/test/conformance/xmlnamespace.rb +54 -0
  50. data/test/runtests.rb +14 -0
  51. data/test/test_constructs.rb +91 -0
  52. data/test/test_feed.rb +128 -0
  53. data/test/test_general.rb +99 -0
  54. data/test/test_http.rb +86 -0
  55. data/test/test_protocol.rb +69 -0
  56. data/test/test_xml.rb +353 -0
  57. metadata +107 -0
@@ -0,0 +1,217 @@
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::App</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::App</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/atom/app_rb.html">
59
+ lib/atom/app.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
+ Object
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 href="App.html">Atom::App</a> represents an Atom Publishing Protocol
84
+ introspection document.
85
+ </p>
86
+
87
+ </div>
88
+
89
+
90
+ </div>
91
+
92
+ <div id="method-list">
93
+ <h3 class="section-bar">Methods</h3>
94
+
95
+ <div class="name-list">
96
+ <a href="#M000006">new</a>&nbsp;&nbsp;
97
+ </div>
98
+ </div>
99
+
100
+ </div>
101
+
102
+
103
+ <!-- if includes -->
104
+
105
+ <div id="section">
106
+
107
+
108
+
109
+
110
+
111
+ <div id="attribute-list">
112
+ <h3 class="section-bar">Attributes</h3>
113
+
114
+ <div class="name-list">
115
+ <table>
116
+ <tr class="top-aligned-row context-row">
117
+ <td class="context-item-name">collections</td>
118
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
119
+ <td class="context-item-desc">
120
+ collections referred to by the introspection document
121
+
122
+ </td>
123
+ </tr>
124
+ </table>
125
+ </div>
126
+ </div>
127
+
128
+
129
+
130
+ <!-- if method_list -->
131
+ <div id="methods">
132
+ <h3 class="section-bar">Public Class methods</h3>
133
+
134
+ <div id="method-M000006" class="method-detail">
135
+ <a name="M000006"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="#M000006" class="method-signature">
139
+ <span class="method-name">new</span><span class="method-args">(introspection_url, http = Atom::HTTP.new)</span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="method-description">
144
+ <p>
145
+ retrieves and parses an Atom introspection document.
146
+ </p>
147
+ <p><a class="source-toggle" href="#"
148
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
149
+ <div class="method-source-code" id="M000006-source">
150
+ <pre>
151
+ <span class="ruby-comment cmt"># File lib/atom/app.rb, line 23</span>
152
+ 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">introspection_url</span>, <span class="ruby-identifier">http</span> = <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>)
153
+ 24: <span class="ruby-identifier">i_url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">introspection_url</span>)
154
+ 25:
155
+ 26: <span class="ruby-identifier">rxml</span> = <span class="ruby-keyword kw">nil</span>
156
+ 27:
157
+ 28: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">i_url</span>)
158
+ 29:
159
+ 30: <span class="ruby-keyword kw">unless</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-comment cmt"># redirects, &amp;c.</span>
160
+ 31: <span class="ruby-identifier">raise</span> <span class="ruby-constant">WrongResponse</span>, <span class="ruby-node">&quot;introspection document responded with unexpected code #{res.code}&quot;</span>
161
+ 32: <span class="ruby-keyword kw">end</span>
162
+ 33:
163
+ 34: <span class="ruby-keyword kw">unless</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/atomserv+xml&quot;</span>
164
+ 35: <span class="ruby-identifier">raise</span> <span class="ruby-constant">WrongMimetype</span>, <span class="ruby-value str">&quot;this isn't an introspection document!&quot;</span>
165
+ 36: <span class="ruby-keyword kw">end</span>
166
+ 37:
167
+ 38: <span class="ruby-identifier">rxml</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>)
168
+ 39:
169
+ 40: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rxml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-operator">==</span> <span class="ruby-constant">PP_NS</span>
170
+ 41: <span class="ruby-identifier">raise</span> <span class="ruby-constant">WrongNamespace</span>, <span class="ruby-value str">&quot;this isn't an introspection document!&quot;</span>
171
+ 42: <span class="ruby-keyword kw">end</span>
172
+ 43:
173
+ 44: <span class="ruby-comment cmt"># TODO: expose workspaces</span>
174
+ 45: <span class="ruby-identifier">colls</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">match</span>( <span class="ruby-identifier">rxml</span>,
175
+ 46: <span class="ruby-value str">&quot;/app:service/app:workspace/app:collection&quot;</span>,
176
+ 47: {<span class="ruby-value str">&quot;app&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">PP_NS</span>} )
177
+ 48:
178
+ 49: <span class="ruby-ivar">@collections</span> = []
179
+ 50:
180
+ 51: <span class="ruby-identifier">colls</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">collection</span><span class="ruby-operator">|</span>
181
+ 52: <span class="ruby-comment cmt"># absolutize relative URLs</span>
182
+ 53: <span class="ruby-identifier">url</span> = <span class="ruby-identifier">i_url</span> <span class="ruby-operator">+</span> <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;href&quot;</span>])
183
+ 54:
184
+ 55: <span class="ruby-identifier">coll</span> = <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">Collection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">http</span>)
185
+ 56:
186
+ 57: <span class="ruby-comment cmt"># XXX this is a Text Construct, and should be parsed as such</span>
187
+ 58: <span class="ruby-identifier">coll</span>.<span class="ruby-identifier">title</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>( <span class="ruby-identifier">collection</span>,
188
+ 59: <span class="ruby-value str">&quot;./atom:title&quot;</span>,
189
+ 60: {<span class="ruby-value str">&quot;app&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">PP_NS</span>,
190
+ 61: <span class="ruby-value str">&quot;atom&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">NS</span> } ).<span class="ruby-identifier">text</span>
191
+ 62:
192
+ 63: <span class="ruby-identifier">accepts</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>( <span class="ruby-identifier">collection</span>,
193
+ 64: <span class="ruby-value str">&quot;./app:accept&quot;</span>,
194
+ 65: {<span class="ruby-value str">&quot;app&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">PP_NS</span>} )
195
+ 66: <span class="ruby-identifier">coll</span>.<span class="ruby-identifier">accepts</span> = (<span class="ruby-identifier">accepts</span> <span class="ruby-value">? </span><span class="ruby-identifier">accepts</span>.<span class="ruby-identifier">text</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;entry&quot;</span>)
196
+ 67:
197
+ 68: <span class="ruby-ivar">@collections</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">coll</span>
198
+ 69: <span class="ruby-keyword kw">end</span>
199
+ 70: <span class="ruby-keyword kw">end</span>
200
+ </pre>
201
+ </div>
202
+ </div>
203
+ </div>
204
+
205
+
206
+ </div>
207
+
208
+
209
+ </div>
210
+
211
+
212
+ <div id="validator-badges">
213
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
214
+ </div>
215
+
216
+ </body>
217
+ </html>
@@ -0,0 +1,130 @@
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::Author</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::Author</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
+ <a href="Element.html">
69
+ Atom::Element
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ A person construct has the following child elements:
86
+ </p>
87
+ <table>
88
+ <tr><td valign="top">name (required):</td><td>a human-readable name
89
+
90
+ </td></tr>
91
+ <tr><td valign="top">uri:</td><td>an IRI associated with the person
92
+
93
+ </td></tr>
94
+ <tr><td valign="top">email:</td><td>an email address associated with the person
95
+
96
+ </td></tr>
97
+ </table>
98
+
99
+ </div>
100
+
101
+
102
+ </div>
103
+
104
+
105
+ </div>
106
+
107
+
108
+ <!-- if includes -->
109
+
110
+ <div id="section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+
121
+
122
+ </div>
123
+
124
+
125
+ <div id="validator-badges">
126
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -0,0 +1,128 @@
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::Category</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::Category</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 category has the following attributes:
84
+ </p>
85
+ <table>
86
+ <tr><td valign="top">term (required):</td><td>a string that identifies the category
87
+
88
+ </td></tr>
89
+ <tr><td valign="top">scheme:</td><td>an IRI that identifies a categorization scheme
90
+
91
+ </td></tr>
92
+ <tr><td valign="top">label:</td><td>a human-readable label
93
+
94
+ </td></tr>
95
+ </table>
96
+
97
+ </div>
98
+
99
+
100
+ </div>
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+
108
+ <div id="section">
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+
119
+
120
+ </div>
121
+
122
+
123
+ <div id="validator-badges">
124
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
125
+ </div>
126
+
127
+ </body>
128
+ </html>