pact 1.29.0 → 1.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/pact/hal/entity.rb +11 -2
- data/lib/pact/hal/link.rb +6 -6
- data/lib/pact/pact_broker/fetch_pacts.rb +3 -3
- data/lib/pact/provider/verification_results/publish.rb +1 -1
- data/lib/pact/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae5b619b17a3e5134fea66e3e089ce3c096af93d
|
4
|
+
data.tar.gz: d8b230915ee8eadb59febb4c5551862db5bed69c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4b09e2c225fbda956928c81adf1cb965c9b3bac351459fb0e7a4b4ebf22ec90dde93aa02c734f5084f83919d5dca04b2379db25c533c6db93693ec0d02ae76
|
7
|
+
data.tar.gz: e28af9fce398f9c0835bfb874320150b0ce9e2fb154c9e590b771f935b3ce3775be87a430ace03d7b6ae7b6c14c261447fc250a14246a881a600fca0b36c8028
|
data/CHANGELOG.md
CHANGED
data/lib/pact/hal/entity.rb
CHANGED
@@ -4,8 +4,12 @@ require 'pact/hal/link'
|
|
4
4
|
|
5
5
|
module Pact
|
6
6
|
module Hal
|
7
|
+
class RelationNotFoundError < ::Pact::Error; end
|
8
|
+
|
7
9
|
class Entity
|
8
|
-
|
10
|
+
|
11
|
+
def initialize(href, data, http_client, response = nil)
|
12
|
+
@href = href
|
9
13
|
@data = data
|
10
14
|
@links = (@data || {}).fetch("_links", {})
|
11
15
|
@client = http_client
|
@@ -40,6 +44,10 @@ module Pact
|
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
47
|
+
def _link!(key)
|
48
|
+
_link(key) or raise RelationNotFoundError.new("Could not find relation '#{key}' in resource at #{@href}")
|
49
|
+
end
|
50
|
+
|
43
51
|
def success?
|
44
52
|
true
|
45
53
|
end
|
@@ -69,7 +77,8 @@ module Pact
|
|
69
77
|
|
70
78
|
class ErrorEntity < Entity
|
71
79
|
|
72
|
-
def initialize(data, http_client, response = nil)
|
80
|
+
def initialize(href, data, http_client, response = nil)
|
81
|
+
@href = href
|
73
82
|
@data = data
|
74
83
|
@links = {}
|
75
84
|
@client = http_client
|
data/lib/pact/hal/link.rb
CHANGED
@@ -25,15 +25,15 @@ module Pact
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def get(payload = {}, headers = {})
|
28
|
-
wrap_response(@http_client.get(href, payload, headers))
|
28
|
+
wrap_response(href, @http_client.get(href, payload, headers))
|
29
29
|
end
|
30
30
|
|
31
31
|
def put(payload = nil, headers = {})
|
32
|
-
wrap_response(@http_client.put(href, payload ? JSON.dump(payload) : nil, headers))
|
32
|
+
wrap_response(href, @http_client.put(href, payload ? JSON.dump(payload) : nil, headers))
|
33
33
|
end
|
34
34
|
|
35
35
|
def post(payload = nil, headers = {})
|
36
|
-
wrap_response(@http_client.post(href, payload ? JSON.dump(payload) : nil, headers))
|
36
|
+
wrap_response(href, @http_client.post(href, payload ? JSON.dump(payload) : nil, headers))
|
37
37
|
end
|
38
38
|
|
39
39
|
def expand(params)
|
@@ -44,12 +44,12 @@ module Pact
|
|
44
44
|
|
45
45
|
private
|
46
46
|
|
47
|
-
def wrap_response(http_response)
|
47
|
+
def wrap_response(href, http_response)
|
48
48
|
require 'pact/hal/entity' # avoid circular reference
|
49
49
|
if http_response.success?
|
50
|
-
Entity.new(http_response.body, @http_client, http_response)
|
50
|
+
Entity.new(href, http_response.body, @http_client, http_response)
|
51
51
|
else
|
52
|
-
ErrorEntity.new(http_response.raw_body, @http_client, http_response)
|
52
|
+
ErrorEntity.new(href, http_response.raw_body, @http_client, http_response)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -64,9 +64,9 @@ module Pact
|
|
64
64
|
|
65
65
|
def link_for(tag)
|
66
66
|
if !tag[:all]
|
67
|
-
index_entity._link(LATEST_PROVIDER_TAG_RELATION)
|
67
|
+
index_entity._link!(LATEST_PROVIDER_TAG_RELATION)
|
68
68
|
else
|
69
|
-
index_entity._link(ALL_PROVIDER_TAG_RELATION)
|
69
|
+
index_entity._link!(ALL_PROVIDER_TAG_RELATION)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -75,7 +75,7 @@ module Pact
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def latest_pacts_for_provider
|
78
|
-
link = index_entity._link(LATEST_PROVIDER_RELATION)
|
78
|
+
link = index_entity._link!(LATEST_PROVIDER_RELATION)
|
79
79
|
pact_urls(link.expand(provider: provider).get)
|
80
80
|
end
|
81
81
|
|
@@ -32,7 +32,7 @@ module Pact
|
|
32
32
|
end
|
33
33
|
|
34
34
|
@http_client = Pact::Hal::HttpClient.new(http_client_options)
|
35
|
-
@pact_entity = Pact::Hal::Entity.new(pact_source.pact_hash, http_client)
|
35
|
+
@pact_entity = Pact::Hal::Entity.new(pact_source.uri, pact_source.pact_hash, http_client)
|
36
36
|
end
|
37
37
|
|
38
38
|
def call
|
data/lib/pact/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Fraser
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2018-07-
|
15
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|