Sha256: b6f617be26f28edf4f671ef49679d89d4581463ecfd537e0a9438834152c85ac

Contents?: true

Size: 645 Bytes

Versions: 43

Compression:

Stored size: 645 Bytes

Contents

module Pact
  module Provider
    class PactURI
      attr_reader :uri, :options

      def initialize (uri, options={})
        @uri = uri
        @options = options
      end

      def == other
        other.is_a?(PactURI) &&
          uri == other.uri &&
          options == other.options
      end

      def basic_auth?
        !!username
      end

      def username
        options[:username]
      end

      def password
        options[:password]
      end

      def to_s
        if(basic_auth?)
          URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
        else
          @uri
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
pact-1.12.0 lib/pact/provider/pact_uri.rb
pact-1.11.1 lib/pact/provider/pact_uri.rb
pact-1.11.0 lib/pact/provider/pact_uri.rb