Class: PactBroker::Webhooks::Job

Inherits:
Object
  • Object
show all
Includes:
Logging, SuckerPunch::Job
Defined in:
lib/pact_broker/webhooks/job.rb

Constant Summary

Constants included from Logging

Logging::LOG_DIR, Logging::LOG_FILE_NAME

Instance Method Summary collapse

Methods included from Logging

included, #log_error, #logger, #logger=

Instance Method Details

#perform(data) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pact_broker/webhooks/job.rb', line 12

def perform data
  @data = data
  @triggered_webhook = PactBroker::Webhooks::TriggeredWebhook.find(id: data[:triggered_webhook].id)
  @error_count = data[:error_count] || 0
  begin
    webhook_execution_result = PactBroker::Webhooks::Service.execute_triggered_webhook_now triggered_webhook, execution_options
    if webhook_execution_result.success?
      handle_success
    else
      handle_failure
    end
  rescue StandardError => e
    handle_error e
  end
end