class PactBroker::Webhooks::TriggeredWebhook

Constants

STATUS_FAILURE
STATUS_NOT_RUN
STATUS_RETRYING
STATUS_SUCCESS
TRIGGER_TYPE_RESOURCE_CREATION
TRIGGER_TYPE_USER

Public Instance Methods

consumer_name() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 69
def consumer_name
  consumer && consumer.name
end
delete() click to toggle source
Calls superclass method
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 27
def delete
  require "pact_broker/webhooks/execution"
  PactBroker::Webhooks::Execution.where(triggered_webhook: self).delete
  super
end
execute(options) click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 62
def execute options
  # getting a random 'no method to_domain for null' error
  # not sure on which object, so splitting this out into two lines
  pact = pact_publication.to_domain
  webhook.to_domain.execute(pact, verification, event_context.symbolize_keys, options)
end
failed() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 41
def failed
  where(status: STATUS_FAILURE)
end
failure?() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 81
def failure?
  status == STATUS_FAILURE
end
finished?() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 97
def finished?
  success? || failure?
end
not_run() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 45
def not_run
  where(status: STATUS_NOT_RUN)
end
not_run?() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 89
def not_run?
  status == STATUS_NOT_RUN
end
number_of_attempts_made() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 93
def number_of_attempts_made
  webhook_executions.size
end
number_of_attempts_remaining() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 101
def number_of_attempts_remaining
  if finished?
    0
  else
    (PactBroker.configuration.webhook_retry_schedule.size + 1) - number_of_attempts_made
  end
end
provider_name() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 73
def provider_name
  provider && provider.name
end
request_description() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 57
def request_description
  # webhook could be deleted
  webhook&.to_domain&.request_description
end
retrying() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 33
def retrying
  where(status: STATUS_RETRYING)
end
retrying?() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 85
def retrying?
  status == STATUS_RETRYING
end
success?() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 77
def success?
  status == STATUS_SUCCESS
end
successful() click to toggle source
# File lib/pact_broker/webhooks/triggered_webhook.rb, line 37
def successful
  where(status: STATUS_SUCCESS)
end