Sha256: 8a58e72f777743e11baa0b3e914d2f226ea6852ac9f44647a5ab48532d8c7025

Contents?: true

Size: 1011 Bytes

Versions: 36

Compression:

Stored size: 1011 Bytes

Contents

require "ostruct"
require "pact_broker/api/pact_broker_urls"
require "pact_broker/api/decorators/matrix_decorator"

require "table_print"

module PactBroker
  module Api
    module Decorators
      class MatrixTextDecorator
        Line = Struct.new(:consumer, :c_version, :revision, :provider, :p_version, :number, :success)

        def initialize(lines)
          @lines = lines
        end

        def to_text(_options)
          json_decorator = PactBroker::Api::Decorators::MatrixDecorator.new(lines)
          data = lines.collect do | line |
            Line.new(line.consumer_name, line.consumer_version_number, line.pact_revision_number, line.provider_name, line.provider_version_number, line.verification_number, line.success)
          end
          printer = TablePrint::Printer.new(data)
          printer.table_print + "\n\nDeployable: #{json_decorator.deployable.inspect}\nReason: #{json_decorator.reason}\n"
        end

        private

        attr_reader :lines
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
pact_broker-2.93.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.92.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.91.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.90.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.89.1 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.89.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.88.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.87.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.86.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.85.1 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.85.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.84.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.83.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.82.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.81.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb
pact_broker-2.80.0 lib/pact_broker/api/decorators/matrix_text_decorator.rb