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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e598b19223be35dd3c6f476b889e8eabe6e69e6
4
- data.tar.gz: 03bede44787e3804e70de0d31b46748331a6567f
3
+ metadata.gz: baaed0d9726daedaae9ffc9bfd27d8df34c2511d
4
+ data.tar.gz: 2af96d9cff46c3afba7d9cfc15d65af6d56ebd0b
5
5
  SHA512:
6
- metadata.gz: 6b6f487d9d12536fbd90fea3c0051cd7923b7f525fa7da37fb1b8c45936227d95ce74b51a2eb87359c2baae5f8215dd0ebbcad7be8199413a63839e58e5807dd
7
- data.tar.gz: 9774362b1afff2002d2bda5949ed0f1e439b590d205a0742bdeaa6ea37bc357a18b906ccfedf16cdd7c51618fc7900693d8075c4e9238616b41a74438c12f8c0
6
+ metadata.gz: 19a5b152314f0af37d2aa3cf52c6d41c6cef75289eedb05deef0daffdcee4a3b6f2dbcf7e9270c9cac630f236937a6ff5cf75f87ccfeadd991494325a76f4784
7
+ data.tar.gz: b2a78e5985c137f49c1fa673911125934463edc0b9442dfea58d1fe2cbc408e8618e3ffa77e7b6e09818e611a4862815fbc9baf39b9d89a5cc3c995a075347d4
@@ -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
 
@@ -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
@@ -1,4 +1,4 @@
1
- require 'uri'
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
- new_url = url
58
- params.each do | key, value |
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
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.36.2"
3
+ VERSION = "1.37.0"
4
4
  end
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.36.2
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-10-29 00:00:00.000000000 Z
15
+ date: 2018-11-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp