Sha256: 58d3d4b9f39c778f921cbe879f08dc3258826e87794f77fec72998649a0875bf

Contents?: true

Size: 743 Bytes

Versions: 109

Compression:

Stored size: 743 Bytes

Contents

module PactBroker
  module Webhooks
    class Status

      def initialize pact, webhooks, latest_triggered_webhooks
        @webhooks = webhooks
        @latest_triggered_webhooks = latest_triggered_webhooks
      end

      def to_s
        to_sym.to_s
      end

      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

      private

      attr_reader :webhooks, :latest_triggered_webhooks

    end
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
pact_broker-2.36.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.36.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.35.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.34.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.33.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.32.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.31.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.30.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.29.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.6 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.5 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.4 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.3 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.2 lib/pact_broker/webhooks/status.rb
pact_broker-2.27.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.26.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.26.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.25.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.24.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.23.4 lib/pact_broker/webhooks/status.rb