forked from sr/atom-tools
-
Notifications
You must be signed in to change notification settings - Fork 4
VoxApi
bct edited this page Sep 13, 2010
·
1 revision
Vox has well-hidden Atom API collections. atom-tools only supports the Atom Publishing Protocol (which is not the same as the API), but Vox doesn’t check the namespace of POSTed s, so we can successfully create entries (and maybe do other things, I haven’t tried).
# see: http://watcher.moe-nifty.com/memo/2006/09/vox_atom_api_ec56.html
# (synopsis (i think): only POST works for vox)
# email address you sign into vox with
$user = "[email protected]"
$pass = "password"
# get this from your Atom feed
$svc_post = "http://www.vox.com/atom/svc=post/collection_id=xxxxxx"
require "atom/collection"
h = Atom::HTTP.new
h.user = $user
h.pass = $pass
# force authentication with WSSE (atom-tools >= 0.9.2)
h.always_auth = :wsse
c = Atom::Collection.new($svc_post, h)
e = Atom::Entry.new
e.title = "My Entry Title"
e.content = <<END
<p>Hello, <em>weblog</em> world!</p>
<p>This is my third post <strong>ever</strong>!</p>
END
e.content["type"] = "xhtml"
r = c.post! e
puts r.inspect
puts "---"
puts r.body
(thanks midore!)