Skip to content

Commit 89ea1a5

Browse files
committed
feat: correct logs relation to pb:logs in the triggered webhooks resource
1 parent db1ed1e commit 89ea1a5

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/pact_broker/api/decorators/triggered_webhook_decorator.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,22 @@ class TriggeredWebhookDecorator < BaseDecorator
1212

1313
property :created_at, as: :triggeredAt
1414

15-
link :logs do | context |
15+
link :'pb:logs' do | context |
1616
{
1717
href: triggered_webhook_logs_url(represented, context[:base_url]),
1818
title: "Webhook execution logs",
1919
name: represented.request_description
2020
}
2121
end
2222

23+
link :logs do | context |
24+
{
25+
href: triggered_webhook_logs_url(represented, context[:base_url]),
26+
title: "DEPRECATED - Use pb:logs",
27+
name: represented.request_description
28+
}
29+
end
30+
2331
link :'pb:webhook' do | context |
2432
{
2533
href: webhook_url(represented.webhook_uuid, context[:base_url]),

lib/pact_broker/api/resources/triggered_webhook_logs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def to_text
2626

2727
def triggered_webhook
2828
@triggered_webhook ||= begin
29-
criteria = {webhook_uuid: identifier_from_path[:uuid], trigger_uuid: identifier_from_path[:trigger_uuid]}
29+
criteria = { webhook_uuid: identifier_from_path[:uuid], trigger_uuid: identifier_from_path[:trigger_uuid] }
3030
PactBroker::Webhooks::TriggeredWebhook.where(criteria).single_record
3131
end
3232
end

spec/lib/pact_broker/api/decorators/triggered_webhook_decorator_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module Decorators
4343
subject { JSON.parse(json, symbolize_names: true) }
4444

4545
it "includes a link to the logs" do
46-
expect(subject[:_links][:logs][:href]).to eq logs_url
46+
expect(subject[:_links][:'pb:logs'][:href]).to eq logs_url
4747
end
4848

4949
it "includes a link to the webhook" do

0 commit comments

Comments
 (0)