class PactBroker::Pacts::GenerateSha
Public Class Methods
call(json_content, _options = {})
click to toggle source
@param [String] json_content
# File lib/pact_broker/pacts/generate_sha.rb, line 14 def self.call(json_content, _options = {}) content_for_sha = if PactBroker.configuration.base_equality_only_on_content_that_affects_verification_results extract_verifiable_content_for_sha(json_content) else json_content end measure_info("Generating SHA1 hexdigest for pact", payload: { length: content_for_sha.length } ){ Digest::SHA1.hexdigest(content_for_sha) } end
extract_verifiable_content_for_sha(json_content)
click to toggle source
# File lib/pact_broker/pacts/generate_sha.rb, line 23 def self.extract_verifiable_content_for_sha(json_content) objects = Content.from_json(json_content) sorted_content = measure_info("Sorting content", payload: { length: json_content.length }){ objects.sort } sorted_content.content_that_affects_verification_results.to_json end