diff --git a/lib/pact_broker/api/resources/pact_versions.rb b/lib/pact_broker/api/resources/pact_versions.rb index 7db58f160..928b0dbb9 100644 --- a/lib/pact_broker/api/resources/pact_versions.rb +++ b/lib/pact_broker/api/resources/pact_versions.rb @@ -13,7 +13,7 @@ def content_types_provided end def allowed_methods - ["GET", "OPTIONS"] + ["GET", "DELETE", "OPTIONS"] end def resource_exists? @@ -29,6 +29,10 @@ def pacts pact_service.find_all_pact_versions_between consumer_name, :and => provider_name end + def delete_resource + pact_service.delete_all_pact_versions_between(consumer_name, and: provider_name) + true + end end end end diff --git a/lib/pact_broker/doc/views/consumer.markdown b/lib/pact_broker/doc/views/consumer.markdown index cff1b55e7..bd10e97aa 100644 --- a/lib/pact_broker/doc/views/consumer.markdown +++ b/lib/pact_broker/doc/views/consumer.markdown @@ -1,6 +1,6 @@ # Consumer -Allowed methods: GET, PATCH, DELETE +Allowed methods: `GET`, `PATCH`, `DELETE` The application that initiates the HTTP request. diff --git a/lib/pact_broker/doc/views/pact/all-pact-versions.markdown b/lib/pact_broker/doc/views/pact/all-pact-versions.markdown new file mode 100644 index 000000000..86fa8d723 --- /dev/null +++ b/lib/pact_broker/doc/views/pact/all-pact-versions.markdown @@ -0,0 +1,10 @@ +# All versions of a pact between a given consumer and provider + +Allowed methods: `GET`, `DELETE` +Path: `/pacts/provider/{provider}/consumer/{consumer}/versions` + +This resource returns a history of all the versions of the given pact between a consumer and provider. + +## Deleting pacts + +Sending a `DELETE` to this resource will delete all the pacts between the specified applications.