module LDBlogWriter
class Config
- attr_accessor :atom_api_uri, :categories_uri, :atom_pub_uri
+ attr_accessor :atom_api_uri, :categories_uri, :atompub_uri
attr_accessor :post_uri, :upload_uri, :username, :password, :api_key
attr_accessor :edit_uri_file, :upload_uri_file
attr_accessor :convert_to_html, :html_directory
def initialize(config)
super(config.username, config.password, config.auth_type)
- @entry_uri = config.post_uri
+ @entry_uri = config.atompub_uri
#get_resource_uri(@atom_client, @config.atom_pub_uri)
end
private
- def get_resource_uri(atom_client, atom_uri)
- res_a = atom_client.get_resource_uri(atom_uri)
- @entry_uri = res_a[0]
- @image_uri = res_a[1]
- end
-
end
end
class LiveDoor < AtomPubClient
def initialize(config)
super(config.username, config.password, config.auth_type)
- res = get_resource_uri(config.atom_pub_uri)
-p res
+ res = get_resource_uri(config.atompub_uri)
@entry_uri = res.collection_uri[0]
@image_uri = res.collection_uri[3]
end
require 'ldblogwriter/service/hatena.rb'
require 'ldblogwriter/config.rb'
-
class TestHatena < Test::Unit::TestCase
def setup
- config_file = ENV['HOME'] + "/ldblogwriter-hatena.conf"
- conf = LDBlogWriter::Config.new(config_file)
- @sv = LDBlogWriter::Service::Hatena::new(conf)
+# config_file = ENV['HOME'] + "/ldblogwriter-hatena.conf"
+ config_file = 'test/online/hatena.conf'
+ @conf = LDBlogWriter::Config.new(config_file)
+ @conf.username = ARGV[0]
+ @conf.password = ARGV[1]
+ @conf.atompub_uri = "http://d.hatena.ne.jp/#{@conf.username}/atom/blog"
+ @sv = LDBlogWriter::Service::Hatena::new(@conf)
end
def test_to_xml
end
def test_post_entry
- post_ret = Net::HTTPResponse.new("1.1", "201", "hoge")
- post_ret['Location'] = "huga"
-# Net::HTTP.any_instance.stubs(:post).returns(post_ret)
ret = @sv.post_entry("test content", "this is test", "test")
assert_instance_of(String, ret)
- pp ret
end
end