Sha256: 245aa2f6d04f22d7a5e8c0c23db0be7b422f51604330aa9ce0975ab85c8a2656
Contents?: true
Size: 610 Bytes
Versions: 10
Compression:
Stored size: 610 Bytes
Contents
require "net/http" require "uri" module Firehose class HttpPublisher attr_reader :uri class RequestBuilder attr_reader :uri, :message, :channel def initialize(uri, message) @uri, @message = uri, message end def to(channel) req = Net::HTTP::Put.new(channel) req.body = message res = Net::HTTP.start(uri.host, uri.port) do |http| response = http.request(req) end end end def initialize(uri) @uri = URI.parse(uri) end def publish(message) RequestBuilder.new(uri, message) end end end
Version data entries
10 entries across 10 versions & 1 rubygems