Skip to content

Commit

Permalink
Add tippytippytepee Web.post + Web.post_form
Browse files Browse the repository at this point in the history
  • Loading branch information
lwu committed Feb 14, 2007
1 parent 15da9fd commit 04c7ed3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/tippytippytepee/tepee.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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) }
Expand Down

0 comments on commit 04c7ed3

Please sign in to comment.