public
Fork of sr/atom-tools
Description: A Ruby library for Atom and the Atom Publishing Protocol.
Home | Edit | New

VoxApi

Vox’s Atom API

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 = "user@email.com"
$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!)

Last edited by bct, Fri Oct 17 13:28:37 -0700 2008
Home | Edit | New
Versions: