Sha256: b62918cad2e14bec1996592b699040ff4e66808d2f18bf353a0a8afee7909209
Contents?: true
Size: 724 Bytes
Versions: 1
Compression:
Stored size: 724 Bytes
Contents
module StreamBot # http communication wrapper class HTTP # initialize request with basic authentication and send def post_with_auth(auth, url) uri = URI.parse(url) request = init_request(uri) request.basic_auth auth[:username], auth[:password] post_request(request, uri) end private # send request def post_request(request, url) Net::HTTP.new(url.host, url.port).start do |http| LOG.debug("#{http.inspect}") http.request(request) end end # initialize an Net::HTTP::Post Request def init_request(url) LOG.debug("#{self.class}#init_request(#{url})") puts url.inspect Net::HTTP::Post.new(url.path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
streambot-0.3.0 | lib/streambot/http.rb |