atom-tools 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/README +2 -2
  2. data/Rakefile +1 -1
  3. data/bin/atom-client.rb +71 -45
  4. data/lib/atom/element.rb +7 -2
  5. data/lib/atom/entry.rb +51 -16
  6. data/lib/atom/feed.rb +6 -6
  7. data/lib/atom/http.rb +23 -19
  8. data/lib/atom/service.rb +0 -2
  9. data/lib/atom/text.rb +34 -12
  10. data/lib/atom/xml.rb +26 -17
  11. data/lib/atom/yaml.rb +23 -8
  12. data/test/test_constructs.rb +16 -2
  13. data/test/test_general.rb +22 -9
  14. data/test/test_http.rb +12 -8
  15. data/test/test_xml.rb +66 -20
  16. metadata +4 -40
  17. data/doc/classes/Atom/Author.html +0 -130
  18. data/doc/classes/Atom/Category.html +0 -128
  19. data/doc/classes/Atom/Collection.html +0 -322
  20. data/doc/classes/Atom/Content.html +0 -129
  21. data/doc/classes/Atom/Contributor.html +0 -119
  22. data/doc/classes/Atom/DigestAuth.html +0 -285
  23. data/doc/classes/Atom/Element.html +0 -325
  24. data/doc/classes/Atom/Entry.html +0 -369
  25. data/doc/classes/Atom/Feed.html +0 -595
  26. data/doc/classes/Atom/HTTP.html +0 -436
  27. data/doc/classes/Atom/HTTPResponse.html +0 -149
  28. data/doc/classes/Atom/Link.html +0 -137
  29. data/doc/classes/Atom/Service.html +0 -260
  30. data/doc/classes/Atom/Text.html +0 -245
  31. data/doc/classes/Atom/Workspace.html +0 -121
  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/collection_rb.html +0 -110
  36. data/doc/files/lib/atom/element_rb.html +0 -109
  37. data/doc/files/lib/atom/entry_rb.html +0 -111
  38. data/doc/files/lib/atom/feed_rb.html +0 -112
  39. data/doc/files/lib/atom/http_rb.html +0 -112
  40. data/doc/files/lib/atom/service_rb.html +0 -111
  41. data/doc/files/lib/atom/text_rb.html +0 -109
  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 -42
  45. data/doc/fr_file_index.html +0 -36
  46. data/doc/fr_method_index.html +0 -69
  47. data/doc/index.html +0 -24
  48. data/doc/rdoc-style.css +0 -208
@@ -1,436 +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/http_rb.html">
59
- lib/atom/http.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
- An object which handles the details of <a href="HTTP.html">HTTP</a> -
84
- particularly authentication and caching (neither of which are fully
85
- implemented).
86
- </p>
87
- <p>
88
- This object can be used on its own, or passed to an <a
89
- href="Service.html">Atom::Service</a>, <a
90
- href="Collection.html">Atom::Collection</a> or <a
91
- href="Feed.html">Atom::Feed</a>, where it will be used for requests.
92
- </p>
93
- <p>
94
- All its <a href="HTTP.html">HTTP</a> methods return a Net::HTTPResponse
95
- </p>
96
-
97
- </div>
98
-
99
-
100
- </div>
101
-
102
- <div id="method-list">
103
- <h3 class="section-bar">Methods</h3>
104
-
105
- <div class="name-list">
106
- <a href="#M000026">delete</a>&nbsp;&nbsp;
107
- <a href="#M000023">get</a>&nbsp;&nbsp;
108
- <a href="#M000028">get_atom_entry</a>&nbsp;&nbsp;
109
- <a href="#M000024">post</a>&nbsp;&nbsp;
110
- <a href="#M000025">put</a>&nbsp;&nbsp;
111
- <a href="#M000029">put_atom_entry</a>&nbsp;&nbsp;
112
- <a href="#M000027">when_auth</a>&nbsp;&nbsp;
113
- </div>
114
- </div>
115
-
116
- </div>
117
-
118
-
119
- <!-- if includes -->
120
- <div id="includes">
121
- <h3 class="section-bar">Included Modules</h3>
122
-
123
- <div id="includes-list">
124
- <span class="include-name"><a href="DigestAuth.html">DigestAuth</a></span>
125
- </div>
126
- </div>
127
-
128
- <div id="section">
129
-
130
-
131
-
132
-
133
-
134
- <div id="attribute-list">
135
- <h3 class="section-bar">Attributes</h3>
136
-
137
- <div class="name-list">
138
- <table>
139
- <tr class="top-aligned-row context-row">
140
- <td class="context-item-name">allow_all_redirects</td>
141
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
142
- <td class="context-item-desc">
143
- automatically handle redirects, even for POST/PUT/DELETE requests?
144
-
145
- <p>
146
- defaults to false, which will transparently redirect GET requests but
147
- return a Net::HTTPRedirection object when the server indicates to redirect
148
- a POST/PUT/DELETE
149
- </p>
150
- </td>
151
- </tr>
152
- <tr class="top-aligned-row context-row">
153
- <td class="context-item-name">always_auth</td>
154
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
155
- <td class="context-item-desc">
156
- when set to :basic, :wsse or :authsub, this will send an Authentication
157
- header with every request instead of waiting for a challenge from the
158
- server.
159
-
160
- <p>
161
- be careful; always_auth :basic will send your username and password in
162
- plain text to every URL this object requests.
163
- </p>
164
- <p>
165
- :digest won&#8216;t work, since Digest authentication requires an initial
166
- challenge to generate a response
167
- </p>
168
- <p>
169
- defaults to nil
170
- </p>
171
- </td>
172
- </tr>
173
- <tr class="top-aligned-row context-row">
174
- <td class="context-item-name">pass</td>
175
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
176
- <td class="context-item-desc">
177
- used by the default <a href="HTTP.html#M000027">when_auth</a>
178
-
179
- </td>
180
- </tr>
181
- <tr class="top-aligned-row context-row">
182
- <td class="context-item-name">token</td>
183
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
184
- <td class="context-item-desc">
185
- the token used for Google&#8216;s AuthSub authentication
186
-
187
- </td>
188
- </tr>
189
- <tr class="top-aligned-row context-row">
190
- <td class="context-item-name">user</td>
191
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
192
- <td class="context-item-desc">
193
- used by the default <a href="HTTP.html#M000027">when_auth</a>
194
-
195
- </td>
196
- </tr>
197
- </table>
198
- </div>
199
- </div>
200
-
201
-
202
-
203
- <!-- if method_list -->
204
- <div id="methods">
205
- <h3 class="section-bar">Public Instance methods</h3>
206
-
207
- <div id="method-M000026" class="method-detail">
208
- <a name="M000026"></a>
209
-
210
- <div class="method-heading">
211
- <a href="#M000026" class="method-signature">
212
- <span class="method-name">delete</span><span class="method-args">(url, body = nil, headers = {})</span>
213
- </a>
214
- </div>
215
-
216
- <div class="method-description">
217
- <p>
218
- DELETEs to url
219
- </p>
220
- <p><a class="source-toggle" href="#"
221
- onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000026-source">
223
- <pre>
224
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 165</span>
225
- 165: <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> = {}
226
- 166: <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>)
227
- 167: <span class="ruby-keyword kw">end</span>
228
- </pre>
229
- </div>
230
- </div>
231
- </div>
232
-
233
- <div id="method-M000023" class="method-detail">
234
- <a name="M000023"></a>
235
-
236
- <div class="method-heading">
237
- <a href="#M000023" class="method-signature">
238
- <span class="method-name">get</span><span class="method-args">(url, headers = {})</span>
239
- </a>
240
- </div>
241
-
242
- <div class="method-description">
243
- <p>
244
- GETs an url
245
- </p>
246
- <p><a class="source-toggle" href="#"
247
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
248
- <div class="method-source-code" id="M000023-source">
249
- <pre>
250
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 150</span>
251
- 150: <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> = {}
252
- 151: <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>)
253
- 152: <span class="ruby-keyword kw">end</span>
254
- </pre>
255
- </div>
256
- </div>
257
- </div>
258
-
259
- <div id="method-M000028" class="method-detail">
260
- <a name="M000028"></a>
261
-
262
- <div class="method-heading">
263
- <a href="#M000028" class="method-signature">
264
- <span class="method-name">get_atom_entry</span><span class="method-args">(url)</span>
265
- </a>
266
- </div>
267
-
268
- <div class="method-description">
269
- <p>
270
- GET a URL and turn it into an <a href="Entry.html">Atom::Entry</a>
271
- </p>
272
- <p><a class="source-toggle" href="#"
273
- onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
274
- <div class="method-source-code" id="M000028-source">
275
- <pre>
276
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 186</span>
277
- 186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_atom_entry</span>(<span class="ruby-identifier">url</span>)
278
- 187: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-value str">&quot;Accept&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/atom+xml&quot;</span>)
279
- 188:
280
- 189: <span class="ruby-comment cmt"># be picky for atom:entrys</span>
281
- 190: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">validate_content_type</span>( [ <span class="ruby-value str">&quot;application/atom+xml&quot;</span> ] )
282
- 191:
283
- 192: <span class="ruby-comment cmt"># XXX handle other HTTP codes</span>
284
- 193: <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>
285
- 194: <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>
286
- 195: <span class="ruby-keyword kw">end</span>
287
- 196:
288
- 197: <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>)
289
- 198: <span class="ruby-keyword kw">end</span>
290
- </pre>
291
- </div>
292
- </div>
293
- </div>
294
-
295
- <div id="method-M000024" class="method-detail">
296
- <a name="M000024"></a>
297
-
298
- <div class="method-heading">
299
- <a href="#M000024" class="method-signature">
300
- <span class="method-name">post</span><span class="method-args">(url, body, headers = {})</span>
301
- </a>
302
- </div>
303
-
304
- <div class="method-description">
305
- <p>
306
- POSTs body to an url
307
- </p>
308
- <p><a class="source-toggle" href="#"
309
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
310
- <div class="method-source-code" id="M000024-source">
311
- <pre>
312
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 155</span>
313
- 155: <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> = {}
314
- 156: <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>)
315
- 157: <span class="ruby-keyword kw">end</span>
316
- </pre>
317
- </div>
318
- </div>
319
- </div>
320
-
321
- <div id="method-M000025" class="method-detail">
322
- <a name="M000025"></a>
323
-
324
- <div class="method-heading">
325
- <a href="#M000025" class="method-signature">
326
- <span class="method-name">put</span><span class="method-args">(url, body, headers = {})</span>
327
- </a>
328
- </div>
329
-
330
- <div class="method-description">
331
- <p>
332
- PUTs body to an url
333
- </p>
334
- <p><a class="source-toggle" href="#"
335
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
336
- <div class="method-source-code" id="M000025-source">
337
- <pre>
338
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 160</span>
339
- 160: <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> = {}
340
- 161: <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>)
341
- 162: <span class="ruby-keyword kw">end</span>
342
- </pre>
343
- </div>
344
- </div>
345
- </div>
346
-
347
- <div id="method-M000029" class="method-detail">
348
- <a name="M000029"></a>
349
-
350
- <div class="method-heading">
351
- <a href="#M000029" class="method-signature">
352
- <span class="method-name">put_atom_entry</span><span class="method-args">(entry, url = entry.edit_url)</span>
353
- </a>
354
- </div>
355
-
356
- <div class="method-description">
357
- <p>
358
- PUT an <a href="Entry.html">Atom::Entry</a> to a URL
359
- </p>
360
- <p><a class="source-toggle" href="#"
361
- onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
362
- <div class="method-source-code" id="M000029-source">
363
- <pre>
364
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 201</span>
365
- 201: <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>)
366
- 202: <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>
367
- 203: <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> }
368
- 204:
369
- 205: <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>)
370
- 206: <span class="ruby-keyword kw">end</span>
371
- </pre>
372
- </div>
373
- </div>
374
- </div>
375
-
376
- <div id="method-M000027" class="method-detail">
377
- <a name="M000027"></a>
378
-
379
- <div class="method-heading">
380
- <a href="#M000027" class="method-signature">
381
- <span class="method-name">when_auth</span><span class="method-args">( {|abs_url, realm| ...}</span>
382
- </a>
383
- </div>
384
-
385
- <div class="method-description">
386
- <p>
387
- a block that will be called when a remote server responds with 401
388
- Unauthorized, so that your application can prompt for authentication
389
- details.
390
- </p>
391
- <p>
392
- the default is to use the values of @user and @pass.
393
- </p>
394
- <p>
395
- your block will be called with two parameters
396
- </p>
397
- <table>
398
- <tr><td valign="top">abs_url:</td><td>the base URL of the request URL
399
-
400
- </td></tr>
401
- <tr><td valign="top">realm:</td><td>the realm used in the WWW-Authenticate header
402
-
403
- </td></tr>
404
- </table>
405
- <p>
406
- (will be nil if there is no WWW-Authenticate header)
407
- </p>
408
- <p>
409
- it should return a value of the form [username, password]
410
- </p>
411
- <p><a class="source-toggle" href="#"
412
- onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
413
- <div class="method-source-code" id="M000027-source">
414
- <pre>
415
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 181</span>
416
- 181: <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> <span class="ruby-comment cmt"># :yields: abs_url, realm</span>
417
- 182: <span class="ruby-ivar">@get_auth_details</span> = <span class="ruby-identifier">block</span>
418
- 183: <span class="ruby-keyword kw">end</span>
419
- </pre>
420
- </div>
421
- </div>
422
- </div>
423
-
424
-
425
- </div>
426
-
427
-
428
- </div>
429
-
430
-
431
- <div id="validator-badges">
432
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
433
- </div>
434
-
435
- </body>
436
- </html>
@@ -1,149 +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>Module: Atom::HTTPResponse</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>Module</strong></td>
53
- <td class="class-name-in-header">Atom::HTTPResponse</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/atom/http_rb.html">
59
- lib/atom/http.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
-
76
-
77
- </div>
78
-
79
- <div id="method-list">
80
- <h3 class="section-bar">Methods</h3>
81
-
82
- <div class="name-list">
83
- <a href="#M000005">validate_content_type</a>&nbsp;&nbsp;
84
- </div>
85
- </div>
86
-
87
- </div>
88
-
89
-
90
- <!-- if includes -->
91
-
92
- <div id="section">
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <!-- if method_list -->
102
- <div id="methods">
103
- <h3 class="section-bar">Public Instance methods</h3>
104
-
105
- <div id="method-M000005" class="method-detail">
106
- <a name="M000005"></a>
107
-
108
- <div class="method-heading">
109
- <a href="#M000005" class="method-signature">
110
- <span class="method-name">validate_content_type</span><span class="method-args">( valid )</span>
111
- </a>
112
- </div>
113
-
114
- <div class="method-description">
115
- <p>
116
- this should probably support ranges (eg. text/*)
117
- </p>
118
- <p><a class="source-toggle" href="#"
119
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
120
- <div class="method-source-code" id="M000005-source">
121
- <pre>
122
- <span class="ruby-comment cmt"># File lib/atom/http.rb, line 319</span>
123
- 319: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_content_type</span>( <span class="ruby-identifier">valid</span> )
124
- 320: <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;HTTP response contains no Content-Type!&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">content_type</span>
125
- 321:
126
- 322: <span class="ruby-identifier">media_type</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;;&quot;</span>).<span class="ruby-identifier">first</span>
127
- 323:
128
- 324: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid</span>.<span class="ruby-identifier">member?</span> <span class="ruby-identifier">media_type</span>.<span class="ruby-identifier">downcase</span>
129
- 325: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Atom</span><span class="ruby-operator">::</span><span class="ruby-constant">WrongMimetype</span>, <span class="ruby-node">&quot;unexpected response Content-Type: #{media_type.inspect}. should be one of: #{valid.inspect}&quot;</span>
130
- 326: <span class="ruby-keyword kw">end</span>
131
- 327: <span class="ruby-keyword kw">end</span>
132
- </pre>
133
- </div>
134
- </div>
135
- </div>
136
-
137
-
138
- </div>
139
-
140
-
141
- </div>
142
-
143
-
144
- <div id="validator-badges">
145
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
146
- </div>
147
-
148
- </body>
149
- </html>