Sha256: b6b86ebb2bd2ab4feebfbf3c97e0a9878cf4176bf199251c4cd24b7cd2ee893a

Contents?: true

Size: 1.89 KB

Versions: 8

Compression:

Stored size: 1.89 KB

Contents

require "pact_broker/api/decorators/configuration"
require "pact_broker/api/decorators/decorator_context_creator"
require "pact_broker/webhooks/execution_configuration_creator"
require "pact_broker/errors/error_logger"
require "pact_broker/api/resources/error_response_body_generator"

module PactBroker
  class ApplicationContext
    attr_reader :decorator_configuration,
                :decorator_context_creator,
                :webhook_execution_configuration_creator,
                :resource_authorizer,
                :before_resource,
                :after_resource,
                :error_logger,
                :error_response_body_generator

    def initialize(params = {})
      params_with_defaults = {
        decorator_configuration: PactBroker::Api::Decorators::Configuration.default_configuration,
        decorator_context_creator: PactBroker::Api::Decorators::DecoratorContextCreator,
        webhook_execution_configuration_creator: PactBroker::Webhooks::ExecutionConfigurationCreator,
        error_logger: PactBroker::Errors::ErrorLogger,
        error_response_body_generator: PactBroker::Api::Resources::ErrorResponseBodyGenerator
      }.merge(params)

      @decorator_configuration = params_with_defaults[:decorator_configuration]
      @decorator_context_creator = params_with_defaults[:decorator_context_creator]
      @webhook_execution_configuration_creator = params_with_defaults[:webhook_execution_configuration_creator]
      @resource_authorizer = params_with_defaults[:resource_authorizer]
      @before_resource = params_with_defaults[:before_resource]
      @after_resource = params_with_defaults[:after_resource]
      @error_logger = params_with_defaults[:error_logger]
      @error_response_body_generator = params_with_defaults[:error_response_body_generator]
    end

    def self.default_application_context(overrides = {})
      ApplicationContext.new(overrides)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.86.0 lib/pact_broker/application_context.rb
pact_broker-2.85.1 lib/pact_broker/application_context.rb
pact_broker-2.85.0 lib/pact_broker/application_context.rb
pact_broker-2.84.0 lib/pact_broker/application_context.rb
pact_broker-2.83.0 lib/pact_broker/application_context.rb
pact_broker-2.82.0 lib/pact_broker/application_context.rb
pact_broker-2.81.0 lib/pact_broker/application_context.rb
pact_broker-2.80.0 lib/pact_broker/application_context.rb