Sha256: 5e8dab6a791f62c9125d60fb2d1313d7467c82d482ae29d7037eb0659b5eea16
Contents?: true
Size: 700 Bytes
Versions: 5
Compression:
Stored size: 700 Bytes
Contents
require 'net/http' require 'timeout' require 'uri' module Apphunk module Remote autoload :Result, 'apphunk/remote/result' class << self def post(url, payload = {}, post_timeout = 30) begin Timeout.timeout(post_timeout) do uri = URI.parse(url) result = Remote::Result.new(:response => Net::HTTP.post_form(uri, payload)) result.status = :ok return result end rescue SocketError, Errno::ECONNREFUSED Remote::Result.new(:status => :connection_error) rescue Timeout::Error Remote::Result.new(:status => :timeout) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
apphunk-0.4.1 | lib/apphunk/remote.rb |
apphunk-0.4.0 | lib/apphunk/remote.rb |
apphunk-0.3.1 | lib/apphunk/remote.rb |
apphunk-0.3.0 | lib/apphunk/remote.rb |
apphunk-0.1.1 | lib/apphunk/remote.rb |