Class: PactBroker::Api::Resources::TriggeredWebhookLogs

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/pact_broker/api/resources/triggered_webhook_logs.rb

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



13
14
15
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 13

def allowed_methods
  ["GET", "OPTIONS"]
end

#content_types_providedObject



9
10
11
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 9

def content_types_provided
  [["text/plain", :to_text]]
end

#policy_nameObject



30
31
32
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 30

def policy_name
  :'webhooks::webhook'
end

#policy_recordObject



34
35
36
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 34

def policy_record
  triggered_webhook&.webhook
end

#resource_exists?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 17

def resource_exists?
  !!triggered_webhook
end

#to_textObject



21
22
23
24
25
26
27
28
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 21

def to_text
  # Too simple to bother putting into a service
  if webhook_executions.any?
    webhook_executions.collect(&:logs).join("\n")
  else
    "Webhook has not executed yet. Please retry in a few seconds."
  end
end