Sha256: 7aa03d3156ad81435a8db720f3f2da17d6d6d96cac068c545aabee2578e0a9af

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 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_webhook_context(value)
        with_updated_attribute(webhook_context: value)
      end

      def webhook_context
        self[:webhook_context]
      end

      def [](key)
        params[key]
      end

      def to_hash
        params
      end

      private

      attr_reader :params
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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