pact_broker 2.31.0 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/db/migrations/20190509_create_version_sequence.rb +8 -0
- data/db/migrations/20190510_set_version_sequence.rb +9 -0
- data/db/migrations/20190511_create_integrations_view.rb +19 -0
- data/db/migrations/20190523_add_enabled_column_to_webhooks.rb +5 -0
- data/db/migrations/20190524_set_webhooks_enabled.rb +10 -0
- data/db/migrations/20190525_add_description_column_to_webhooks.rb +5 -0
- data/lib/pact_broker/api.rb +3 -0
- data/lib/pact_broker/api/decorators/base_decorator.rb +0 -3
- data/lib/pact_broker/api/decorators/integration_decorator.rb +40 -0
- data/lib/pact_broker/api/decorators/integrations_decorator.rb +19 -0
- data/lib/pact_broker/api/decorators/pact_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/pact_details_decorator.rb +1 -6
- data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +12 -0
- data/lib/pact_broker/api/decorators/verifiable_pacts_decorator.rb +20 -0
- data/lib/pact_broker/api/decorators/webhook_decorator.rb +5 -1
- data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +0 -1
- data/lib/pact_broker/api/decorators/webhooks_decorator.rb +2 -2
- data/lib/pact_broker/api/pact_broker_urls.rb +37 -3
- data/lib/pact_broker/api/resources/base_resource.rb +4 -0
- data/lib/pact_broker/api/resources/dashboard.rb +1 -1
- data/lib/pact_broker/api/resources/integrations.rb +10 -2
- data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +8 -14
- data/lib/pact_broker/api/resources/pact.rb +15 -3
- data/lib/pact_broker/api/resources/verification.rb +0 -2
- data/lib/pact_broker/api/resources/verifications.rb +18 -1
- data/lib/pact_broker/api/resources/webhook.rb +1 -1
- data/lib/pact_broker/api/resources/webhook_execution.rb +18 -9
- data/lib/pact_broker/app.rb +10 -11
- data/lib/pact_broker/db.rb +2 -2
- data/lib/pact_broker/db/data_migrations/helpers.rb +11 -0
- data/lib/pact_broker/db/data_migrations/set_latest_version_sequence_value.rb +29 -0
- data/lib/pact_broker/db/data_migrations/set_webhooks_enabled.rb +17 -0
- data/lib/pact_broker/db/migrate_data.rb +2 -0
- data/lib/pact_broker/db/seed_example_data.rb +6 -3
- data/lib/pact_broker/domain/order_versions.rb +14 -1
- data/lib/pact_broker/domain/verification.rb +4 -0
- data/lib/pact_broker/domain/webhook.rb +13 -3
- data/lib/pact_broker/domain/webhook_request.rb +3 -2
- data/lib/pact_broker/index/service.rb +3 -0
- data/lib/pact_broker/integrations/integration.rb +10 -0
- data/lib/pact_broker/integrations/service.rb +5 -0
- data/lib/pact_broker/matrix/parse_query.rb +2 -0
- data/lib/pact_broker/matrix/row.rb +8 -0
- data/lib/pact_broker/matrix/service.rb +1 -2
- data/lib/pact_broker/pacts/service.rb +16 -9
- data/lib/pact_broker/test/test_data_builder.rb +6 -2
- data/lib/pact_broker/verifications/sequence.rb +0 -2
- data/lib/pact_broker/verifications/service.rb +10 -2
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/sequence.rb +38 -0
- data/lib/pact_broker/webhooks/job.rb +19 -7
- data/lib/pact_broker/webhooks/render.rb +30 -13
- data/lib/pact_broker/webhooks/repository.rb +3 -4
- data/lib/pact_broker/webhooks/service.rb +60 -34
- data/lib/pact_broker/webhooks/trigger_service.rb +6 -6
- data/lib/pact_broker/webhooks/webhook.rb +9 -1
- data/lib/pact_broker/webhooks/webhook_request_template.rb +11 -7
- data/lib/rack/pact_broker/database_transaction.rb +6 -2
- data/script/publish-new.sh +23 -1
- data/script/publish.sh +13 -4
- data/script/seed.rb +53 -52
- data/spec/features/create_webhook_spec.rb +2 -0
- data/spec/features/execute_webhook_spec.rb +4 -3
- data/spec/features/get_integrations_spec.rb +17 -0
- data/spec/features/get_pacts_to_verify_spec.rb +7 -3
- data/spec/features/publish_verification_spec.rb +8 -1
- data/spec/features/update_webhook_spec.rb +47 -0
- data/spec/integration/webhooks/certificate_spec.rb +1 -1
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +12 -0
- data/spec/lib/pact_broker/api/decorators/integration_decorator_spec.rb +82 -0
- data/spec/lib/pact_broker/api/decorators/integrations_decorator_spec.rb +29 -0
- data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +12 -4
- data/spec/lib/pact_broker/api/decorators/verifiable_pact_decorator_spec.rb +30 -0
- data/spec/lib/pact_broker/api/decorators/verifiable_pacts_decorator_spec.rb +29 -0
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +20 -1
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +0 -4
- data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +5 -4
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +64 -1
- data/spec/lib/pact_broker/api/resources/pact_spec.rb +0 -3
- data/spec/lib/pact_broker/api/resources/verifications_spec.rb +40 -10
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +13 -3
- data/spec/lib/pact_broker/app_spec.rb +28 -4
- data/spec/lib/pact_broker/db/data_migrations/set_latest_version_sequence_value_spec.rb +68 -0
- data/spec/lib/pact_broker/domain/order_versions_spec.rb +1 -4
- data/spec/lib/pact_broker/domain/webhook_spec.rb +10 -6
- data/spec/lib/pact_broker/matrix/parse_query_spec.rb +15 -7
- data/spec/lib/pact_broker/pacts/service_spec.rb +13 -5
- data/spec/lib/pact_broker/verifications/service_spec.rb +15 -3
- data/spec/lib/pact_broker/versions/repository_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/job_spec.rb +52 -15
- data/spec/lib/pact_broker/webhooks/render_spec.rb +28 -7
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +23 -32
- data/spec/lib/pact_broker/webhooks/service_spec.rb +186 -62
- data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +6 -5
- data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +12 -5
- data/spec/lib/rack/pact_broker/database_transaction_spec.rb +10 -0
- data/spec/lib/rack/pact_broker/ui_request_filter_spec.rb +9 -0
- data/spec/migrations/23_pact_versions_spec.rb +7 -1
- data/spec/support/database_cleaner.rb +11 -1
- data/spec/support/metadata_test_server.rb +40 -0
- data/spec/support/verification_job.rb +34 -0
- data/spec/support/webhook_endpoint_middleware.rb +22 -0
- metadata +37 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc025b711061dcb0c7ceecb89e57b5df8560667
|
4
|
+
data.tar.gz: 87e712268e55f5325f1ea3c6a81dd370504b34f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc84f0a9394bb378f64bcb04796a4f594c395f4a1f1018e55e2e64a1a97738346be25f5ecf1a6632ec4b0ce100fd36d3fb1167de90af0db62b4abb95ae258e21
|
7
|
+
data.tar.gz: 2b135a336313e79f8f448f8ab466bf9d50c1f096d425c406edbda93a415bb62a28abbea616f64dad1af226650f1340a5d43ac6f263020c9c877c9ec04b945662
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1
|
+
<a name="v2.32.0"></a>
|
2
|
+
### v2.32.0 (2019-05-28)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* **webhooks**
|
8
|
+
* maintain starred out Authorization header value ([cc978582](/../../commit/cc978582))
|
9
|
+
* don't use username if empty string ([9327271d](/../../commit/9327271d))
|
10
|
+
* do not show backtrace in webhook test execution response ([c8a8194e](/../../commit/c8a8194e))
|
11
|
+
* return a 200 status for webhook test execution response even when execution has failed ([d90c4552](/../../commit/d90c4552))
|
12
|
+
* do not require basic auth password to be re-submitted when a webhook is updated - maintain existing value if not present ([55d7f4ad](/../../commit/55d7f4ad))
|
13
|
+
* allow description to be edited ([302d70f6](/../../commit/302d70f6))
|
14
|
+
* only trigger enabled webhooks ([cb2b0321](/../../commit/cb2b0321))
|
15
|
+
* add enabled column to model and database schema ([ce452ec8](/../../commit/ce452ec8))
|
16
|
+
|
17
|
+
* add metadata to webhook and verification URLs to correctly track relevant versions and tags (#274) ([426b0b19](/../../commit/426b0b19))
|
18
|
+
* add group url to /integrations _links ([e2584f53](/../../commit/e2584f53))
|
19
|
+
* add matrix URL to /integration _links ([344d3e18](/../../commit/344d3e18))
|
20
|
+
* allow dashboard resource to be filtered by consumer/provider ([a2408520](/../../commit/a2408520))
|
21
|
+
* add hal+json endpoint for listing integrations ([40f3e021](/../../commit/40f3e021))
|
22
|
+
* allow a custom API to be configured ([1c371163](/../../commit/1c371163))
|
23
|
+
|
24
|
+
* **webhook**
|
25
|
+
* show user specified description instead of generated one in collection resource ([2643d957](/../../commit/2643d957))
|
26
|
+
|
27
|
+
* **matrix**
|
28
|
+
* do not default to latestby=cvpv for consumer/provider matrix ([742d506c](/../../commit/742d506c))
|
29
|
+
|
30
|
+
|
31
|
+
#### Bug Fixes
|
32
|
+
|
33
|
+
* **webhooks**
|
34
|
+
* correctly set updated consumer and provider ([d865a429](/../../commit/d865a429))
|
35
|
+
|
36
|
+
* default matrix limit for /matrix/provider/PROVIDER/consumer/CONSUMER endpoint to 100 ([7ccc9b6f](/../../commit/7ccc9b6f))
|
37
|
+
* gracefully handle situation where webhook is deleted before execution ([634ccd53](/../../commit/634ccd53))
|
38
|
+
* duplicate key value violates unique constraint uq_ver_ppt_ord ([4303e4f7](/../../commit/4303e4f7))
|
39
|
+
|
40
|
+
|
1
41
|
<a name="v2.31.0"></a>
|
2
42
|
### v2.31.0 (2019-04-30)
|
3
43
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_view(:integrations,
|
4
|
+
from(:pact_publications)
|
5
|
+
.select(
|
6
|
+
:consumer_id,
|
7
|
+
Sequel[:c][:name].as(:consumer_name),
|
8
|
+
:provider_id,
|
9
|
+
Sequel[:p][:name].as(:provider_name)
|
10
|
+
).distinct
|
11
|
+
.join(:pacticipants, {:id => :consumer_id}, {:table_alias => :c, implicit_qualifier: :pact_publications})
|
12
|
+
.join(:pacticipants, {:id => :provider_id}, {:table_alias => :p, implicit_qualifier: :pact_publications})
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
down do
|
17
|
+
drop_view(:integrations)
|
18
|
+
end
|
19
|
+
end
|
data/lib/pact_broker/api.rb
CHANGED
@@ -17,6 +17,7 @@ module PactBroker
|
|
17
17
|
# Pacts
|
18
18
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication"}
|
19
19
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha], Api::Resources::PactVersion, {resource_name: "pact_publication"}
|
20
|
+
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha, 'metadata', :metadata], Api::Resources::PactVersion, {resource_name: "pact_publication"}
|
20
21
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number, 'previous-distinct'], Api::Resources::PreviousDistinctPactVersion, {resource_name: "previous_distinct_pact_version"}
|
21
22
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number, 'diff', 'previous-distinct'], Api::Resources::PactContentDiff, {resource_name: "previous_distinct_pact_version_diff"}
|
22
23
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number, 'diff', 'version', :comparison_consumer_version], Api::Resources::PactContentDiff, {resource_name: "pact_version_diff_by_consumer_version"}
|
@@ -24,6 +25,7 @@ module PactBroker
|
|
24
25
|
|
25
26
|
# Verifications
|
26
27
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha, 'verification-results'], Api::Resources::Verifications, {resource_name: "verification_results"}
|
28
|
+
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha, 'metadata', :metadata, 'verification-results'], Api::Resources::Verifications, {resource_name: "verification_results"}
|
27
29
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha, 'verification-results', :verification_number], Api::Resources::Verification, {resource_name: "verification_result"}
|
28
30
|
add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha, 'verification-results', :verification_number, 'triggered-webhooks'], Api::Resources::VerificationTriggeredWebhooks, {resource_name: "verification_result_triggered_webhooks"}
|
29
31
|
add ['verification-results', 'consumer', :consumer_name, 'version', :consumer_version_number,'latest'], Api::Resources::LatestVerificationsForConsumerVersion, {resource_name: "verification_results_for_consumer_version"}
|
@@ -84,6 +86,7 @@ module PactBroker
|
|
84
86
|
add ['matrix'], Api::Resources::Matrix, {resource_name: "matrix"}
|
85
87
|
|
86
88
|
add ['dashboard'], Api::Resources::Dashboard, {resource_name: "dashboard"}
|
89
|
+
add ['dashboard', 'provider', :provider_name, 'consumer', :consumer_name ], Api::Resources::Dashboard, {resource_name: "integration_dashboard"}
|
87
90
|
add ['test','error'], Api::Resources::ErrorTest, {resource_name: "error_test"}
|
88
91
|
|
89
92
|
add ['integrations'], Api::Resources::Integrations, {resource_name: "integrations"}
|
@@ -5,11 +5,8 @@ require 'pact_broker/api/decorators/decorator_context'
|
|
5
5
|
require 'pact_broker/api/decorators/format_date_time'
|
6
6
|
|
7
7
|
module PactBroker
|
8
|
-
|
9
8
|
module Api
|
10
|
-
|
11
9
|
module Decorators
|
12
|
-
|
13
10
|
class BaseDecorator < Roar::Decorator
|
14
11
|
include Roar::JSON::HAL
|
15
12
|
include Roar::JSON::HAL::Links
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative 'base_decorator'
|
2
|
+
require 'pact_broker/api/pact_broker_urls'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Api
|
6
|
+
module Decorators
|
7
|
+
class IntegrationDecorator < BaseDecorator
|
8
|
+
include PactBroker::Api::PactBrokerUrls
|
9
|
+
|
10
|
+
property :consumer do
|
11
|
+
property :name
|
12
|
+
end
|
13
|
+
|
14
|
+
property :provider do
|
15
|
+
property :name
|
16
|
+
end
|
17
|
+
|
18
|
+
link "pb:dashboard" do | options |
|
19
|
+
{
|
20
|
+
title: "BETA: Pacts to show on the dashboard",
|
21
|
+
href: dashboard_url_for_integration(represented.consumer.name, represented.provider.name, options.fetch(:base_url))
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
link "pb:matrix" do | options |
|
26
|
+
{
|
27
|
+
title: "Matrix of pacts/verification results for #{represented.consumer.name} and #{represented.provider.name}",
|
28
|
+
href: matrix_url(represented.consumer.name, represented.provider.name, options.fetch(:base_url))
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
link "pb:group" do | options |
|
33
|
+
{
|
34
|
+
href: group_url(represented.consumer.name, options.fetch(:base_url))
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'base_decorator'
|
2
|
+
require_relative 'integration_decorator'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Api
|
6
|
+
module Decorators
|
7
|
+
class IntegrationsDecorator < BaseDecorator
|
8
|
+
collection :entries, as: :integrations, embedded: true, :extend => PactBroker::Api::Decorators::IntegrationDecorator
|
9
|
+
|
10
|
+
link :self do | context |
|
11
|
+
{
|
12
|
+
href: context[:resource_url],
|
13
|
+
title: "All integrations"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -146,7 +146,7 @@ module PactBroker
|
|
146
146
|
link :'pb:publish-verification-results' do | options |
|
147
147
|
{
|
148
148
|
title: "Publish verification results",
|
149
|
-
href: verification_publication_url(represented, options.fetch(:base_url))
|
149
|
+
href: verification_publication_url(represented, options.fetch(:base_url), options[:metadata])
|
150
150
|
}
|
151
151
|
end
|
152
152
|
|
@@ -2,21 +2,16 @@ require_relative 'base_decorator'
|
|
2
2
|
require_relative 'pact_pacticipant_decorator'
|
3
3
|
|
4
4
|
module PactBroker
|
5
|
-
|
6
5
|
module Api
|
7
|
-
|
8
6
|
module Decorators
|
9
|
-
|
10
7
|
class PactDetailsDecorator < BaseDecorator
|
11
|
-
|
12
8
|
property :consumer, :extend => PactBroker::Api::Decorators::PactPacticipantDecorator, :embedded => true
|
13
9
|
property :provider, :extend => PactBroker::Api::Decorators::PactPacticipantDecorator, :embedded => true
|
14
10
|
|
15
11
|
link :self do | options |
|
16
12
|
pact_url(options[:base_url], represented)
|
17
13
|
end
|
18
|
-
|
19
14
|
end
|
20
15
|
end
|
21
16
|
end
|
22
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'base_decorator'
|
2
|
+
require_relative 'verifiable_pact_decorator'
|
3
|
+
require 'pact_broker/api/pact_broker_urls'
|
4
|
+
|
5
|
+
module PactBroker
|
6
|
+
module Api
|
7
|
+
module Decorators
|
8
|
+
class VerifiablePactsDecorator < BaseDecorator
|
9
|
+
collection :entries, as: :pacts, embedded: true, :extend => PactBroker::Api::Decorators::VerifiablePactDecorator
|
10
|
+
|
11
|
+
link :self do | context |
|
12
|
+
{
|
13
|
+
href: context[:resource_url],
|
14
|
+
title: "Pacts to be verified"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -16,6 +16,8 @@ module PactBroker
|
|
16
16
|
property :name
|
17
17
|
end
|
18
18
|
|
19
|
+
property :description, getter: lambda { |context| context[:represented].display_description }
|
20
|
+
|
19
21
|
property :consumer, :class => PactBroker::Domain::Pacticipant do
|
20
22
|
property :name
|
21
23
|
end
|
@@ -24,6 +26,8 @@ module PactBroker
|
|
24
26
|
property :name
|
25
27
|
end
|
26
28
|
|
29
|
+
property :enabled, default: true
|
30
|
+
|
27
31
|
property :request, :class => PactBroker::Webhooks::WebhookRequestTemplate, extend: WebhookRequestTemplateDecorator
|
28
32
|
collection :events, :class => PactBroker::Webhooks::WebhookEvent, extend: WebhookEventDecorator
|
29
33
|
|
@@ -31,7 +35,7 @@ module PactBroker
|
|
31
35
|
|
32
36
|
link :self do | options |
|
33
37
|
{
|
34
|
-
title: represented.
|
38
|
+
title: represented.display_description,
|
35
39
|
href: webhook_url(represented.uuid, options[:base_url])
|
36
40
|
}
|
37
41
|
|
@@ -24,8 +24,8 @@ module PactBroker
|
|
24
24
|
links :'pb:webhooks' do | context |
|
25
25
|
represented.entries.collect do | webhook |
|
26
26
|
{
|
27
|
-
title:
|
28
|
-
name: webhook.
|
27
|
+
title: "Webhook",
|
28
|
+
name: webhook.display_description,
|
29
29
|
href: webhook_url(webhook.uuid, context[:base_url])
|
30
30
|
}
|
31
31
|
end
|
@@ -54,6 +54,27 @@ module PactBroker
|
|
54
54
|
"#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}"
|
55
55
|
end
|
56
56
|
|
57
|
+
def pact_version_url_with_metadata pact, base_url = ''
|
58
|
+
"#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}/metadata/#{build_webhook_metadata(pact)}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_webhook_metadata(pact)
|
62
|
+
Base64.strict_encode64(Rack::Utils.build_nested_query(
|
63
|
+
consumer_version_number: pact.consumer_version_number,
|
64
|
+
consumer_version_tags: pact.consumer_version_tag_names
|
65
|
+
))
|
66
|
+
end
|
67
|
+
|
68
|
+
def parse_webhook_metadata(metadata)
|
69
|
+
if metadata
|
70
|
+
Rack::Utils.parse_nested_query(Base64.strict_decode64(metadata)).each_with_object({}) do | (k, v), new_hash |
|
71
|
+
new_hash[k.to_sym] = v
|
72
|
+
end
|
73
|
+
else
|
74
|
+
{}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
57
78
|
def pact_url_from_params base_url, params
|
58
79
|
[ base_url, 'pacts',
|
59
80
|
'provider', url_encode(params[:provider_name]),
|
@@ -81,6 +102,10 @@ module PactBroker
|
|
81
102
|
"#{base_url}/integrations/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
|
82
103
|
end
|
83
104
|
|
105
|
+
def dashboard_url_for_integration consumer_name, provider_name, base_url = ""
|
106
|
+
"#{base_url}/dashboard/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
|
107
|
+
end
|
108
|
+
|
84
109
|
def previous_distinct_diff_url pact, base_url
|
85
110
|
pact_url(base_url, pact) + "/diff/previous-distinct"
|
86
111
|
end
|
@@ -132,8 +157,9 @@ module PactBroker
|
|
132
157
|
"#{verification_url(verification, base_url)}/triggered-webhooks"
|
133
158
|
end
|
134
159
|
|
135
|
-
def verification_publication_url pact, base_url
|
136
|
-
"
|
160
|
+
def verification_publication_url pact, base_url, metadata = ""
|
161
|
+
metadata_part = metadata ? "/metadata/#{metadata}" : ""
|
162
|
+
"#{pactigration_base_url(base_url, pact)}/pact-version/#{pact.pact_version_sha}#{metadata_part}/verification-results"
|
137
163
|
end
|
138
164
|
|
139
165
|
def tag_url base_url, tag
|
@@ -200,8 +226,16 @@ module PactBroker
|
|
200
226
|
"#{latest_pact_url(base_url, pact)}/badge.svg"
|
201
227
|
end
|
202
228
|
|
229
|
+
def matrix_url consumer_name, provider_name, base_url = ''
|
230
|
+
"/matrix/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
|
231
|
+
end
|
232
|
+
|
203
233
|
def matrix_url_from_params params, base_url = ''
|
204
|
-
|
234
|
+
matrix_url(params.fetch(:consumer_name), params.fetch(:provider_name), base_url)
|
235
|
+
end
|
236
|
+
|
237
|
+
def group_url(pacticipant_name, base_url = '')
|
238
|
+
"#{base_url}/groups/#{pacticipant_name}"
|
205
239
|
end
|
206
240
|
|
207
241
|
def hal_browser_url target_url
|
@@ -1,12 +1,16 @@
|
|
1
1
|
require 'pact_broker/api/resources/base_resource'
|
2
2
|
require 'pact_broker/api/renderers/integrations_dot_renderer'
|
3
|
+
require 'pact_broker/api/decorators/integrations_decorator'
|
3
4
|
|
4
5
|
module PactBroker
|
5
6
|
module Api
|
6
7
|
module Resources
|
7
8
|
class Integrations < BaseResource
|
8
9
|
def content_types_provided
|
9
|
-
[
|
10
|
+
[
|
11
|
+
["text/vnd.graphviz", :to_dot],
|
12
|
+
["application/hal+json", :to_json]
|
13
|
+
]
|
10
14
|
end
|
11
15
|
|
12
16
|
def allowed_methods
|
@@ -17,8 +21,12 @@ module PactBroker
|
|
17
21
|
PactBroker::Api::Renderers::IntegrationsDotRenderer.call(integrations)
|
18
22
|
end
|
19
23
|
|
24
|
+
def to_json
|
25
|
+
PactBroker::Api::Decorators::IntegrationsDecorator.new(integrations).to_json(user_options: decorator_context)
|
26
|
+
end
|
27
|
+
|
20
28
|
def integrations
|
21
|
-
|
29
|
+
integration_service.find_all
|
22
30
|
end
|
23
31
|
|
24
32
|
def delete_resource
|