Sha256: 289389b0d9a6e87834a28e88d73f2baf2e545e1e4ea89c8a147a669243bdc616

Contents?: true

Size: 983 Bytes

Versions: 6

Compression:

Stored size: 983 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/webhooks/triggered_webhook'

module PactBroker
  module Api
    module Resources

      class TriggeredWebhookLogs < BaseResource

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

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

        def resource_exists?
          !!resource_object
        end

        def resource_object
          triggered_webhook
        end

        def to_text
          # Too simple to bother putting into a service
          triggered_webhook.webhook_executions.collect(&:logs).join("\n")
        end

        def triggered_webhook
          @triggered_webhook ||= begin
            criteria = { webhook_uuid: identifier_from_path[:uuid], trigger_uuid: identifier_from_path[:trigger_uuid] }
            PactBroker::Webhooks::TriggeredWebhook.where(criteria).single_record
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-2.60.0 lib/pact_broker/api/resources/triggered_webhook_logs.rb
pact_broker-2.59.2 lib/pact_broker/api/resources/triggered_webhook_logs.rb
pact_broker-2.59.1 lib/pact_broker/api/resources/triggered_webhook_logs.rb
pact_broker-2.59.0 lib/pact_broker/api/resources/triggered_webhook_logs.rb
pact_broker-2.58.3 lib/pact_broker/api/resources/triggered_webhook_logs.rb
pact_broker-2.58.2 lib/pact_broker/api/resources/triggered_webhook_logs.rb