Sha256: df61b7920121cbd5ac5dcdcb4a7147d4fd5e8c424cdfb7c1863f57fbd5688b45
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'sucker_punch' require 'faraday' require 'pact_broker/logging' # Publishes verification results, as if they were triggered by a CI job module PactBroker class VerificationJob include SuckerPunch::Job include PactBroker::Logging def perform data pact_url = data.fetch(:pactUrl) pact = Faraday.get(pact_url, nil, { 'Accept' => 'application/hal+json'}).body pact_hash = JSON.parse(pact) headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/hal+json' } provider_version = "1.2.#{(rand * 1000).to_i}" provider_url = pact_hash['_links']['pb:provider']['href'] Faraday.put("#{provider_url}/versions/#{provider_version}/tags/dev", nil, headers) verification_url = pact_hash['_links']['pb:publish-verification-results']['href'] body = { success: true, providerApplicationVersion: provider_version } Faraday.post(verification_url, body.to_json, headers) Faraday.put("#{provider_url}/versions/#{provider_version}/tags/prod", nil, headers) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pact_broker-2.47.1 | spec/support/verification_job.rb |
pact_broker-2.47.0 | spec/support/verification_job.rb |
pact_broker-2.46.0 | spec/support/verification_job.rb |