class PactBroker::Api::Resources::TriggeredWebhookLogs

Public Instance Methods

allowed_methods() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 13
def allowed_methods
  ["GET", "OPTIONS"]
end
content_types_provided() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 9
def content_types_provided
  [["text/plain", :to_text], ["application/hal+json", :to_json]]
end
policy_name() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 34
def policy_name
  :'webhooks::triggered_webhook'
end
policy_record() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 38
def policy_record
  triggered_webhook
end
resource_exists?() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 17
def resource_exists?
  !!triggered_webhook
end
to_json() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 30
def to_json
  decorator_class(:triggered_webhook_logs_decorator).new(triggered_webhook).to_json(**decorator_options)
end
to_text() click to toggle source
# 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

Private Instance Methods

triggered_webhook() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 48
def triggered_webhook
  @triggered_webhook ||= PactBroker::Webhooks::TriggeredWebhook.find(uuid: identifier_from_path[:uuid])
end
webhook_executions() click to toggle source
# File lib/pact_broker/api/resources/triggered_webhook_logs.rb, line 44
def webhook_executions
  @webhook_executions ||= triggered_webhook.webhook_executions
end