Class: PactBroker::Api::Decorators::MatrixDecorator
- Inherits:
-
Object
- Object
- PactBroker::Api::Decorators::MatrixDecorator
show all
- Includes:
- PactBrokerUrls
- Defined in:
- lib/pact_broker/api/decorators/matrix_decorator.rb
Instance Method Summary
collapse
#badge_url_for_latest_pact, #hal_browser_url, #label_url, #labels_url, #latest_pact_url, #latest_pacts_url, #latest_untagged_pact_url, #latest_verifications_for_consumer_version_url, #latest_version_url, #matrix_url_from_params, #new_verification_url, #pact_url, #pact_url_from_params, #pact_version_url, #pact_versions_url, #pacticipant_url, #pacticipant_url_from_params, #pacticipants_url, #previous_distinct_diff_url, #previous_distinct_pact_version_url, #tag_url, #tags_url, #triggered_webhook_logs_url, #url_encode, #verification_publication_url, #verification_url, #verification_url_from_params, #version_url, #version_url_from_params, #versions_url, #webhook_execution_url, #webhook_url, #webhooks_for_pact_url, #webhooks_status_url, #webhooks_url
Constructor Details
Returns a new instance of MatrixDecorator.
10
11
12
|
# File 'lib/pact_broker/api/decorators/matrix_decorator.rb', line 10
def initialize(lines)
@lines = lines
end
|
Instance Method Details
#deployable ⇒ Object
28
29
30
31
32
|
# File 'lib/pact_broker/api/decorators/matrix_decorator.rb', line 28
def deployable
return nil if lines.empty?
return nil if lines.any?{ |line| line.success.nil? }
lines.any? && lines.all?{ |line| line.success }
end
|
#reason ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/pact_broker/api/decorators/matrix_decorator.rb', line 34
def reason
return "No results matched the given query" if lines.empty?
case deployable
when true then "All verification results are published and successful"
when false then "One or more verifications have failed"
else
"Missing one or more verification results"
end
end
|
#to_hash(options) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/pact_broker/api/decorators/matrix_decorator.rb', line 18
def to_hash(options)
{
summary: {
deployable: deployable,
reason: reason
},
matrix: matrix(lines, options[:user_options][:base_url])
}
end
|
#to_json(options) ⇒ Object
14
15
16
|
# File 'lib/pact_broker/api/decorators/matrix_decorator.rb', line 14
def to_json(options)
to_hash(options).to_json
end
|