Class: PactBroker::Client::PublishPactsTheOldWay

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HalClientMethods

#create_http_client, #create_index_entry_point, #is_pactflow?, #pact_broker_name

Constructor Details

#initialize(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options = {}) ⇒ PublishPactsTheOldWay

Returns a new instance of PublishPactsTheOldWay.



21
22
23
24
25
26
27
28
29
30
# File 'lib/pact_broker/client/publish_pacts_the_old_way.rb', line 21

def initialize pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options={}
  @pact_broker_base_url = pact_broker_base_url
  @pact_file_paths = pact_file_paths
  @consumer_version_number = consumer_version_params[:number].respond_to?(:strip) ? consumer_version_params[:number].strip : consumer_version_params[:number]
  @branch = consumer_version_params[:branch]
  @build_url = consumer_version_params[:build_url]
  @tags = consumer_version_params[:tags] ? consumer_version_params[:tags].collect{ |tag| tag.respond_to?(:strip) ? tag.strip : tag } : []
  @version_required = consumer_version_params[:version_required]
  @pact_broker_client_options = pact_broker_client_options
end

Class Method Details

.call(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options = {}) ⇒ Object



17
18
19
# File 'lib/pact_broker/client/publish_pacts_the_old_way.rb', line 17

def self.call(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options={})
  new(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options).call
end

Instance Method Details

#callObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pact_broker/client/publish_pacts_the_old_way.rb', line 32

def call
  validate
  $stdout.puts("")
  result = create_consumer_versions && apply_tags && publish_pacts
  $stdout.puts("")
  if result
    PactBroker::Client::CommandResult.new(true)
  else
    PactBroker::Client::CommandResult.new(false, "One or more pacts failed to be published")
  end
end