Sha256: daaa0591c2021cdb9789eeaea11558c756a82297107bce8b851c6a19f3c44f9a

Contents?: true

Size: 831 Bytes

Versions: 5

Compression:

Stored size: 831 Bytes

Contents

require "pact_broker/webhooks/http_request_with_redacted_headers"
require "pact_broker/webhooks/http_response_with_utf_8_safe_body"

module PactBroker
  module Webhooks
    class WebhookExecutionResult
      attr_reader :request, :response, :logs, :error

      def initialize(request, response, logs, error = nil)
        @request = PactBroker::Webhooks::HttpRequestWithRedactedHeaders.new(request)
        @response = response ? PactBroker::Webhooks::HttpResponseWithUtf8SafeBody.new(response) : nil
        @logs = logs
        @error = error
      end

      def success?
        if response
          # Response HTTP Code must be in success list otherwise it is false
          PactBroker.configuration.webhook_http_code_success.include? response.code.to_i
        else
          false
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pact_broker-2.84.0 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.83.0 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.82.0 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.81.0 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.80.0 lib/pact_broker/webhooks/webhook_execution_result.rb