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



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

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

#content_types_providedObject



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

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

#resource_exists?Boolean

Returns:

  • (Boolean)


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

def resource_exists?
  !!resource_object
end

#resource_objectObject



22
23
24
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 22

def resource_object
  triggered_webhook
end

#to_textObject



26
27
28
29
# File 'lib/pact_broker/api/resources/triggered_webhook_logs.rb', line 26

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

#triggered_webhookObject



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

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