Sha256: b0d49a772faa1ec3a9c035162f4596d0b32edd81c14437479ef5546a5d9173ef

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

module PactBroker
  module Webhooks
    class Render
      def self.call(body, pact, verification = nil, &escaper)
        base_url = PactBroker.configuration.base_url
        params = {
          '${pactbroker.pactUrl}' => PactBroker::Api::PactBrokerUrls.pact_url(base_url, pact),
          '${pactbroker.consumerVersionNumber}' => pact.consumer_version_number
        }

        if escaper
          params.keys.each do | key |
            params[key] = escaper.call(params[key])
          end
        end

        params.inject(body) do | body, (key, value) |
          body.gsub(key, value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-2.20.0 lib/pact_broker/webhooks/render.rb