Sha256: 2bd95b274cae0cb1c19a38f7c0f825e230de0e944cf39459d72e07037cfc8a13

Contents?: true

Size: 1 KB

Versions: 24

Compression:

Stored size: 1 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_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

24 entries across 24 versions & 1 rubygems

Version Path
pact_broker-client-1.61.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.61.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.60.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.59.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.58.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.57.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.56.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.55.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.54.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.53.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.52.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.51.2 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.51.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.51.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.50.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.49.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.48.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.47.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.47.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.46.0 lib/pact_broker/client/hal_client_methods.rb