Sha256: ddae5d53afc6fe9910c93171d8de635d030c0c3554fd5db34625b42e801ad4b8

Contents?: true

Size: 595 Bytes

Versions: 64

Compression:

Stored size: 595 Bytes

Contents

require 'reform'
require 'reform/contract'
require 'net/http'

module PactBroker
  module Api
    module Contracts

      module RequestValidations
        def method_is_valid
          http_method && !valid_method?
        end

        def valid_method?
          Net::HTTP.const_defined?(http_method.capitalize)
        end

        def url_is_valid
          url && !url_valid?
        end

        def url_valid?
          uri && uri.scheme && uri.host
        end

        def uri
          URI(url)
        rescue URI::InvalidURIError
          nil
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pact_broker-2.26.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.25.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.24.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.23.4 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.23.3 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.23.2 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.23.1 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.23.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.22.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.21.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.20.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.19.2 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.19.1 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.19.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.18.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.17.1 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.17.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.16.1 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.16.0 lib/pact_broker/api/contracts/request_validations.rb
pact_broker-2.15.0 lib/pact_broker/api/contracts/request_validations.rb