Sha256: ae883981bf064daae8aed5b78f43c853c936bc1f8e90e4d84d94ca80a7b21a9b

Contents?: true

Size: 1.19 KB

Versions: 16

Compression:

Stored size: 1.19 KB

Contents

require 'pact_broker/client/hal'
require 'pact_broker/client/retry'

module PactBroker
  module Client
    module HalClientMethods
      def create_index_entry_point(pact_broker_base_url, pact_broker_client_options)
        PactBroker::Client::Hal::EntryPoint.new(pact_broker_base_url, create_http_client(pact_broker_client_options))
      end

      def create_entry_point(entry_point, pact_broker_client_options)
        PactBroker::Client::Hal::EntryPoint.new(entry_point, create_http_client(pact_broker_client_options))
      end

      def create_http_client(pact_broker_client_options)
        PactBroker::Client::Hal::HttpClient.new(pact_broker_client_options.merge(pact_broker_client_options[:basic_auth] || {}))
      end

      def index_entry_point
        @index_entry_point ||= create_index_entry_point(pact_broker_base_url, pact_broker_client_options)
      end

      def index_resource
        @index_resource ||= index_entry_point.get!
      end

      def is_pactflow?
        index_resource.response.headers.keys.any?{ | header_name | header_name.downcase.include?("pactflow") }
      end

      def pact_broker_name
        is_pactflow? ? "PactFlow" : "the Pact Broker"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pact_broker-client-1.77.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.76.2 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.76.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.76.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.75.4 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.75.3 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.75.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.75.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.74.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.73.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.72.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.71.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.70.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.69.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.68.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.67.0 lib/pact_broker/client/hal_client_methods.rb