こんな感じ。こっちの画面でリアルタイムな変化を見ることが出来ると思う。
$KCODE = 'u' require 'cgi' require 'net/http' def query_string(params) params.map {|key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}" }.join('&') end def call_remote(method, params) Net::HTTP.version_1_2 Net::HTTP.start('storehouse.quickvps.net', 80) {|http| response = http.post("/sticky_plus/sticky/#{method}", query_string(params)) } end def attach(contents, top, left, bgcolor, url) params = { 'contents' => contents, 'top' => top, 'left' => left, 'bgcolor' => bgcolor, 'url' => url } res = call_remote('attach', params) res.body.strip end def move(uuid, top, left, url) params = { 'uuid' => uuid, 'top' => top, 'left' => left, 'url' => url } res = call_remote('move', params) end def edit(uuid, contents, url) params = { 'uuid' => uuid, 'contents' => contents, 'url' => url } res = call_remote('edit', params) end def set_color(uuid, bgcolor, url) params = { 'uuid' => uuid, 'bgcolor' => bgcolor, 'url' => url } res = call_remote('editcolor', params) end def detach(uuid, url) params = { 'uuid' => uuid, 'url' => url } res = call_remote('detach', params) end url = 'http://d.hatena.ne.jp/winebarrel/' uuid = attach("テスト\nテスト\nテスト", 100, 200, 'red', url) sleep 5 move(uuid, 200, 300, url) sleep 5 edit(uuid, "あーあー\n本日は晴天なり", url) sleep 5 set_color(uuid, 'blue', url) sleep 5 detach(uuid, url)