Class: Blogpost::Hatenablog
- Inherits:
-
Object
- Object
- Blogpost::Hatenablog
- Defined in:
- lib/blogpost/hatenablog.rb
Class Method Summary collapse
Class Method Details
.post(opts = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/blogpost/hatenablog.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].encode('BINARY', 'BINARY'),content: opts[:content].encode('BINARY', 'BINARY')) client.create_entry("https://blog.hatena.ne.jp/#{opts[:user]}/#{opts[:domain]}/atom/entry", entry) end |