Sha256: 5fc1e2afef31f22ee6f27223bd2774040fa26b8e1412e453e0df78311f5d74e5

Contents?: true

Size: 831 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.79.0 lib/pact_broker/webhooks/webhook_execution_result.rb
pact_broker-2.78.1 lib/pact_broker/webhooks/webhook_execution_result.rb