ratom-instructure 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +135 -0
- data/LICENSE +20 -0
- data/README.rdoc +293 -0
- data/Rakefile +59 -0
- data/VERSION.yml +5 -0
- data/lib/atom.rb +796 -0
- data/lib/atom/configuration.rb +24 -0
- data/lib/atom/pub.rb +251 -0
- data/lib/atom/version.rb +7 -0
- data/lib/atom/xml/parser.rb +413 -0
- data/ratom.gemspec +95 -0
- data/spec/app/member_entry.atom +31 -0
- data/spec/app/service.xml +36 -0
- data/spec/app/service_xml_base.xml +37 -0
- data/spec/atom/pub_spec.rb +517 -0
- data/spec/atom_spec.rb +1385 -0
- data/spec/conformance/baseuri.atom +19 -0
- data/spec/conformance/divtest.atom +32 -0
- data/spec/conformance/linktests.xml +103 -0
- data/spec/conformance/nondefaultnamespace-baseline.atom +25 -0
- data/spec/conformance/nondefaultnamespace-xhtml.atom +25 -0
- data/spec/conformance/nondefaultnamespace.atom +25 -0
- data/spec/conformance/ordertest.xml +112 -0
- data/spec/conformance/title/html-cdata.atom +22 -0
- data/spec/conformance/title/html-entity.atom +22 -0
- data/spec/conformance/title/html-ncr.atom +22 -0
- data/spec/conformance/title/text-cdata.atom +22 -0
- data/spec/conformance/title/text-entity.atom +21 -0
- data/spec/conformance/title/text-ncr.atom +21 -0
- data/spec/conformance/title/xhtml-entity.atom +21 -0
- data/spec/conformance/title/xhtml-ncr.atom +21 -0
- data/spec/conformance/unknown-namespace.atom +25 -0
- data/spec/conformance/xmlbase.atom +133 -0
- data/spec/fixtures/complex_single_entry.atom +45 -0
- data/spec/fixtures/created_entry.atom +31 -0
- data/spec/fixtures/entry.atom +30 -0
- data/spec/fixtures/entry_with_custom_extensions.atom +8 -0
- data/spec/fixtures/entry_with_simple_extensions.atom +31 -0
- data/spec/fixtures/entry_with_single_custom_extension.atom +6 -0
- data/spec/fixtures/multiple_entry.atom +0 -0
- data/spec/fixtures/simple_single_entry.atom +21 -0
- data/spec/fixtures/with_stylesheet.atom +8 -0
- data/spec/paging/first_paged_feed.atom +21 -0
- data/spec/paging/last_paged_feed.atom +21 -0
- data/spec/paging/middle_paged_feed.atom +22 -0
- data/spec/property.rb +31 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +46 -0
- metadata +147 -0
data/History.txt
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
== 0.6.9
|
2
|
+
|
3
|
+
* SSL support [kossnocorp]
|
4
|
+
|
5
|
+
== 0.6.8
|
6
|
+
|
7
|
+
* Better auth-hmac detection.
|
8
|
+
* Handles Ruby 1.9 arrays. [wilkie]
|
9
|
+
|
10
|
+
== 0.6.7
|
11
|
+
|
12
|
+
* Handle dashes in extension names.
|
13
|
+
|
14
|
+
== 0.6.6
|
15
|
+
|
16
|
+
* Added support for absoluting relative uris using xml:base. [Greg Campbell]
|
17
|
+
|
18
|
+
== 0.6.5
|
19
|
+
|
20
|
+
* Fixed missing version.rb, now loads version.yml. [Greg Campbell]
|
21
|
+
|
22
|
+
== 0.6.4
|
23
|
+
|
24
|
+
* Remove Hoe dependency and converted to a Jeweler based project build.
|
25
|
+
* Fixed error when assigning nil to node['xml:lang'] [George Guimarães].
|
26
|
+
* Handle link@title. [Brian Dewey]
|
27
|
+
* SimpleExtensions#[] returns a namespace hash if localname is not given. [Daniel Vartanov]
|
28
|
+
|
29
|
+
== 0.6.3 2009-11-19
|
30
|
+
|
31
|
+
* Removed extraneous logging.
|
32
|
+
|
33
|
+
== 0.6.2 2009-06-19
|
34
|
+
|
35
|
+
* Handle href and fixed on service doc categories.
|
36
|
+
* Use request_uri instead of path so that we get any query parameters too. [Wybo Wiersma]
|
37
|
+
* Doc Patches.
|
38
|
+
|
39
|
+
== 0.6.1 2009-03-27
|
40
|
+
|
41
|
+
Some minor exception fixes.
|
42
|
+
|
43
|
+
* Removed Atom::ParseError. Parse errors now will only throw ArgumentError.
|
44
|
+
* ProtocolError has a to string method.
|
45
|
+
|
46
|
+
== 0.6.0 2009-03-19
|
47
|
+
|
48
|
+
* Now depends on libxml-ruby 1.1.2.
|
49
|
+
* Added support for hreflang on links. (David Arango)
|
50
|
+
* Update to work with latest version of libxml-ruby. (oortle & me)
|
51
|
+
* Content::Text and Content::Xhtml can now be created with String's like Content::Html.
|
52
|
+
* Make sure Atom::Generator outputs the generator name as the text of the element.
|
53
|
+
|
54
|
+
== 0.5.2 2008-12-06
|
55
|
+
|
56
|
+
* Remove whitespace modification in content. (dlisboa)
|
57
|
+
|
58
|
+
== 0.5.1 2008-08-05
|
59
|
+
|
60
|
+
* Added optional AuthHMAC support
|
61
|
+
|
62
|
+
== 0.5.0 2008-07-28
|
63
|
+
|
64
|
+
* Fix bug where processing instructions break parsing.
|
65
|
+
* Added Custom extension element classes. (Ignacio Carrera)
|
66
|
+
|
67
|
+
== 0.4.2 2008-07-09
|
68
|
+
|
69
|
+
* Update to libxml-ruby version 0.8.x
|
70
|
+
|
71
|
+
== 0.4.1 2008-07-09
|
72
|
+
|
73
|
+
* Update to libxml-ruby version 0.6.0.
|
74
|
+
|
75
|
+
== 0.4.0 2008-06-26
|
76
|
+
|
77
|
+
* Support for HTTP Basic Authentication.
|
78
|
+
|
79
|
+
== 0.3.7 2008-06-05
|
80
|
+
|
81
|
+
* Support XML in extension elements. (Min Kim)
|
82
|
+
|
83
|
+
== 0.3.6 2008-05-15
|
84
|
+
|
85
|
+
* Added categories to feeds.
|
86
|
+
* Make sure atom:content appears at the end of a atom:entry.
|
87
|
+
* Don't use namespace prefixes on content unless we really have to.
|
88
|
+
|
89
|
+
== 0.3.5 2008-05-03
|
90
|
+
|
91
|
+
* Make sure atom:entries appears last.
|
92
|
+
* Better examples in the documentation. Docs for Feed and Entry list attributes.
|
93
|
+
* Gave Feeds authors and contributors.
|
94
|
+
* Fixed a couple warnings.
|
95
|
+
|
96
|
+
== 0.3.4 2008-04-21
|
97
|
+
|
98
|
+
* Remove useless variable warning. (Sam Roberts)
|
99
|
+
* Support initialization of Atom::Source from Hash and block.
|
100
|
+
* Support initialization of Atom::Generator from Hash and block.
|
101
|
+
|
102
|
+
== 0.3.3 2008-04-09
|
103
|
+
|
104
|
+
* Better serialization of namespaced elements. ratom will now generate prefixes for namespaces and write them as
|
105
|
+
attributes on the root element.
|
106
|
+
* Extensions read as attributes are now written as attributes.
|
107
|
+
* When programmatically setting an extension value you can tell ratom to write it as an attribute using:
|
108
|
+
|
109
|
+
entry['http://example.org', 'extattr'].as_attribute = true
|
110
|
+
|
111
|
+
* Add support for atom:category.
|
112
|
+
* Support extension attributes using the same mechanism as extension elements.
|
113
|
+
|
114
|
+
== 0.3.1 2008-04-02
|
115
|
+
|
116
|
+
* Bunch of fixes to the Atom::Pub classes to make them work like the Atom classes
|
117
|
+
with respect to initializers and to_xml.
|
118
|
+
|
119
|
+
== 0.3.0 2008-04-02
|
120
|
+
|
121
|
+
* Raise Atom::Serialization error when you try and serialize non-utf8 content.
|
122
|
+
* Support reading simple extension elements, see README.txt.
|
123
|
+
* Support writing simple extension elements, see README.txt.
|
124
|
+
|
125
|
+
== 0.2.2 2008-02-10
|
126
|
+
|
127
|
+
* Removed dependency on ActiveSupport.
|
128
|
+
|
129
|
+
== 0.2.1 2008-03-03
|
130
|
+
|
131
|
+
* Initial release to the public.
|
132
|
+
|
133
|
+
== < 0.2.1
|
134
|
+
|
135
|
+
* Internal releases.
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Peerworks
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,293 @@
|
|
1
|
+
= rAtom
|
2
|
+
|
3
|
+
rAtom is a library for working with the Atom Syndication Format and
|
4
|
+
the Atom Publishing Protocol (APP).
|
5
|
+
|
6
|
+
* Built using libxml so it is _much_ faster than a REXML based library.
|
7
|
+
* Uses the libxml pull parser so it has much lighter memory usage.
|
8
|
+
* Supports {RFC 5005}[http://www.ietf.org/rfc/rfc5005.txt] for feed pagination.
|
9
|
+
|
10
|
+
rAtom was originally built to support the communication between a number of applications
|
11
|
+
built by Peerworks[http://peerworks.org], via the Atom Publishing protocol. However, it
|
12
|
+
supports, or aims to support, all the Atom Syndication Format and Publication Protocol
|
13
|
+
and can be used to access Atom feeds or to script publishing entries to a blog supporting APP.
|
14
|
+
|
15
|
+
== Prerequisites
|
16
|
+
|
17
|
+
* libxml-ruby, >= 1.1.2
|
18
|
+
* rspec (Only required for tests)
|
19
|
+
|
20
|
+
libxml-ruby in turn requires the libxml2 library to be installed. libxml2 can be downloaded
|
21
|
+
from http://xmlsoft.org/downloads.html or installed using whatever tools are provided by your
|
22
|
+
platform. At least version 2.6.31 is required.
|
23
|
+
|
24
|
+
=== Mac OSX
|
25
|
+
|
26
|
+
Mac OSX by default comes with an old version of libxml2 that will not work with rAtom. You
|
27
|
+
will need to install a more recent version. If you are using Macports:
|
28
|
+
|
29
|
+
port install libxml2
|
30
|
+
|
31
|
+
== Installation
|
32
|
+
|
33
|
+
You can install via gem using:
|
34
|
+
|
35
|
+
gem install ratom
|
36
|
+
|
37
|
+
== Usage
|
38
|
+
|
39
|
+
To fetch a parse an Atom Feed you can simply:
|
40
|
+
|
41
|
+
feed = Atom::Feed.load_feed(URI.parse("http://example.com/feed.atom"))
|
42
|
+
|
43
|
+
And then iterate over the entries in the feed using:
|
44
|
+
|
45
|
+
feed.each_entry do |entry|
|
46
|
+
# do cool stuff
|
47
|
+
end
|
48
|
+
|
49
|
+
To construct the following example Feed is from the Atom spec:
|
50
|
+
|
51
|
+
<?xml version="1.0" encoding="utf-8"?>
|
52
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
53
|
+
|
54
|
+
<title>Example Feed</title>
|
55
|
+
<link href="http://example.org/"/>
|
56
|
+
<updated>2003-12-13T18:30:02Z</updated>
|
57
|
+
<author>
|
58
|
+
<name>John Doe</name>
|
59
|
+
</author>
|
60
|
+
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
|
61
|
+
|
62
|
+
<entry>
|
63
|
+
<title>Atom-Powered Robots Run Amok</title>
|
64
|
+
<link href="http://example.org/2003/12/13/atom03"/>
|
65
|
+
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
|
66
|
+
<updated>2003-12-13T18:30:02Z</updated>
|
67
|
+
<summary>Some text.</summary>
|
68
|
+
</entry>
|
69
|
+
|
70
|
+
</feed>
|
71
|
+
|
72
|
+
To build this in rAtom we would do:
|
73
|
+
|
74
|
+
feed = Atom::Feed.new do |f|
|
75
|
+
f.title = "Example Feed"
|
76
|
+
f.links << Atom::Link.new(:href => "http://example.org/")
|
77
|
+
f.updated = Time.parse('2003-12-13T18:30:02Z')
|
78
|
+
f.authors << Atom::Person.new(:name => 'John Doe')
|
79
|
+
f.id = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
|
80
|
+
f.entries << Atom::Entry.new do |e|
|
81
|
+
e.title = "Atom-Powered Robots Run Amok"
|
82
|
+
e.links << Atom::Link.new(:href => "http://example.org/2003/12/13/atom03")
|
83
|
+
e.id = "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
|
84
|
+
e.updated = Time.parse('2003-12-13T18:30:02Z')
|
85
|
+
e.summary = "Some text."
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
To output the Feed as XML use to_xml
|
90
|
+
|
91
|
+
> puts feed.to_xml
|
92
|
+
<?xml version="1.0"?>
|
93
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
94
|
+
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
|
95
|
+
<title>Example Feed</title>
|
96
|
+
<updated>2003-12-13T18:30:02Z</updated>
|
97
|
+
<link href="http://example.org/"/>
|
98
|
+
<author>
|
99
|
+
<name>John Doe</name>
|
100
|
+
</author>
|
101
|
+
<entry>
|
102
|
+
<title>Atom-Powered Robots Run Amok</title>
|
103
|
+
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
|
104
|
+
<summary>Some text.</summary>
|
105
|
+
<updated>2003-12-13T18:30:02Z</updated>
|
106
|
+
<link href="http://example.org/2003/12/13/atom03"/>
|
107
|
+
</entry>
|
108
|
+
</feed>
|
109
|
+
|
110
|
+
|
111
|
+
See Feed and Entry for details on the methods and attributes of those classes.
|
112
|
+
|
113
|
+
=== Publishing
|
114
|
+
|
115
|
+
To publish to a remote feed using the Atom Publishing Protocol, first you need to create a collection to publish to:
|
116
|
+
|
117
|
+
require 'atom/pub'
|
118
|
+
|
119
|
+
collection = Atom::Pub::Collection.new(:href => 'http://example.org/myblog')
|
120
|
+
|
121
|
+
Then create a new entry
|
122
|
+
|
123
|
+
entry = Atom::Entry.new do |entry|
|
124
|
+
entry.title = "I have discovered rAtom"
|
125
|
+
entry.authors << Atom::Person.new(:name => 'A happy developer')
|
126
|
+
entry.updated = Time.now
|
127
|
+
entry.id = "http://example.org/myblog/newpost"
|
128
|
+
entry.content = Atom::Content::Html.new("<p>rAtom lets me post to my blog using Ruby, how cool!</p>")
|
129
|
+
end
|
130
|
+
|
131
|
+
And publish it to the Collection:
|
132
|
+
|
133
|
+
published_entry = collection.publish(entry)
|
134
|
+
|
135
|
+
Publish returns an updated entry filled out with any attributes to server may have set, including information
|
136
|
+
required to let us update to the entry. For example, lets change the content and republished:
|
137
|
+
|
138
|
+
published_entry.content = Atom::Content::Html.new("<p>rAtom lets me post to and edit my blog using Ruby, how cool!</p>")
|
139
|
+
published_entry.updated = Time.now
|
140
|
+
published_entry.save!
|
141
|
+
|
142
|
+
To update an existing Entry:
|
143
|
+
|
144
|
+
existing_entry = Entry.load_entry(URI.parse("http://example.org/afeedentry.atom"))
|
145
|
+
|
146
|
+
existing_entry.title = "I have discovered rAtom"
|
147
|
+
existing_entry.updated = Time.now
|
148
|
+
existing_entry.save!
|
149
|
+
|
150
|
+
You can also delete an entry using the <tt>destroy!</tt> method, but we won't do that will we?.
|
151
|
+
|
152
|
+
=== Extension elements
|
153
|
+
|
154
|
+
As of version 0.3.0, rAtom support simple extension elements on feeds and entries. As defined in the Atom Syndication Format,
|
155
|
+
simple extension elements consist of XML elements from a non-Atom namespace that have no attributes or child elements, i.e.
|
156
|
+
they are empty or only contain text content. These elements are treated as a name value pair where the element namespace
|
157
|
+
and local name make up the key and the content of the element is the value, empty elements will be treated as an empty string.
|
158
|
+
|
159
|
+
To access extension elements use the [] method on the Feed or Entry. For example, if we are parsing the follow Atom document
|
160
|
+
with extensions:
|
161
|
+
|
162
|
+
<?xml version="1.0"?>
|
163
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ex="http://example.org">
|
164
|
+
<title>Feed with extensions</title>
|
165
|
+
<ex:myelement>Something important</ex:myelement>
|
166
|
+
</feed>
|
167
|
+
|
168
|
+
We could then access the extension element on the feed using:
|
169
|
+
|
170
|
+
> feed["http://example.org", "myelement"]
|
171
|
+
=> ["Something important"]
|
172
|
+
|
173
|
+
Note that the return value is an array. This is because XML allows multiple instances of the element.
|
174
|
+
|
175
|
+
To set an extension element you append to the array:
|
176
|
+
|
177
|
+
> feed['http://example.org', 'myelement'] << 'Something less important'
|
178
|
+
=> ["Something important", "Something less important"]
|
179
|
+
|
180
|
+
You can then call to_xml and rAtom will serialize the extension elements into xml.
|
181
|
+
|
182
|
+
> puts feed.to_xml
|
183
|
+
<?xml version="1.0"?>
|
184
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
185
|
+
<myelement xmlns="http://example.org">Something important</myelement>
|
186
|
+
<myelement xmlns="http://example.org">Something less important</myelement>
|
187
|
+
</feed>
|
188
|
+
|
189
|
+
Notice that the output repeats the xmlns attribute for each of the extensions, this is semantically the same the input XML, just a bit
|
190
|
+
ugly. It seems to be a limitation of the libxml-Ruby API. But if anyone knows a work around I'd gladly accept a patch (or even advice).
|
191
|
+
|
192
|
+
==== Custom Extension Classes
|
193
|
+
|
194
|
+
As of version 0.5.0 you can also define your own classes for a extension elements. This is done by first creating an alias
|
195
|
+
for the namespace for the class and then using the +element+ method on the Atom::Feed or Atom::Entry class to tell rAtom
|
196
|
+
to use your custom class when it encounters the extension element.
|
197
|
+
|
198
|
+
For example, say we have the following piece Atom XML with a structured extension element:
|
199
|
+
|
200
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
201
|
+
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:custom='http://custom.namespace'>
|
202
|
+
<id>https://custom.namespace/id/1</id>
|
203
|
+
<link rel='self' type='application/atom+xml' href='https://custom.namespace/id/1'/>
|
204
|
+
<custom:property name='foo' value='bar'/>
|
205
|
+
<custom:property name='baz' value='bat'/>
|
206
|
+
</entry>
|
207
|
+
|
208
|
+
And we want the +custom:property+ elements to be parsed as our own custom class called Custom::Property that is
|
209
|
+
defined like this:
|
210
|
+
|
211
|
+
class Custom::Property
|
212
|
+
attr_accessor :name, :value
|
213
|
+
def initialize(xml)
|
214
|
+
# Custom XML handling
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
We can tell rAtom about our custom namespace and custom class using the following method calls:
|
219
|
+
|
220
|
+
Atom::Feed..add_extension_namespace :custom, "http://custom.namespace"
|
221
|
+
Atom::Entry.elements "custom:property", :class => Custom::Property
|
222
|
+
|
223
|
+
The first method call registers an alias for the "http://custom.namespace" namespace and the second method call
|
224
|
+
tell rAtom that when it encounters a custom:property element within a Feed it should create an instance of Custom::Property
|
225
|
+
and pass the XML Reader to the constructor of the instance. It is then up to the constructor to populate the objects attributes
|
226
|
+
from the XML. Note that the alias you create using +add_extension_namespace+ can be anything you want, it doesn't need
|
227
|
+
to match the alias in the actual XML itself.
|
228
|
+
|
229
|
+
The custom property will then be available as a method on the rAtom class. In the above example:
|
230
|
+
|
231
|
+
@feed.custom_property.size == 2
|
232
|
+
@feed.custom_property.first.name == 'foo'
|
233
|
+
@feed.custom_property.first.value == 'bar'
|
234
|
+
|
235
|
+
There is one caveat to this. By using this type of extension support you are permanently modifying the rAtom classes.
|
236
|
+
So if your application process one type of atom extension and you are happy with permanently modified rAtom classes,
|
237
|
+
the extra extensibility might work for you. If on the other hand you process lots of different types of extension you might
|
238
|
+
want to stick with simpler extension mechanism using the [namespace, element] method described above.
|
239
|
+
|
240
|
+
(Thanks to nachokb for this feature!!)
|
241
|
+
|
242
|
+
=== Basic Authentication
|
243
|
+
|
244
|
+
All methods that involve HTTP requests now support HTTP Basic Authentication. Authentication credentials are passed
|
245
|
+
as :user and :pass parameters to the methods that invoke the request. For example you can load a feed with HTTP Basic Authentication using:
|
246
|
+
|
247
|
+
Atom::Feed.load_entry(URI.parse("http://example.org/feed.atom"), :user => 'username', :pass => 'password')
|
248
|
+
|
249
|
+
Likewise all the Atom Pub methods support similar parameters, for example you can publish an Entry to a Feed with authentication
|
250
|
+
using:
|
251
|
+
|
252
|
+
feed.publish(entry, :user => 'username', :pass => 'password')
|
253
|
+
|
254
|
+
Or destroy an entry with:
|
255
|
+
|
256
|
+
entry.destroy!(:user => 'username', :pass => 'password')
|
257
|
+
|
258
|
+
rAtom doesn't store these credentials anywhere within the object model so you will need to pass them as arguments to every
|
259
|
+
method call that requires them. This might be a bit of a pain but it does make things simpler and it means that I'm not responsible
|
260
|
+
for protecting your credentials, although if you are using HTTP Basic Authentication there is a good chance your credentials aren't
|
261
|
+
very well protected anyway.
|
262
|
+
|
263
|
+
=== AuthHMAC authentication
|
264
|
+
|
265
|
+
As of version 0.5.1 rAtom also support authentication via HMAC request signing using the AuthHMAC[http://auth-hmac.rubyforge.org] gem. This is made available using the :hmac_access_id and :hmac_secret_key parameters which can be passed to the same methods as the HTTP Basic credentials support.
|
266
|
+
|
267
|
+
=== SSL
|
268
|
+
|
269
|
+
As of version 0.6.9, rAtom supports fetching feeds via https. This is done by using URLs with the SSL protocol. Publishing support is still limited to http, but patches are welcome.
|
270
|
+
|
271
|
+
== TODO
|
272
|
+
|
273
|
+
* Support partial content responses from the server.
|
274
|
+
* Support batching of protocol operations.
|
275
|
+
* All my tests have been against internal systems, I'd really like feedback from those who have tried rAtom using existing blog software that supports APP.
|
276
|
+
* Handle all base uri tests.
|
277
|
+
* Add slug support.
|
278
|
+
|
279
|
+
== Source Code
|
280
|
+
|
281
|
+
The source repository is accessible via GitHub:
|
282
|
+
|
283
|
+
git clone git://github.com/seangeo/ratom.git
|
284
|
+
|
285
|
+
== Contact Information
|
286
|
+
|
287
|
+
The project page is at http://github.com/seangeo/ratom. Please file any bugs or feedback
|
288
|
+
using the trackers and forums there.
|
289
|
+
|
290
|
+
== Authors and Contributors
|
291
|
+
|
292
|
+
rAtom was developed by Peerworks[http://peerworks.org] and written by Sean Geoghegan.
|
293
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "ratom"
|
8
|
+
gem.summary = %Q{Atom Syndication and Publication API}
|
9
|
+
gem.description = %Q{A fast Atom Syndication and Publication API based on libxml}
|
10
|
+
gem.email = "seangeo@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/seangeo/ratom"
|
12
|
+
gem.rubyforge_project = 'ratom'
|
13
|
+
gem.authors = ["Peerworks", "Sean Geoghegan"]
|
14
|
+
gem.add_development_dependency "rspec"
|
15
|
+
gem.add_dependency 'libxml-ruby', '>= 1.1.2'
|
16
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
Jeweler::RubyforgeTasks.new do |rf|
|
20
|
+
rf.doc_task = 'rdoc'
|
21
|
+
rf.remote_doc_path = ''
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
require 'spec/rake/spectask'
|
29
|
+
Spec::Rake::SpecTask.new do |t|
|
30
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
31
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
end
|
41
|
+
rescue LoadError
|
42
|
+
task :rcov do
|
43
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
task :spec => :check_dependencies
|
48
|
+
|
49
|
+
task :default => :spec
|
50
|
+
|
51
|
+
require 'rake/rdoctask'
|
52
|
+
Rake::RDocTask.new do |rdoc|
|
53
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
54
|
+
|
55
|
+
rdoc.rdoc_dir = 'rdoc'
|
56
|
+
rdoc.title = "ratom #{version}"
|
57
|
+
rdoc.rdoc_files.include('README*')
|
58
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
59
|
+
end
|