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
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
14 15 16 17 18 19 20 21 |
# File 'lib/pact_broker/webhooks/status.rb', line 14 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 |