Class: PactBroker::Client::BaseCommand

Inherits:
Object
  • Object
show all
Includes:
HalClientMethods
Defined in:
lib/pact_broker/client/base_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HalClientMethods

#create_http_client, #create_index_entry_point, #index_entry_point, #index_resource, #is_pactflow?, #pact_broker_name

Constructor Details

#initialize(params, options, pact_broker_client_options) ⇒ BaseCommand

Returns a new instance of BaseCommand.



16
17
18
19
20
21
# File 'lib/pact_broker/client/base_command.rb', line 16

def initialize(params, options, pact_broker_client_options)
  @params = params
  @options = options
  @pact_broker_base_url = pact_broker_client_options.fetch(:pact_broker_base_url)
  @pact_broker_client_options = pact_broker_client_options
end

Class Method Details

.call(params, options, pact_broker_client_options) ⇒ Object



12
13
14
# File 'lib/pact_broker/client/base_command.rb', line 12

def self.call(params, options, pact_broker_client_options)
  new(params, options, pact_broker_client_options).call
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/pact_broker/client/base_command.rb', line 23

def call
  check_if_command_supported
  do_call
rescue PactBroker::Client::Hal::ErrorResponseReturned => e
  handle_http_error(e)
rescue PactBroker::Client::Error => e
  handle_ruby_error(e)
rescue StandardError => e
  handle_ruby_error(e, verbose?)
end