Class: PactBroker::Webhooks::Status
- Inherits:
-
Object
- Object
- PactBroker::Webhooks::Status
- Defined in:
- lib/pact_broker/webhooks/status.rb
Instance Method Summary collapse
-
#initialize(_pact, webhooks, latest_triggered_webhooks) ⇒ Status
constructor
A new instance of Status.
- #to_s ⇒ Object
-
#to_sym ⇒ Object
rubocop: disable Metrics/CyclomaticComplexity.
Constructor Details
#initialize(_pact, webhooks, latest_triggered_webhooks) ⇒ Status
Returns a new instance of Status.
5 6 7 8 |
# File 'lib/pact_broker/webhooks/status.rb', line 5 def initialize _pact, webhooks, latest_triggered_webhooks @webhooks = webhooks @latest_triggered_webhooks = latest_triggered_webhooks end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/pact_broker/webhooks/status.rb', line 10 def to_s to_sym.to_s end |
#to_sym ⇒ Object
rubocop: disable Metrics/CyclomaticComplexity
15 16 17 18 19 20 21 22 |
# File 'lib/pact_broker/webhooks/status.rb', line 15 def to_sym return :none if webhooks.empty? return :not_run if latest_triggered_webhooks.empty? || latest_triggered_webhooks.all?{|w| w.status == "not_run"} if latest_triggered_webhooks.any?{|w| w.status == "retrying" } return :retrying end latest_triggered_webhooks.all?{|w| w.status == "success"} ? :success : :failure end |