From 04c7ed3374ab30c8824940716d3f9dae8c32f6a3 Mon Sep 17 00:00:00 2001 From: Leslie Wu Date: Wed, 14 Feb 2007 22:48:12 +0000 Subject: [PATCH] Add tippytippytepee Web.post + Web.post_form --- examples/tippytippytepee/tepee.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/tippytippytepee/tepee.rb b/examples/tippytippytepee/tepee.rb index aaf2082..dc6f88c 100755 --- a/examples/tippytippytepee/tepee.rb +++ b/examples/tippytippytepee/tepee.rb @@ -29,6 +29,17 @@ def page.base_uri; end data end end + + def self.post(url, data, headers = nil) + uri = URI.parse(url) + res = Net::HTTP.new(uri.host, uri.port).post(uri.path, data, headers) + res.body + end + + def self.post_form(url, params) + res = Net::HTTP.post_form(URI.parse(url), params) + res.body + end end module Tepee @@ -77,6 +88,7 @@ def self.down Tepee::Box.ref Web Tepee::Box.ref Jungle Tepee::Box.import URI::HTTP +Tepee::Box.import Net::HTTP Tepee::Box.import OpenURI::Meta %w(CGI Time Hpricot HashWithIndifferentAccess PP JSON YAML OpenStruct Sandbox).each { |klass| Tepee::Box.import Kernel.const_get(klass) }