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.52.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.52.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.51.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.50.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.50.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.49.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.48.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.47.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.47.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.46.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.45.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.44.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.43.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.42.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.41.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.40.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.39.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.38.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.38.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.37.0 lib/pact_broker/webhooks/status.rb