リファクタリングを行い情報の整理を行った。また、tDiary のブログ記事の削除にも対応した。
@@ -0,0 +1,21 @@ | ||
1 | +# coding: UTF-8 | |
2 | + | |
3 | +require 'plugin/weblog/meta_weblog/meta_weblog_delete' | |
4 | + | |
5 | +#=tDiary のブログ記事削除用ウェブログプラグイン | |
6 | +# | |
7 | +# 最初の著者:: トゥイー | |
8 | +# リポジトリ情報:: $Id: meta_weblog_delete.rb 621 2012-03-17 02:36:35Z toy_dev $ | |
9 | +# 著作権:: Copyright (C) Ownway.info, 2011. All rights reserved. | |
10 | +# ライセンス:: CPL(Common Public Licence) | |
11 | +class TDiaryDelete_WeblogPlugin < MetaWeblogDelete_WeblogPlugin | |
12 | + | |
13 | + def delete_article(client, postid) | |
14 | + M2W_LOGGER.debug("Start blogger.deletePost ... postid = #{postid}") | |
15 | + result = client.call("blogger.deletePost", "", postid, @parent.username, @parent.password) | |
16 | + M2W_LOGGER.debug("Finish blogger.deletePost ... result = #{result}") | |
17 | + | |
18 | + return result | |
19 | + end | |
20 | + | |
21 | +end |
@@ -1,12 +1,10 @@ | ||
1 | 1 | # coding: UTF-8 |
2 | 2 | |
3 | -require 'plugin/weblog/movable_type/movable_type' | |
3 | +require 'plugin/weblog/meta_weblog/meta_weblog' | |
4 | +require 'plugin/weblog/t_diary/t_diary_delete' | |
4 | 5 | require 'plugin/weblog/t_diary/t_diary_get' |
5 | 6 | require 'plugin/weblog/t_diary/t_diary_formatter' |
6 | 7 | |
7 | -M2W_WEBLOG_TDIARY_ATTACHMENT_ROOT_PATH = 'attrs' | |
8 | -M2W_WEBLOG_TDIARY_THUMBNAIL_ROOT_PATH = 'thumbs' | |
9 | - | |
10 | 8 | #=tDiary のためのウェブログプラグイン |
11 | 9 | # |
12 | 10 | # 最初の著者:: トゥイー |
@@ -13,19 +11,8 @@ | ||
13 | 11 | # リポジトリ情報:: $Id: seesaa.rb 615 2012-03-16 23:57:45Z toy_dev $ |
14 | 12 | # 著作権:: Copyright (C) Ownway.info, 2011. All rights reserved. |
15 | 13 | # ライセンス:: CPL(Common Public Licence) |
16 | -class TDiary_WeblogPlugin < MovableType_WeblogPlugin | |
14 | +class TDiary_WeblogPlugin < MetaWeblog_WeblogPlugin | |
17 | 15 | |
18 | - def initialize( | |
19 | - endpoint = M2W_WEBLOG_ENDPOINT, | |
20 | - username = M2W_WEBLOG_USERNAME, | |
21 | - password = M2W_WEBLOG_PASSWORD, | |
22 | - encoding = M2W_WEBLOG_WORDPRESS_DEFAULT_ENCODING, | |
23 | - default_blogid = M2W_WEBLOG_DEFAULT_BLOGID, | |
24 | - attachment_root_path = M2W_WEBLOG_TDIARY_ATTACHMENT_ROOT_PATH, | |
25 | - thumbnail_root_path = M2W_WEBLOG_TDIARY_THUMBNAIL_ROOT_PATH) | |
26 | - super | |
27 | - end | |
28 | - | |
29 | 16 | def formatter |
30 | 17 | return TDiaryFormatter.new(@plugin_manager) |
31 | 18 | end |
@@ -34,19 +21,14 @@ | ||
34 | 21 | return {} |
35 | 22 | end |
36 | 23 | |
37 | - # 添付ファイルのデフォルトのパスを取得します。 | |
38 | - def get_attachment_default_filepath(postid, dateCreated, attachment_index, attachment_filename) | |
39 | - return "#{@attachment_root_path}#{postid}_#{attachment_index}#{File.extname(attachment_filename)}" | |
40 | - end | |
41 | - | |
42 | - # サムネイルのデフォルトのパスを取得します。 | |
43 | - def get_thumbnail_default_filepath(postid, dateCreated, attachment_index, attachment_filename) | |
44 | - return "#{@thumbnail_root_path}#{postid}_#{attachment_index}#{File.extname(attachment_filename)}" | |
45 | - end | |
46 | - | |
47 | 24 | # ブログ記事投稿用のプラグインを取得します。 |
48 | 25 | def get_get_plugin() |
49 | 26 | return TDiaryGet_WeblogPlugin.new(self) |
50 | 27 | end |
51 | 28 | |
29 | + # ブログ記事削除用のプラグインを取得します。 | |
30 | + def get_delete_plugin() | |
31 | + return TDiaryDelete_WeblogPlugin.new(self) | |
32 | + end | |
33 | + | |
52 | 34 | end |