lib/activehook/server/send.rb in activehook-server-0.1.1 vs lib/activehook/server/send.rb in activehook-server-0.1.2

- old
+ new

@@ -5,36 +5,36 @@ "Content-Type" => "application/json", "Accept" => "application/json", "User-Agent" => "ActiveHook/#{ActiveHook::Server::VERSION}" }.freeze - attr_accessor :hook + attr_accessor :message attr_reader :response_time, :status, :response def initialize(options = {}) options.each { |key, value| send("#{key}=", value) } end def start - @status = post_hook + @status = post_message log_status end def uri - @uri ||= URI.parse(@hook.uri) + @uri ||= URI.parse(@message.uri) end def success? @status == :success end private - def post_hook + def post_message http = Net::HTTP.new(uri.host, uri.port) measure_response_time do - @response = http.post(uri.path, @hook.final_payload, final_headers) + @response = http.post(uri.path, @message.final_payload, final_headers) end response_status(@response) rescue :error end @@ -65,10 +65,10 @@ ActiveHook::Server.log.err(msg) end end def final_headers - { "X-Hook-Signature" => @hook.signature }.merge(REQUEST_HEADERS) + { "X-Hook-Signature" => @message.signature }.merge(REQUEST_HEADERS) end end end end