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.79.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.79.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.78.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.78.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.77.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.76.2 lib/pact_broker/webhooks/status.rb
pact_broker-2.76.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.76.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.75.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.74.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.74.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.73.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.72.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.71.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.70.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.69.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.68.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.68.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.67.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.66.0 lib/pact_broker/webhooks/status.rb