diff --git a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md index 0a12db60..1c96e386 100644 --- a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +++ b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md @@ -492,7 +492,7 @@ Pact Broker will respond with: "href": "http://example.org/pacticipants/Pricing%20Service", "title": "Pricing Service" }, - "pacts": [ + "pb:pacts": [ { "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0", "title": "Pact between Condor (v1.3.0) and Pricing Service", @@ -521,7 +521,7 @@ Pact Broker will respond with: "href": "http://example.org/pacticipants/Pricing%20Service", "title": "Pricing Service" }, - "pacts": [ + "pb:pacts": [ { "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0", "title": "Pact between Condor (v1.3.0) and Pricing Service", diff --git a/lib/pact_broker/client/pacts.rb b/lib/pact_broker/client/pacts.rb index 6663383d..9aa3236f 100644 --- a/lib/pact_broker/client/pacts.rb +++ b/lib/pact_broker/client/pacts.rb @@ -49,7 +49,7 @@ def list_latest_for_provider options url = get_latest_provider_contracts(options) response = self.class.get(url, headers: {}) handle_response(response) do - map_latest_provider_pacts_to_hash JSON.parse(response.body)["_links"]["pacts"] + map_latest_provider_pacts_to_hash(pact_links(response)) end end @@ -63,6 +63,12 @@ def latest options private + def pact_links response + body = JSON.parse(response.body) + # pacts relation is deprecated + body["_links"]["pb:pacts"] || body["_links"]["pacts"] + end + #TODO Move into mapper class def map_pact_list_to_hash pacts_list pacts_list.collect do | pact_hash | diff --git a/spec/pacts/pact_broker_client-pact_broker.json b/spec/pacts/pact_broker_client-pact_broker.json index b17bc0be..878beb87 100644 --- a/spec/pacts/pact_broker_client-pact_broker.json +++ b/spec/pacts/pact_broker_client-pact_broker.json @@ -861,7 +861,7 @@ "href": "http://example.org/pacticipants/Pricing%20Service", "title": "Pricing Service" }, - "pacts": [ + "pb:pacts": [ { "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0", "title": "Pact between Condor (v1.3.0) and Pricing Service", @@ -896,7 +896,7 @@ "href": "http://example.org/pacticipants/Pricing%20Service", "title": "Pricing Service" }, - "pacts": [ + "pb:pacts": [ { "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0", "title": "Pact between Condor (v1.3.0) and Pricing Service", diff --git a/spec/support/latest_pacts_for_provider.json b/spec/support/latest_pacts_for_provider.json index 1e4414f0..bc1ab320 100644 --- a/spec/support/latest_pacts_for_provider.json +++ b/spec/support/latest_pacts_for_provider.json @@ -4,7 +4,7 @@ "href": "http://example.org/pacticipants/Pricing%20Service", "title": "Pricing Service" }, - "pacts": [ + "pb:pacts": [ { "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0", "title": "Pact between Condor (v1.3.0) and Pricing Service",