Sha256: 5b6acfd7862dc27fe5bd04ea8e4b425a0a9ddd084971625be04cbb6f70cd5bb8

Contents?: true

Size: 1.07 KB

Versions: 34

Compression:

Stored size: 1.07 KB

Contents

require 'pact_broker/api/contracts/base_contract'
require 'uri'

module PactBroker
  module Api
    module Contracts
      class VerificationContract < BaseContract

        property :success
        property :provider_version, as: :providerApplicationVersion
        property :build_url, as: :buildUrl

        validation do
          configure do
            config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)

            def not_blank? value
              value && value.to_s.strip.size > 0
            end

            def valid_url? url
              URI(url)
            rescue URI::InvalidURIError, ArgumentError
              nil
            end

            def valid_version_number?(value)
              parsed_version_number = PactBroker.configuration.version_parser.call(value)
              !!parsed_version_number
            end
          end

          required(:success).filled(:bool?)
          required(:provider_version) { not_blank? & valid_version_number? }
          optional(:build_url).maybe(:valid_url?)
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pact_broker-2.57.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.56.1 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.56.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.55.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.54.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.53.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.52.2 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.52.1 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.52.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.51.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.50.1 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.50.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.49.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.48.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.47.1 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.47.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.46.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.45.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.44.0 lib/pact_broker/api/contracts/verification_contract.rb
pact_broker-2.43.0 lib/pact_broker/api/contracts/verification_contract.rb