Class: Pact::PactBroker::FetchPactURIsForVerification
- Inherits:
-
Object
- Object
- Pact::PactBroker::FetchPactURIsForVerification
- Includes:
- PactSelectionDescription
- Defined in:
- lib/pact/pact_broker/fetch_pact_uris_for_verification.rb
Constant Summary collapse
- PACTS_FOR_VERIFICATION_RELATION =
'pb:provider-pacts-for-verification'.freeze
- PACTS_FOR_VERIFICATION_RELATION_BETA =
'beta:provider-pacts-for-verification'.freeze
- PACTS =
'pacts'.freeze
- HREF =
'href'.freeze
- LINKS =
'_links'.freeze
- SELF =
'self'.freeze
- EMBEDDED =
'_embedded'.freeze
Instance Attribute Summary collapse
-
#broker_base_url ⇒ Object
readonly
Returns the value of attribute broker_base_url.
-
#consumer_version_selectors ⇒ Object
readonly
Returns the value of attribute consumer_version_selectors.
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
-
#http_client_options ⇒ Object
readonly
Returns the value of attribute http_client_options.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#provider_version_branch ⇒ Object
readonly
Returns the value of attribute provider_version_branch.
-
#provider_version_tags ⇒ Object
readonly
Returns the value of attribute provider_version_tags.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(provider, consumer_version_selectors, provider_version_branch, provider_version_tags, broker_base_url, http_client_options, options = {}) ⇒ FetchPactURIsForVerification
constructor
A new instance of FetchPactURIsForVerification.
Methods included from PactSelectionDescription
Constructor Details
#initialize(provider, consumer_version_selectors, provider_version_branch, provider_version_tags, broker_base_url, http_client_options, options = {}) ⇒ FetchPactURIsForVerification
Returns a new instance of FetchPactURIsForVerification.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 26 def initialize(provider, consumer_version_selectors, provider_version_branch, , broker_base_url, , = {}) @provider = provider @consumer_version_selectors = consumer_version_selectors || [] @provider_version_branch = provider_version_branch @provider_version_tags = [*] @http_client_options = @broker_base_url = broker_base_url @http_client = Pact::Hal::HttpClient.new() @options = end |
Instance Attribute Details
#broker_base_url ⇒ Object (readonly)
Returns the value of attribute broker_base_url.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def broker_base_url @broker_base_url end |
#consumer_version_selectors ⇒ Object (readonly)
Returns the value of attribute consumer_version_selectors.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def consumer_version_selectors @consumer_version_selectors end |
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def http_client @http_client end |
#http_client_options ⇒ Object (readonly)
Returns the value of attribute http_client_options.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def @http_client_options end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def @options end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def provider @provider end |
#provider_version_branch ⇒ Object (readonly)
Returns the value of attribute provider_version_branch.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def provider_version_branch @provider_version_branch end |
#provider_version_tags ⇒ Object (readonly)
Returns the value of attribute provider_version_tags.
16 17 18 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 16 def @provider_version_tags end |
Class Method Details
.call(provider, consumer_version_selectors, provider_version_branch, provider_version_tags, broker_base_url, http_client_options, options = {}) ⇒ Object
37 38 39 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 37 def self.call(provider, consumer_version_selectors, provider_version_branch, , broker_base_url, , = {}) new(provider, consumer_version_selectors, provider_version_branch, , broker_base_url, , ).call end |
Instance Method Details
#call ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pact/pact_broker/fetch_pact_uris_for_verification.rb', line 41 def call handling_no_pacts_found do if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA) pacts_for_verification else old_selectors = consumer_version_selectors.collect do | selector | { name: selector[:tag], all: !selector[:latest], fallback: selector[:fallbackTag]} end # Fall back to old method of fetching pacts FetchPacts.call(provider, old_selectors, broker_base_url, ) end end end |