pact 1.36.2 → 1.37.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 +15 -0
- data/lib/pact/hal/entity.rb +10 -0
- data/lib/pact/hal/link.rb +3 -5
- data/lib/pact/pact_broker/fetch_pacts.rb +3 -3
- data/lib/pact/pact_broker/fetch_pending_pacts.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: baaed0d9726daedaae9ffc9bfd27d8df34c2511d
|
4
|
+
data.tar.gz: 2af96d9cff46c3afba7d9cfc15d65af6d56ebd0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19a5b152314f0af37d2aa3cf52c6d41c6cef75289eedb05deef0daffdcee4a3b6f2dbcf7e9270c9cac630f236937a6ff5cf75f87ccfeadd991494325a76f4784
|
7
|
+
data.tar.gz: b2a78e5985c137f49c1fa673911125934463edc0b9442dfea58d1fe2cbc408e8618e3ffa77e7b6e09818e611a4862815fbc9baf39b9d89a5cc3c995a075347d4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
<a name="v1.37.0"></a>
|
2
|
+
### v1.37.0 (2018-11-15)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* **hal client**
|
8
|
+
* ensure meaningful error is displayed when HTTP errors are returned ([9244c14](/../../commit/9244c14))
|
9
|
+
|
10
|
+
|
11
|
+
#### Bug Fixes
|
12
|
+
|
13
|
+
* correct url encoding for expanded HAL links ([4abfe7d](/../../commit/4abfe7d))
|
14
|
+
|
15
|
+
|
1
16
|
<a name="v1.36.2"></a>
|
2
17
|
### v1.36.2 (2018-10-22)
|
3
18
|
|
data/lib/pact/hal/entity.rb
CHANGED
@@ -7,6 +7,8 @@ module Pact
|
|
7
7
|
module Hal
|
8
8
|
class RelationNotFoundError < ::Pact::Error; end
|
9
9
|
|
10
|
+
class ErrorResponseReturned < ::Pact::Error; end
|
11
|
+
|
10
12
|
class Entity
|
11
13
|
|
12
14
|
def initialize(href, data, http_client, response = nil)
|
@@ -76,6 +78,10 @@ module Pact
|
|
76
78
|
def respond_to_missing?(method_name, include_private = false)
|
77
79
|
@data.key?(method_name) || @links.key?(method_name)
|
78
80
|
end
|
81
|
+
|
82
|
+
def assert_success!
|
83
|
+
self
|
84
|
+
end
|
79
85
|
end
|
80
86
|
|
81
87
|
class ErrorEntity < Entity
|
@@ -91,6 +97,10 @@ module Pact
|
|
91
97
|
def success?
|
92
98
|
false
|
93
99
|
end
|
100
|
+
|
101
|
+
def assert_success!
|
102
|
+
raise ErrorResponseReturned.new("Error retrieving #{@href} status=#{response ? response.code: nil} #{response ? response.raw_body : ''}")
|
103
|
+
end
|
94
104
|
end
|
95
105
|
end
|
96
106
|
end
|
data/lib/pact/hal/link.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'erb'
|
2
2
|
require 'delegate'
|
3
3
|
|
4
4
|
module Pact
|
@@ -54,11 +54,9 @@ module Pact
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def expand_url(params, url)
|
57
|
-
|
58
|
-
|
59
|
-
new_url = new_url.gsub('{' + key.to_s + '}', URI.escape(value))
|
57
|
+
params.inject(url) do | url, (key, value) |
|
58
|
+
url.gsub('{' + key.to_s + '}', ERB::Util.url_encode(value))
|
60
59
|
end
|
61
|
-
new_url
|
62
60
|
end
|
63
61
|
end
|
64
62
|
end
|
@@ -72,16 +72,16 @@ module Pact
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def index
|
75
|
-
@index_entity ||= Pact::Hal::Link.new({ "href" => broker_base_url }, http_client).get
|
75
|
+
@index_entity ||= Pact::Hal::Link.new({ "href" => broker_base_url }, http_client).get.assert_success!
|
76
76
|
end
|
77
77
|
|
78
78
|
def latest_pacts_for_provider
|
79
79
|
link = index_entity._link!(LATEST_PROVIDER_RELATION)
|
80
|
-
pact_urls(link.expand(provider: provider).get)
|
80
|
+
pact_urls(link.expand(provider: provider).get.assert_success!)
|
81
81
|
end
|
82
82
|
|
83
83
|
def pact_urls(link_by_provider)
|
84
|
-
link_by_provider.fetch(PB_PACTS, PACTS).collect do |pact|
|
84
|
+
link_by_provider.assert_success!.fetch(PB_PACTS, PACTS).collect do |pact|
|
85
85
|
Pact::Provider::PactURI.new(pact[HREF], http_client_options)
|
86
86
|
end
|
87
87
|
end
|
@@ -36,7 +36,7 @@ module Pact
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def index
|
39
|
-
@index_entity ||= Pact::Hal::Link.new({ "href" => broker_base_url }, http_client).get
|
39
|
+
@index_entity ||= Pact::Hal::Link.new({ "href" => broker_base_url }, http_client).get.assert_success!
|
40
40
|
end
|
41
41
|
|
42
42
|
def pending_pacts_for_provider
|
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.37.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-
|
15
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|