Class: PactBroker::Matrix::Repository

Inherits:
Object
  • Object
show all
Includes:
Repositories
Defined in:
lib/pact_broker/matrix/repository.rb

Constant Summary collapse

TP_COLS =

Used when using table_print to output query results

[ :consumer_version_number, :pact_revision_number, :provider_version_number, :verification_number]
GROUP_BY_CONSUMER_VERSION_AND_PROVIDER_VERSION =
[:consumer_name, :consumer_version_number, :provider_name, :provider_version_number]
GROUP_BY_CONSUMER_VERSION_AND_PROVIDER =
[:consumer_name, :consumer_version_number, :provider_name]
GROUP_BY_CONSUMER_AND_PROVIDER =
[:consumer_name, :provider_name]

Constants included from Repositories

Repositories::REPOSITORY_FACTORIES

Instance Method Summary collapse

Methods included from Repositories

#branch_repository, #branch_version_repository, #get_repository, #integration_repository, #label_repository, #matrix_repository, #pact_repository, #pacticipant_repository, #register_default_repositories, #register_repository, #tag_repository, #verification_repository, #version_repository, #webhook_repository

Instance Method Details

#find(unresolved_specified_selectors, options = {}) ⇒ Object

THE METHOD for querying the Matrix

Parameters:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pact_broker/matrix/repository.rb', line 28

def find(unresolved_specified_selectors, options = {})
  infer_selectors = infer_selectors_for_integrations?(options)
  resolved_selectors_builder = ResolvedSelectorsBuilder.new
  resolved_selectors_builder.resolve_selectors(unresolved_specified_selectors, options.fetch(:ignore_selectors, []))
  integrations = matrix_integration_repository.find_integrations_for_specified_selectors(resolved_selectors_builder.specified_selectors, infer_selectors)
  resolved_selectors_builder.resolve_inferred_selectors(integrations, options) if infer_selectors

  considered_rows, ignored_rows = find_considered_and_ignored_rows(resolved_selectors_builder.all_selectors, resolved_selectors_builder.ignore_selectors, options)
  QueryResults.new(
    considered_rows.sort,
    ignored_rows.sort,
    unresolved_specified_selectors,
    options,
    resolved_selectors_builder.all_selectors,
    resolved_selectors_builder.ignore_selectors,
    integrations
  )
end

#find_for_consumer_and_provider(pacticipant_1_name, pacticipant_2_name) ⇒ Object



47
48
49
50
51
# File 'lib/pact_broker/matrix/repository.rb', line 47

def find_for_consumer_and_provider(pacticipant_1_name, pacticipant_2_name)
  selectors = [ UnresolvedSelector.new(pacticipant_name: pacticipant_1_name), UnresolvedSelector.new(pacticipant_name: pacticipant_2_name)]
  options = { latestby: "cvpv" }
  find(selectors, options)
end