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.65.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.64.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.63.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.62.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.61.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.60.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.60.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.59.2 lib/pact_broker/webhooks/status.rb
pact_broker-2.59.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.59.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.58.3 lib/pact_broker/webhooks/status.rb
pact_broker-2.58.2 lib/pact_broker/webhooks/status.rb
pact_broker-2.58.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.57.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.56.1 lib/pact_broker/webhooks/status.rb
pact_broker-2.56.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.55.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.54.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.53.0 lib/pact_broker/webhooks/status.rb
pact_broker-2.52.2 lib/pact_broker/webhooks/status.rb