Sha256: f1b165174415a32838cbd58e870532f60f03c79f8f3638f1f05194f1673378d7

Contents?: true

Size: 1.61 KB

Versions: 16

Compression:

Stored size: 1.61 KB

Contents

require "pact_broker/hash_refinements"

module PactBroker
  module Webhooks
    class ExecutionConfiguration
      using PactBroker::HashRefinements

      def initialize(params = {})
        @params = params
      end

      def with_updated_attribute(new_attribute)
        ExecutionConfiguration.new(params.deep_merge(new_attribute))
      end

      def with_show_response(value)
        with_updated_attribute(logging_options: { show_response: value })
      end

      def with_success_log_message(value)
        with_updated_attribute(logging_options: { success_log_message: value })
      end

      def with_failure_log_message(value)
        with_updated_attribute(logging_options: { failure_log_message: value })
      end

      def with_retry_schedule(value)
        with_updated_attribute(retry_schedule: value)
      end

      def with_http_success_codes(value)
        with_updated_attribute(http_success_codes: value)
      end

      def with_webhook_context(value)
        with_updated_attribute(webhook_context: value)
      end

      def with_user_agent(value)
        with_updated_attribute(user_agent: value)
      end

      def with_disable_ssl_verification(value)
        with_updated_attribute(disable_ssl_verification: value)
      end

      def with_cert_store(value)
        with_updated_attribute(cert_store: value)
      end

      def webhook_context
        self[:webhook_context]
      end

      def retry_schedule
        self[:retry_schedule]
      end

      def [](key)
        params[key]
      end

      def to_hash
        params
      end

      private

      attr_reader :params
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pact_broker-2.104.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.103.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.102.2 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.102.1 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.102.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.101.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.100.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.99.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.98.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.97.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.96.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.95.1 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.95.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.94.0 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.93.4 lib/pact_broker/webhooks/execution_configuration.rb
pact_broker-2.93.3 lib/pact_broker/webhooks/execution_configuration.rb