Module: PactBroker::Client::HalClientMethods
- Included in:
- BaseCommand, Pacts::ListLatestVersions, PublishPacts, PublishPactsTheOldWay
- Defined in:
- lib/pact_broker/client/hal_client_methods.rb
Instance Method Summary collapse
- #create_entry_point(entry_point, pact_broker_client_options) ⇒ Object
- #create_http_client(pact_broker_client_options) ⇒ Object
- #create_index_entry_point(pact_broker_base_url, pact_broker_client_options) ⇒ Object
- #index_entry_point ⇒ Object
- #index_resource ⇒ Object
- #is_pactflow? ⇒ Boolean
- #pact_broker_name ⇒ Object
Instance Method Details
#create_entry_point(entry_point, pact_broker_client_options) ⇒ Object
11 12 13 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 11 def create_entry_point(entry_point, ) PactBroker::Client::Hal::EntryPoint.new(entry_point, create_http_client()) end |
#create_http_client(pact_broker_client_options) ⇒ Object
15 16 17 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 15 def create_http_client() PactBroker::Client::Hal::HttpClient.new(.merge([:basic_auth] || {})) end |
#create_index_entry_point(pact_broker_base_url, pact_broker_client_options) ⇒ Object
7 8 9 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 7 def create_index_entry_point(pact_broker_base_url, ) PactBroker::Client::Hal::EntryPoint.new(pact_broker_base_url, create_http_client()) end |
#index_entry_point ⇒ Object
19 20 21 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 19 def index_entry_point @index_entry_point ||= create_index_entry_point(pact_broker_base_url, ) end |
#index_resource ⇒ Object
23 24 25 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 23 def index_resource @index_resource ||= index_entry_point.get! end |
#is_pactflow? ⇒ Boolean
27 28 29 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 27 def is_pactflow? index_resource.response.headers.keys.any?{ | header_name | header_name.downcase.include?("pactflow") } end |
#pact_broker_name ⇒ Object
31 32 33 |
# File 'lib/pact_broker/client/hal_client_methods.rb', line 31 def pact_broker_name is_pactflow? ? "PactFlow" : "the Pact Broker" end |