OSDN Git Service

booklog
authormasahino <masahino@0978bef0-6439-0410-a06b-a62e4d60c955>
Mon, 25 Aug 2008 11:48:44 +0000 (11:48 +0000)
committermasahino <masahino@0978bef0-6439-0410-a06b-a62e4d60c955>
Mon, 25 Aug 2008 11:48:44 +0000 (11:48 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lbw/ldblogwriter/trunk@68 0978bef0-6439-0410-a06b-a62e4d60c955

misc/booklog.rb
plugins/booklog.rb [new file with mode: 0644]

index 7bf2125..9371e5f 100644 (file)
@@ -31,13 +31,13 @@ module Booklog
 
     def comment(asin, comment)
       update_uri = BooklogHomeURI + '/addbook.php?mode=ItemLookup&asin='+asin
-      p update_uri
+      #p update_uri
       comment_page = @agent.get(update_uri)
       comment_form = comment_page.form('frm')
       comment_form['comment'] = comment.toeuc
       puts comment_form['comment']
       result_page = comment_form.submit
-      puts result_page.body
+      #puts result_page.body
     end
   end
 end
diff --git a/plugins/booklog.rb b/plugins/booklog.rb
new file mode 100644 (file)
index 0000000..2d3f94a
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+# ブクログの情報更新
+# #booklog(<ASIN>)
+# @options['booklog_userid']
+# @options['booklog_password']
+def booklog(asin)
+  require 'date'
+  require 'booklog'
+
+  user = @conf.options['booklog_userid']
+  pass = @conf.options['booklog_password']
+  booklog = Booklog::Agent.new(user, pass)
+  booklog.input([asin])
+  ""
+end
+
+def booklog_post(asin)
+  require 'booklog'
+
+  user = @conf.options['booklog_userid']
+  pass = @conf.options['booklog_password']
+  booklog = Booklog::Agent.new(user, pass)
+  
+  booklog.comment(asin, @entry.alternate)
+  ""
+end
+
+if $0 == __FILE__
+  $test = true
+end
+
+if defined?($test) && $test
+  require 'test/unit'
+  require 'ldblogwriter/config'
+
+end
+
+