Class: PactBroker::Webhooks::PactAndVerificationParameters

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/webhooks/pact_and_verification_parameters.rb

Constant Summary collapse

PACT_URL =
"pactbroker.pactUrl"
VERIFICATION_RESULT_URL =
"pactbroker.verificationResultUrl"
CONSUMER_VERSION_NUMBER =
"pactbroker.consumerVersionNumber"
PROVIDER_VERSION_NUMBER =
"pactbroker.providerVersionNumber"
PROVIDER_VERSION_TAGS =
"pactbroker.providerVersionTags"
PROVIDER_VERSION_BRANCH =
"pactbroker.providerVersionBranch"
PROVIDER_VERSION_DESCRIPTIONS =
"pactbroker.providerVersionDescriptions"
CONSUMER_VERSION_TAGS =
"pactbroker.consumerVersionTags"
CONSUMER_VERSION_BRANCH =
"pactbroker.consumerVersionBranch"
CONSUMER_NAME =
"pactbroker.consumerName"
PROVIDER_NAME =
"pactbroker.providerName"
GITHUB_VERIFICATION_STATUS =
"pactbroker.githubVerificationStatus"
BITBUCKET_VERIFICATION_STATUS =
"pactbroker.bitbucketVerificationStatus"
AZURE_DEV_OPS_VERIFICATION_STATUS =
"pactbroker.azureDevOpsVerificationStatus"
GITLAB_VERIFICATION_STATUS =
"pactbroker.gitlabVerificationStatus"
CONSUMER_LABELS =
"pactbroker.consumerLabels"
PROVIDER_LABELS =
"pactbroker.providerLabels"
BUILD_URL =
"pactbroker.buildUrl"
EVENT_NAME =
"pactbroker.eventName"
CURRENTLY_DEPLOYED_PROVIDER_VERSION_NUMBER =
"pactbroker.currentlyDeployedProviderVersionNumber"
ALL =
[
  CONSUMER_NAME,
  PROVIDER_NAME,
  CONSUMER_VERSION_NUMBER,
  PROVIDER_VERSION_NUMBER,
  PROVIDER_VERSION_TAGS,
  PROVIDER_VERSION_DESCRIPTIONS,
  PROVIDER_VERSION_BRANCH,
  CONSUMER_VERSION_TAGS,
  CONSUMER_VERSION_BRANCH,
  PACT_URL,
  VERIFICATION_RESULT_URL,
  GITHUB_VERIFICATION_STATUS,
  BITBUCKET_VERIFICATION_STATUS,
  AZURE_DEV_OPS_VERIFICATION_STATUS,
  GITLAB_VERIFICATION_STATUS,
  CONSUMER_LABELS,
  PROVIDER_LABELS,
  EVENT_NAME,
  BUILD_URL
]

Instance Method Summary collapse

Constructor Details

#initialize(pact, trigger_verification, webhook_context) ⇒ PactAndVerificationParameters

TODO change this verification to the latest main branch



48
49
50
51
52
53
# File 'lib/pact_broker/webhooks/pact_and_verification_parameters.rb', line 48

def initialize(pact, trigger_verification, webhook_context)
  @pact = pact
  @verification = trigger_verification || (pact && pact.latest_verification)
  @webhook_context = webhook_context
  @base_url = webhook_context.fetch(:base_url)
end

Instance Method Details

#to_hashObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/pact_broker/webhooks/pact_and_verification_parameters.rb', line 55

def to_hash
  @hash ||= {
    PACT_URL => pact ? PactBroker::Api::PactBrokerUrls.(pact, base_url) : "",
    VERIFICATION_RESULT_URL => verification_url,
    CONSUMER_VERSION_NUMBER => consumer_version_number,
    PROVIDER_VERSION_NUMBER => provider_version_number,
    PROVIDER_VERSION_TAGS => provider_version_tags,
    PROVIDER_VERSION_BRANCH => provider_version_branch,
    PROVIDER_VERSION_DESCRIPTIONS => provider_version_descriptions,
    CONSUMER_VERSION_TAGS => consumer_version_tags,
    CONSUMER_VERSION_BRANCH => consumer_version_branch,
    CONSUMER_NAME => pact ? pact.consumer_name : "",
    PROVIDER_NAME => pact ? pact.provider_name : "",
    GITHUB_VERIFICATION_STATUS => github_verification_status,
    BITBUCKET_VERIFICATION_STATUS => bitbucket_verification_status,
    AZURE_DEV_OPS_VERIFICATION_STATUS => azure_dev_ops_verification_status,
    GITLAB_VERIFICATION_STATUS => gitlab_verification_status,
    CONSUMER_LABELS => pacticipant_labels(pact && pact.consumer),
    PROVIDER_LABELS => pacticipant_labels(pact && pact.provider),
    EVENT_NAME => event_name,
    BUILD_URL => build_url,
    CURRENTLY_DEPLOYED_PROVIDER_VERSION_NUMBER => currently_deployed_provider_version_number
  }
end