Class: PactBroker::Pacts::GenerateSha
- Inherits:
-
Object
- Object
- PactBroker::Pacts::GenerateSha
show all
- Includes:
- Logging
- Defined in:
- lib/pact_broker/pacts/generate_sha.rb
Class Method Summary
collapse
Methods included from Logging
included, #log_error, #log_with_tag, #measure_info
Class Method Details
.call(json_content, _options = {}) ⇒ Object
14
15
16
17
18
19
20
21
|
# 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
(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
|
23
24
25
26
27
|
# File 'lib/pact_broker/pacts/generate_sha.rb', line 23
def self.(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
|