Class: PactBroker::Matrix::ParseCanIDeployQuery
- Inherits:
-
Object
- Object
- PactBroker::Matrix::ParseCanIDeployQuery
- Defined in:
- lib/pact_broker/matrix/parse_can_i_deploy_query.rb
Class Method Summary collapse
-
.call(params) ⇒ Object
rubocop: disable Metrics/CyclomaticComplexity.
Class Method Details
.call(params) ⇒ Object
rubocop: disable Metrics/CyclomaticComplexity
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pact_broker/matrix/parse_can_i_deploy_query.rb', line 8 def self.call params selector = PactBroker::Matrix::UnresolvedSelector.new = { latestby: "cvp" } if params[:pacticipant].is_a?(String) selector.pacticipant_name = params[:pacticipant] end if params[:version].is_a?(String) selector.pacticipant_version_number = params[:version] end if params[:to].is_a?(String) [:tag] = params[:to] [:latest] = true end if params[:environment].is_a?(String) [:environment_name] = params[:environment] # Multiple versions of an integrated application can be simultaneously released to an # environment (record-release), or deployed to it on different targets (record-deployment). # "cvp" collapses these down to the latest provider version, hiding incompatible versions # that are still live. "cvpv" evaluates every co-resident version independently. See issue #903. [:latestby] = "cvpv" end if params[:ignore].is_a?(Array) [:ignore_selectors] = params[:ignore].collect do | param | if param.is_a?(String) PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: param) elsif param.is_a?(Hash) && param.key?(:pacticipant) PactBroker::Matrix::UnresolvedSelector.new({ pacticipant_name: param[:pacticipant], pacticipant_version_number: param[:version] }.compact) end end.compact else [:ignore_selectors] = [] end return [selector], end |