atom-tools 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/Rakefile +1 -1
  2. data/doc/classes/Atom/AttrEl.html +163 -0
  3. data/doc/classes/Atom/Author.html +113 -0
  4. data/doc/classes/Atom/AutodiscoveryFailure.html +111 -0
  5. data/doc/classes/Atom/Categories.html +168 -0
  6. data/doc/classes/Atom/Category.html +137 -0
  7. data/doc/classes/Atom/Collection.html +425 -0
  8. data/doc/classes/Atom/Content.html +170 -0
  9. data/doc/classes/Atom/Contributor.html +113 -0
  10. data/doc/classes/Atom/Control.html +126 -0
  11. data/doc/classes/Atom/Converters.html +571 -0
  12. data/doc/classes/Atom/DigestAuth.html +285 -0
  13. data/doc/classes/Atom/Element.html +892 -0
  14. data/doc/classes/Atom/FileCache.html +287 -0
  15. data/doc/classes/Atom/HTTP.html +490 -0
  16. data/doc/classes/Atom/HTTPResponse.html +190 -0
  17. data/doc/classes/Atom/HasCategories.html +187 -0
  18. data/doc/classes/Atom/HasLinks.html +168 -0
  19. data/doc/classes/Atom/Link.html +214 -0
  20. data/doc/classes/Atom/NilCache.html +202 -0
  21. data/doc/classes/Atom/ParseError.html +111 -0
  22. data/doc/classes/Atom/Parsers.html +311 -0
  23. data/doc/classes/Atom/Person.html +130 -0
  24. data/doc/classes/Atom/Rights.html +113 -0
  25. data/doc/classes/Atom/Service.html +298 -0
  26. data/doc/classes/Atom/Source.html +111 -0
  27. data/doc/classes/Atom/Subtitle.html +113 -0
  28. data/doc/classes/Atom/Summary.html +113 -0
  29. data/doc/classes/Atom/Text.html +372 -0
  30. data/doc/classes/Atom/Title.html +113 -0
  31. data/doc/classes/Atom/Tools.html +525 -0
  32. data/doc/classes/Atom/Workspace.html +121 -0
  33. data/doc/classes/Object.html +204 -0
  34. data/doc/classes/XHTML.html +118 -0
  35. data/doc/created.rid +1 -0
  36. data/doc/files/README.html +173 -0
  37. data/doc/files/lib/atom/cache_rb.html +302 -0
  38. data/doc/files/lib/atom/collection_rb.html +109 -0
  39. data/doc/files/lib/atom/element_rb.html +110 -0
  40. data/doc/files/lib/atom/entry_rb.html +111 -0
  41. data/doc/files/lib/atom/feed_rb.html +111 -0
  42. data/doc/files/lib/atom/http_rb.html +114 -0
  43. data/doc/files/lib/atom/service_rb.html +112 -0
  44. data/doc/files/lib/atom/text_rb.html +109 -0
  45. data/doc/files/lib/atom/tools_rb.html +108 -0
  46. data/doc/fr_class_index.html +59 -0
  47. data/doc/fr_file_index.html +36 -0
  48. data/doc/fr_method_index.html +137 -0
  49. data/doc/index.html +24 -0
  50. data/doc/rdoc-style.css +208 -0
  51. data/lib/atom/cache.rb +1 -1
  52. data/lib/atom/http.rb +2 -2
  53. data/lib/atom/text.rb +15 -6
  54. data/spec/entry_spec.rb +12 -1
  55. data/spec/feed_spec.rb +20 -1
  56. data/spec/fixtures/contacts-feed.xml +34 -0
  57. data/spec/fixtures/entry-w-xml.xml +24 -0
  58. metadata +68 -5
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ atom-tools documentation
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>atom-tools documentation</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # used under the terms of the MIT license
5
5
 
6
- require "md5"
6
+ require "digest/md5"
7
7
 
8
8
  def normalize_header_names _headers
9
9
  headers = {}
@@ -5,7 +5,7 @@ require "cgi"
5
5
 
6
6
  require "atom/cache"
7
7
 
8
- require "sha1"
8
+ require "digest/sha1"
9
9
  require "digest/md5"
10
10
 
11
11
  module URI # :nodoc: all
@@ -17,7 +17,7 @@ class String # :nodoc:
17
17
  end
18
18
 
19
19
  module Atom
20
- TOOLS_VERSION = '2.0.4'
20
+ TOOLS_VERSION = '2.0.5'
21
21
  UA = "atom-tools " + TOOLS_VERSION
22
22
 
23
23
  module DigestAuth
@@ -41,8 +41,10 @@ module Atom
41
41
  x.name = x.name
42
42
  end
43
43
  end
44
- else
44
+ elsif ['text', 'html'].include?(type)
45
45
  c = x[0] ? x[0].value : nil
46
+ else
47
+ c = x
46
48
  end
47
49
  else
48
50
  c = x.to_s
@@ -53,9 +55,16 @@ module Atom
53
55
 
54
56
  on_build do |e,x|
55
57
  c = e.instance_variable_get('@content')
56
-
57
58
  if c.respond_to? :parent
58
- x << c.dup
59
+ if c.is_a?(REXML::Element) && c.name == 'content' # && !c.text.strip == ''
60
+ # c
61
+ c.children.each do |child_element|
62
+ x.add_element(child_element) unless child_element.is_a?(REXML::Text) && child_element.to_s.strip == ''
63
+ end
64
+ # x.add_text('') # unless child_element.to_s.strip == ''
65
+ else
66
+ x << c.dup
67
+ end
59
68
  elsif c
60
69
  x.text = c.to_s
61
70
  end
@@ -120,8 +129,8 @@ module Atom
120
129
  fixed = Hpricot(self.to_s, :xhtml_strict => true)
121
130
  xml = REXML::Document.new("<div>#{fixed}</div>").root
122
131
  else
123
- # XXX check that @type is an XML mimetype and parse it
124
- raise "I haven't implemented this yet"
132
+ # Not XHTML, HTML, or text - return the REXML::Element, leave it up to the user to parse the content
133
+ xml = @content
125
134
  end
126
135
 
127
136
  xml
@@ -188,7 +197,7 @@ module Atom
188
197
  # Atom::Content behaves the same as an Atom::Text, but for two things:
189
198
  #
190
199
  # * the "type" attribute can be an arbitrary media type
191
- # * there is a "src" attribute which is an IRI that points to the content of the entry (in which case the content element will be empty)
200
+ # * there is a "src" attribute which is an URI that points to the content of the entry (in which case the content element will be empty)
192
201
  class Content < Atom::Text
193
202
  is_atom_element :content
194
203
 
@@ -340,7 +340,6 @@ describe Atom::Entry do
340
340
  end
341
341
  end
342
342
 
343
-
344
343
  describe 'extensions' do
345
344
  before(:each) do
346
345
  @entry = Atom::Entry.parse(fixtures('entry-w-ext'))
@@ -350,4 +349,16 @@ describe Atom::Entry do
350
349
  @entry.to_s.should =~ /purl/
351
350
  end
352
351
  end
352
+
353
+ describe "with XML in the content element" do
354
+ it "should expose the content XML" do
355
+ @entry = Atom::Entry.parse(fixtures('entry-w-xml'))
356
+ @entry.content.xml.should be_instance_of(REXML::Element)
357
+ end
358
+
359
+ it "should expose the content XML" do
360
+ @entry = Atom::Entry.parse(fixtures('entry-w-xml'))
361
+ @entry.content.xml.root.name.should_not == 'content'
362
+ end
363
+ end
353
364
  end
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  require 'atom/feed'
4
4
 
5
- describe Atom::Entry do
5
+ describe Atom::Feed do
6
6
  describe 'extensions' do
7
7
  before(:each) do
8
8
  @feed = Atom::Feed.parse(fixtures('feed-w-ext'))
@@ -17,4 +17,23 @@ describe Atom::Entry do
17
17
  feed2.to_s.should =~ /purl/
18
18
  end
19
19
  end
20
+
21
+ before :each do
22
+ @feed = Atom::Feed.parse(fixtures('contacts-feed'))
23
+ end
24
+
25
+ describe "to_s" do
26
+ it "should only have one content element" do
27
+ result = @feed.to_s
28
+ result.scan("<content type=").size.should == 1
29
+ end
30
+ end
31
+
32
+ describe "to_xml" do
33
+ it "should only have one content element" do
34
+ result = @feed.to_xml
35
+ REXML::XPath.match(result, "//content").size.should == 1
36
+ end
37
+ end
38
+
20
39
  end
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <id>http://api.constantcontact.com/ws/customers/foo/contacts</id>
4
+ <title type="text">Contacts for Customer: Foo</title>
5
+ <link href="contacts"></link>
6
+ <link href="contacts" rel="self"></link>
7
+ <author>
8
+ <name>Foo</name>
9
+ </author>
10
+ <updated>2010-05-18T13:45:29.352Z</updated>
11
+ <link href="/ws/customers/Foo/contacts" rel="first"></link>
12
+ <link href="/ws/customers/Foo/contacts?email=tropix50%40hotmail.com" rel="current"></link>
13
+ <entry>
14
+ <link href="/ws/customers/Foo/contacts/42" rel="edit"></link>
15
+ <id>http://api.constantcontact.com/ws/customers/foo/contacts/42</id>
16
+ <title type="text">Contact: foo@example.com</title>
17
+ <updated>2010-05-18T13:45:29.372Z</updated>
18
+ <author>
19
+ <name>Constant Contact</name>
20
+ </author>
21
+ <content type="application/vnd.ctct+xml">
22
+ <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/foo/contacts/42">
23
+ <Status>Active</Status>
24
+ <EmailAddress>foo@example.com</EmailAddress>
25
+ <EmailType>HTML</EmailType>
26
+ <Name>Bar, Foo</Name>
27
+ <OptInTime>2008-09-22T15:03:18.894Z</OptInTime>
28
+ <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
29
+ <Confirmed>false</Confirmed>
30
+ <InsertTime>2008-09-22T15:03:18.894Z</InsertTime>
31
+ </Contact>
32
+ </content>
33
+ </entry>
34
+ </feed>
@@ -0,0 +1,24 @@
1
+ <entry xmlns="http://www.w3.org/2005/Atom">
2
+ <link href="/ws/customers/joesflowers/lists/1" rel="edit" />
3
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/lists/1</id>
4
+ <title type="text">General Interest</title>
5
+ <updated>2008-04-16T18:39:35.710Z</updated>
6
+ <content type="application/vnd.ctct+xml">
7
+ <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">
8
+ <OptInDefault>false</OptInDefault>
9
+ <Name>General Interest</Name>
10
+ <ShortName>General Interest</ShortName>
11
+ <SortOrder>1</SortOrder>
12
+ </ContactList>
13
+ </content>
14
+ <source>
15
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/lists</id>
16
+ <title type="text">Contact Lists</title>
17
+ <link href="" />
18
+ <link href="" rel="self" />
19
+ <author>
20
+ <name>Constant Contact Web Services</name>
21
+ </author>
22
+ <updated>2008-04-16T18:39:35.717Z</updated>
23
+ </source>
24
+ </entry>
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atom-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ hash: 5
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 0
9
+ - 5
10
+ version: 2.0.5
5
11
  platform: ruby
6
12
  authors:
7
13
  - Brendan Taylor
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-08-15 00:00:00 +00:00
18
+ date: 2010-08-31 00:00:00 -06:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -35,6 +41,55 @@ files:
35
41
  - bin/atom-post
36
42
  - bin/atom-purge
37
43
  - bin/atom-cp
44
+ - doc/files/lib/atom/tools_rb.html
45
+ - doc/files/lib/atom/feed_rb.html
46
+ - doc/files/lib/atom/text_rb.html
47
+ - doc/files/lib/atom/cache_rb.html
48
+ - doc/files/lib/atom/service_rb.html
49
+ - doc/files/lib/atom/element_rb.html
50
+ - doc/files/lib/atom/entry_rb.html
51
+ - doc/files/lib/atom/http_rb.html
52
+ - doc/files/lib/atom/collection_rb.html
53
+ - doc/files/README.html
54
+ - doc/index.html
55
+ - doc/rdoc-style.css
56
+ - doc/fr_method_index.html
57
+ - doc/fr_class_index.html
58
+ - doc/fr_file_index.html
59
+ - doc/created.rid
60
+ - doc/classes/Atom/Categories.html
61
+ - doc/classes/Atom/Parsers.html
62
+ - doc/classes/Atom/Service.html
63
+ - doc/classes/Atom/Author.html
64
+ - doc/classes/Atom/Element.html
65
+ - doc/classes/Atom/Tools.html
66
+ - doc/classes/Atom/FileCache.html
67
+ - doc/classes/Atom/DigestAuth.html
68
+ - doc/classes/Atom/Text.html
69
+ - doc/classes/Atom/ParseError.html
70
+ - doc/classes/Atom/Contributor.html
71
+ - doc/classes/Atom/Control.html
72
+ - doc/classes/Atom/HTTPResponse.html
73
+ - doc/classes/Atom/HTTP.html
74
+ - doc/classes/Atom/NilCache.html
75
+ - doc/classes/Atom/AutodiscoveryFailure.html
76
+ - doc/classes/Atom/Source.html
77
+ - doc/classes/Atom/Link.html
78
+ - doc/classes/Atom/Collection.html
79
+ - doc/classes/Atom/Content.html
80
+ - doc/classes/Atom/Category.html
81
+ - doc/classes/Atom/Converters.html
82
+ - doc/classes/Atom/Person.html
83
+ - doc/classes/Atom/Workspace.html
84
+ - doc/classes/Atom/HasCategories.html
85
+ - doc/classes/Atom/Title.html
86
+ - doc/classes/Atom/Rights.html
87
+ - doc/classes/Atom/AttrEl.html
88
+ - doc/classes/Atom/Subtitle.html
89
+ - doc/classes/Atom/Summary.html
90
+ - doc/classes/Atom/HasLinks.html
91
+ - doc/classes/Object.html
92
+ - doc/classes/XHTML.html
38
93
  - test/test_constructs.rb
39
94
  - test/runtests.rb
40
95
  - test/test_feed.rb
@@ -53,7 +108,9 @@ files:
53
108
  - spec/feed_spec.rb
54
109
  - spec/fixtures/feed-w-ext.xml
55
110
  - spec/fixtures/service-w-xhtml-ns.xml
111
+ - spec/fixtures/entry-w-xml.xml
56
112
  - spec/fixtures/entry-w-ext.xml
113
+ - spec/fixtures/contacts-feed.xml
57
114
  - spec/fixtures/service.xml
58
115
  - spec/fixtures/entry.xml
59
116
  - spec/service_spec.rb
@@ -76,21 +133,27 @@ rdoc_options: []
76
133
  require_paths:
77
134
  - lib
78
135
  required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
79
137
  requirements:
80
138
  - - ">="
81
139
  - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
82
143
  version: "0"
83
- version:
84
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
85
146
  requirements:
86
147
  - - ">="
87
148
  - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
88
152
  version: "0"
89
- version:
90
153
  requirements: []
91
154
 
92
155
  rubyforge_project: ibes
93
- rubygems_version: 1.3.2
156
+ rubygems_version: 1.3.7
94
157
  signing_key:
95
158
  specification_version: 3
96
159
  summary: Tools for working with Atom Entries, Feeds and Collections.