Class: PactBroker::Client::PublishPacts
- Inherits:
-
Object
- Object
- PactBroker::Client::PublishPacts
- Includes:
- HalClientMethods
- Defined in:
- lib/pact_broker/client/publish_pacts.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options = {}) ⇒ PublishPacts
constructor
A new instance of PublishPacts.
Methods included from HalClientMethods
#create_http_client, #create_index_entry_point, #index_entry_point, #index_resource, #is_pactflow?, #pact_broker_name
Constructor Details
#initialize(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options = {}) ⇒ PublishPacts
Returns a new instance of PublishPacts.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pact_broker/client/publish_pacts.rb', line 17 def initialize pact_broker_base_url, pact_file_paths, consumer_version_params, , ={} @pact_broker_base_url = pact_broker_base_url @pact_file_paths = pact_file_paths @consumer_version_params = consumer_version_params @consumer_version_number = strip(consumer_version_params[:number]) @branch = strip(consumer_version_params[:branch]) @build_url = strip(consumer_version_params[:build_url]) @tags = consumer_version_params[:tags] ? consumer_version_params[:tags].collect{ |tag| strip(tag) } : [] @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
13 14 15 |
# File 'lib/pact_broker/client/publish_pacts.rb', line 13 def self.call(pact_broker_base_url, pact_file_paths, consumer_version_params, , ={}) new(pact_broker_base_url, pact_file_paths, consumer_version_params, , ).call end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/pact_broker/client/publish_pacts.rb', line 29 def call validate if ENV.fetch("PACT_BROKER_FEATURES", "").include?("publish_contracts") && index_resource.can?("pb:publish-contracts") publish_pacts PactBroker::Client::CommandResult.new(success?, ) else PublishPactsTheOldWay.call(pact_broker_base_url, pact_file_paths, consumer_version_params, , ) end end |