Sha256: 7cf4b10ec82e5b02725e6ee76b42d9465863654b7b30e75f21b7cc973374f70e
Contents?: true
Size: 681 Bytes
Versions: 3
Compression:
Stored size: 681 Bytes
Contents
require 'net/http' require 'timeout' require 'uri' module Apphunkd module Remote autoload :Result, 'apphunkd/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 Remote::Result.new(:status => :connection_error) rescue Timeout::Error Remote::Result.new(:status => :timeout) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
apphunkd-0.9.2 | lib/apphunkd/remote.rb |
apphunkd-0.9.1 | lib/apphunkd/remote.rb |
apphunkd-0.9.0 | lib/apphunkd/remote.rb |