Class: Blogpost::Livedoor
- Inherits:
-
Object
- Object
- Blogpost::Livedoor
- Defined in:
- lib/blogpost/livedoor.rb
Class Method Summary collapse
Class Method Details
.post(opts = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/blogpost/livedoor.rb', line 3 def self.post(opts={}) opts = Blogpost..merge(opts) auth = Atompub::Auth::Wsse.new(username: opts[:user],password: opts[:pass]) client = Atompub::Client.new(auth: auth) entry = Atom::Entry.new(title: opts[:title],content: opts[:content]) service = client.get_service "http://livedoor.blogcms.jp/atom/" collection_uri = service.workspace.collections[0].href client.create_entry(collection_uri, entry) end |