ratom-ssl 0.0.0
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.
- data/.gitignore +4 -0
- data/History.txt +118 -0
- data/LICENSE +20 -0
- data/README.rdoc +295 -0
- data/Rakefile +55 -0
- data/VERSION.yml +5 -0
- data/lib/atom/configuration.rb +24 -0
- data/lib/atom/pub.rb +253 -0
- data/lib/atom/version.rb +7 -0
- data/lib/atom/xml/parser.rb +376 -0
- data/lib/atom.rb +771 -0
- data/ratom-ssl.gemspec +98 -0
- data/spec/app/member_entry.atom +31 -0
- data/spec/app/service.xml +36 -0
- data/spec/atom/pub_spec.rb +504 -0
- data/spec/atom_spec.rb +1336 -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 +7 -0
- data/spec/fixtures/entry_with_simple_extensions.atom +30 -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 +43 -0
- metadata +140 -0
data/.gitignore
ADDED
data/History.txt
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
== 0.6.5
|
2
|
+
|
3
|
+
* Fixed missing version.rb, now loads version.yml. [Greg Campbell]
|
4
|
+
|
5
|
+
== 0.6.4
|
6
|
+
|
7
|
+
* Remove Hoe dependency and converted to a Jeweler based project build.
|
8
|
+
* Fixed error when assigning nil to node['xml:lang'] [George Guimarães].
|
9
|
+
* Handle link@title. [Brian Dewey]
|
10
|
+
* SimpleExtensions#[] returns a namespace hash if localname is not given. [Daniel Vartanov]
|
11
|
+
|
12
|
+
== 0.6.3 2009-11-19
|
13
|
+
|
14
|
+
* Removed extraneous logging.
|
15
|
+
|
16
|
+
== 0.6.2 2009-06-19
|
17
|
+
|
18
|
+
* Handle href and fixed on service doc categories.
|
19
|
+
* Use request_uri instead of path so that we get any query parameters too. [Wybo Wiersma]
|
20
|
+
* Doc Patches.
|
21
|
+
|
22
|
+
== 0.6.1 2009-03-27
|
23
|
+
|
24
|
+
Some minor exception fixes.
|
25
|
+
|
26
|
+
* Removed Atom::ParseError. Parse errors now will only throw ArgumentError.
|
27
|
+
* ProtocolError has a to string method.
|
28
|
+
|
29
|
+
== 0.6.0 2009-03-19
|
30
|
+
|
31
|
+
* Now depends on libxml-ruby 1.1.2.
|
32
|
+
* Added support for hreflang on links. (David Arango)
|
33
|
+
* Update to work with latest version of libxml-ruby. (oortle & me)
|
34
|
+
* Content::Text and Content::Xhtml can now be created with String's like Content::Html.
|
35
|
+
* Make sure Atom::Generator outputs the generator name as the text of the element.
|
36
|
+
|
37
|
+
== 0.5.2 2008-12-06
|
38
|
+
|
39
|
+
* Remove whitespace modification in content. (dlisboa)
|
40
|
+
|
41
|
+
== 0.5.1 2008-08-05
|
42
|
+
|
43
|
+
* Added optional AuthHMAC support
|
44
|
+
|
45
|
+
== 0.5.0 2008-07-28
|
46
|
+
|
47
|
+
* Fix bug where processing instructions break parsing.
|
48
|
+
* Added Custom extension element classes. (Ignacio Carrera)
|
49
|
+
|
50
|
+
== 0.4.2 2008-07-09
|
51
|
+
|
52
|
+
* Update to libxml-ruby version 0.8.x
|
53
|
+
|
54
|
+
== 0.4.1 2008-07-09
|
55
|
+
|
56
|
+
* Update to libxml-ruby version 0.6.0.
|
57
|
+
|
58
|
+
== 0.4.0 2008-06-26
|
59
|
+
|
60
|
+
* Support for HTTP Basic Authentication.
|
61
|
+
|
62
|
+
== 0.3.7 2008-06-05
|
63
|
+
|
64
|
+
* Support XML in extension elements. (Min Kim)
|
65
|
+
|
66
|
+
== 0.3.6 2008-05-15
|
67
|
+
|
68
|
+
* Added categories to feeds.
|
69
|
+
* Make sure atom:content appears at the end of a atom:entry.
|
70
|
+
* Don't use namespace prefixes on content unless we really have to.
|
71
|
+
|
72
|
+
== 0.3.5 2008-05-03
|
73
|
+
|
74
|
+
* Make sure atom:entries appears last.
|
75
|
+
* Better examples in the documentation. Docs for Feed and Entry list attributes.
|
76
|
+
* Gave Feeds authors and contributors.
|
77
|
+
* Fixed a couple warnings.
|
78
|
+
|
79
|
+
== 0.3.4 2008-04-21
|
80
|
+
|
81
|
+
* Remove useless variable warning. (Sam Roberts)
|
82
|
+
* Support initialization of Atom::Source from Hash and block.
|
83
|
+
* Support initialization of Atom::Generator from Hash and block.
|
84
|
+
|
85
|
+
== 0.3.3 2008-04-09
|
86
|
+
|
87
|
+
* Better serialization of namespaced elements. ratom will now generate prefixes for namespaces and write them as
|
88
|
+
attributes on the root element.
|
89
|
+
* Extensions read as attributes are now written as attributes.
|
90
|
+
* When programmatically setting an extension value you can tell ratom to write it as an attribute using:
|
91
|
+
|
92
|
+
entry['http://example.org', 'extattr'].as_attribute = true
|
93
|
+
|
94
|
+
* Add support for atom:category.
|
95
|
+
* Support extension attributes using the same mechanism as extension elements.
|
96
|
+
|
97
|
+
== 0.3.1 2008-04-02
|
98
|
+
|
99
|
+
* Bunch of fixes to the Atom::Pub classes to make them work like the Atom classes
|
100
|
+
with respect to initializers and to_xml.
|
101
|
+
|
102
|
+
== 0.3.0 2008-04-02
|
103
|
+
|
104
|
+
* Raise Atom::Serialization error when you try and serialize non-utf8 content.
|
105
|
+
* Support reading simple extension elements, see README.txt.
|
106
|
+
* Support writing simple extension elements, see README.txt.
|
107
|
+
|
108
|
+
== 0.2.2 2008-02-10
|
109
|
+
|
110
|
+
* Removed dependency on ActiveSupport.
|
111
|
+
|
112
|
+
== 0.2.1 2008-03-03
|
113
|
+
|
114
|
+
* Initial release to the public.
|
115
|
+
|
116
|
+
== < 0.2.1
|
117
|
+
|
118
|
+
* 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,295 @@
|
|
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
|
+
=== SSL Authenication
|
264
|
+
|
265
|
+
Methods that involve HTTP Basic Authentication can use SSL encryption. Make the standard HTTPS request and pass the credentials as :user and :pass parameters.
|
266
|
+
|
267
|
+
Tested and verified methods are load_feed and publish.
|
268
|
+
|
269
|
+
=== AuthHMAC authentication
|
270
|
+
|
271
|
+
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.
|
272
|
+
|
273
|
+
== TODO
|
274
|
+
|
275
|
+
* Support partial content responses from the server.
|
276
|
+
* Support batching of protocol operations.
|
277
|
+
* 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.
|
278
|
+
* Handle all base uri tests.
|
279
|
+
* Add slug support.
|
280
|
+
|
281
|
+
== Source Code
|
282
|
+
|
283
|
+
The source repository is accessible via GitHub:
|
284
|
+
|
285
|
+
git://github.com/KentonWhite/ratom-ssl.git
|
286
|
+
|
287
|
+
== Contact Information
|
288
|
+
|
289
|
+
The project page is at http://github.com/KentonWhite/ratom-ssl. Please file any bugs or feedback
|
290
|
+
using the trackers and forums there. This is a fork of the project by Sean Geoghegan at http://github.com/seangeo/ratom.
|
291
|
+
|
292
|
+
== Authors and Contributors
|
293
|
+
|
294
|
+
rAtom was developed by Peerworks[http://peerworks.org] and written by Sean Geoghegan. SSL was added by Kenton White.
|
295
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "ratom-ssl"
|
8
|
+
gem.summary = %Q{Atom Syndication and Publication API with SSL}
|
9
|
+
gem.description = %Q{A fast Atom Syndication and Publication API based on libxml}
|
10
|
+
gem.email = "jkentonwhite@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/KentonWhite/ratom-ssl"
|
12
|
+
gem.rubyforge_project = 'ratom'
|
13
|
+
gem.authors = ["Peerworks", "Sean Geoghegan", "Kenton White"]
|
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
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new do |t|
|
26
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
27
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'rcov/rcovtask'
|
32
|
+
Rcov::RcovTask.new do |test|
|
33
|
+
test.libs << 'test'
|
34
|
+
test.pattern = 'test/**/test_*.rb'
|
35
|
+
test.verbose = true
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
task :rcov do
|
39
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :spec => :check_dependencies
|
44
|
+
|
45
|
+
task :default => :spec
|
46
|
+
|
47
|
+
require 'rake/rdoctask'
|
48
|
+
Rake::RDocTask.new do |rdoc|
|
49
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "ratom #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
data/VERSION.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (c) 2008 The Kaphan Foundation
|
2
|
+
#
|
3
|
+
# For licensing information see LICENSE.
|
4
|
+
#
|
5
|
+
# Please visit http://www.peerworks.org/contact for further information.
|
6
|
+
#
|
7
|
+
|
8
|
+
module Atom
|
9
|
+
class Configuration
|
10
|
+
def self.auth_hmac_enabled?
|
11
|
+
unless defined?(@auth_hmac_enabled)
|
12
|
+
begin
|
13
|
+
gem 'auth-hmac'
|
14
|
+
require 'auth-hmac'
|
15
|
+
@auth_hmac_enabled = true
|
16
|
+
rescue
|
17
|
+
@auth_hmac_enabled = false
|
18
|
+
end
|
19
|
+
else
|
20
|
+
@auth_hmac_enabled
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|