Sha256: 00bb9a367e393a4c5df699d5c408aa7b155dc68bfed3183c227d4e86fb6adee4

Contents?: true

Size: 634 Bytes

Versions: 57

Compression:

Stored size: 634 Bytes

Contents

require 'dry-validation'

module PactBroker
  module Api
    module Contracts
      class CanIDeployQuerySchema
        SCHEMA = Dry::Validation.Schema do
          required(:pacticipant).filled(:str?)
          required(:version).filled(:str?)
          optional(:to).filled(:str?)
        end

        def self.call(params)
          select_first_message(SCHEMA.call(params).messages(full: true))
        end

        def self.select_first_message(messages)
          messages.each_with_object({}) do | (key, value), new_messages |
            new_messages[key] = [value.first]
          end
        end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.79.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.78.1 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.78.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.77.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.76.2 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.76.1 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.76.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.75.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.74.1 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.74.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.73.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.72.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.71.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.70.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.69.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.68.1 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.68.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.67.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb
pact_broker-2.66.0 lib/pact_broker/matrix/can_i_deploy_query_schema.rb