pact_broker-client 1.28.4 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 460518f5eadcc793db6674bd2d080743a01aefe7b3c7956e6b7cd39d703c07cd
4
- data.tar.gz: 04aba16e6627945f082461844b0a26d4c758b24bf27ceb75ebbb7b7db97a56e6
3
+ metadata.gz: 3a07f8cd0761d2826dd2b2c28b47bee6b3d792480fe97f49724280f451ea47bf
4
+ data.tar.gz: 3dd78bb84b1f392211d4762e89da7040ef56e13a990dc87c1866e7658778a8e6
5
5
  SHA512:
6
- metadata.gz: 946cd6045077c72decc890ec527f3b327ee835f3fe7898db0b9ae03d0959329e6409744ce718f7868389daee733d57605560b0dc6cf55886c37847c4674c8a6f
7
- data.tar.gz: 1dca9a3b97c207dce94e4a1e6a69739623e1897222fbf4e696e883d720ad6b36e8508431d69e011d597357f61e2c349352814d63af7b7891066cadc02d0d600b
6
+ metadata.gz: ea00e0e31727d6f826661ad2316762b94f4f8097f9829f44e2e85f6f7c62d0da5e9002101141dbbd6b5af009768c246ce4375053e2dfe9fce86f605a33e8ccbf
7
+ data.tar.gz: e6fe10b4acc7cf24f24fca2ccc8a3ee4709d1d421c466abba59a20c72c7672498f4bc893ccc2c229d70d5fdb0586d52edcfcdb8be651f4337fd7d1d10434eeaa
@@ -1,3 +1,11 @@
1
+ <a name="v1.29.0"></a>
2
+ ### v1.29.0 (2020-08-05)
3
+
4
+ #### Features
5
+
6
+ * print out helpful error message for 403 ([5d5a18a](/../../commit/5d5a18a))
7
+ * support publishing pacts for multiple consumers at the same time ([573e97c](/../../commit/573e97c))
8
+
1
9
  <a name="v1.28.4"></a>
2
10
  ### v1.28.4 (2020-07-31)
3
11
 
@@ -69,6 +69,12 @@ module PactBroker
69
69
  yield response
70
70
  elsif response.code == 404
71
71
  nil
72
+ elsif response.code == 403
73
+ message = "Authorization failed (insufficient permissions)"
74
+ if response.body && response.body.size > 0
75
+ message = message + ": #{response.body}"
76
+ end
77
+ raise Error.new(message)
72
78
  elsif response.code == 401
73
79
  message = "Authentication failed"
74
80
  if response.body && response.body.size > 0
@@ -52,6 +52,10 @@ module PactBroker
52
52
  @pact_files ||= pact_file_paths.collect{ |pact_file_path| PactFile.new(pact_file_path) }
53
53
  end
54
54
 
55
+ def consumer_names
56
+ pact_files.collect(&:consumer_name).uniq
57
+ end
58
+
55
59
  def publish_pact pact
56
60
  begin
57
61
  $stdout.puts "Publishing #{pact.pact_name} to pact broker at #{pact_broker_base_url}"
@@ -72,12 +76,14 @@ module PactBroker
72
76
  def tag_consumer_version tag
73
77
  versions = pact_broker_client.pacticipants.versions
74
78
  Retry.while_error do
75
- $stdout.puts "Tagging version #{consumer_version} of #{consumer_name} as #{tag.inspect}"
76
- versions.tag(pacticipant: consumer_name, version: consumer_version, tag: tag)
77
- true
79
+ consumer_names.collect do | consumer_name |
80
+ $stdout.puts "Tagging version #{consumer_version} of #{consumer_name} as #{tag.inspect}"
81
+ versions.tag(pacticipant: consumer_name, version: consumer_version, tag: tag)
82
+ true
83
+ end
78
84
  end
79
85
  rescue => e
80
- $stderr.puts "Failed to tag version #{consumer_version} of #{consumer_name} due to error: #{e.class} - #{e}}"
86
+ $stderr.puts "Failed to tag versions due to error: #{e.class} - #{e}"
81
87
  false
82
88
  end
83
89
 
@@ -94,10 +100,6 @@ module PactBroker
94
100
  end
95
101
  end
96
102
 
97
- def consumer_name
98
- pact_files.first.consumer_name
99
- end
100
-
101
103
  def validate
102
104
  raise PactBroker::Client::Error.new("Please specify the consumer_version") unless (consumer_version && consumer_version.to_s.strip.size > 0)
103
105
  raise PactBroker::Client::Error.new("Please specify the pact_broker_base_url") unless (pact_broker_base_url && pact_broker_base_url.to_s.strip.size > 0)
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.28.4'
3
+ VERSION = '1.29.0'
4
4
  end
5
5
  end
@@ -81,6 +81,25 @@ module PactBroker
81
81
  end
82
82
  end
83
83
 
84
+ context "when publishing multiple files with different consumers" do
85
+ let(:pact_file_paths) { ['spec/pacts/consumer-provider.json','spec/pacts/foo-bar.json']}
86
+ let(:tags) { ['dev'] }
87
+
88
+ it "tags each consumer" do
89
+ expect(pact_versions_client).to receive(:tag).with(
90
+ pacticipant: "Consumer",
91
+ version: consumer_version,
92
+ tag: "dev"
93
+ )
94
+ expect(pact_versions_client).to receive(:tag).with(
95
+ pacticipant: "Foo",
96
+ version: consumer_version,
97
+ tag: "dev"
98
+ )
99
+ subject.call
100
+ end
101
+ end
102
+
84
103
  context "when publishing one or more pacts fails" do
85
104
  let(:pact_file_paths) { ['spec/pacts/consumer-provider.json','spec/pacts/foo-bar.json']}
86
105
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.4
4
+ version: 1.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-31 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty