Sha256: f6fc853fa62699e01e630dcdcbab8d7899d7927fb3eea5bc87100e705a05e491

Contents?: true

Size: 834 Bytes

Versions: 6

Compression:

Stored size: 834 Bytes

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 ||= Retry.while_error do
          index_entry_point.get!
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-client-1.38.3 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.38.2 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.38.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.38.0 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.37.1 lib/pact_broker/client/hal_client_methods.rb
pact_broker-client-1.37.0 lib/pact_broker/client/hal_client_methods.rb