Module: PactBroker::Api::Resources::WebhookExecutionMethods

Included in:
Pact, PublishContracts, Verifications, WebhookExecution
Defined in:
lib/pact_broker/api/resources/webhook_execution_methods.rb

Instance Method Summary collapse

Instance Method Details

#finish_requestObject



33
34
35
36
37
38
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 33

def finish_request
  if response.code < 400
    schedule_triggered_webhooks
  end
  super
end

#handle_webhook_eventsObject



23
24
25
26
27
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 23

def handle_webhook_events
  PactBroker::Events.subscribe(webhook_event_listener) do
    yield
  end
end

#schedule_triggered_webhooksObject



29
30
31
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 29

def schedule_triggered_webhooks
  webhook_event_listener.schedule_triggered_webhooks
end

#webhook_event_listenerObject



19
20
21
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 19

def webhook_event_listener
  @webhook_event_listener ||= PactBroker::Webhooks::EventListener.new(webhook_options)
end

#webhook_execution_configurationObject



8
9
10
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 8

def webhook_execution_configuration
  application_context.webhook_execution_configuration_creator.call(self)
end

#webhook_optionsObject



12
13
14
15
16
17
# File 'lib/pact_broker/api/resources/webhook_execution_methods.rb', line 12

def webhook_options
  {
    database_connector: database_connector,
    webhook_execution_configuration: webhook_execution_configuration
  }
end