Sha256: d1396b0436030e0a0db85165c024a9aefed130a0bb0789ea1540ede8c7f2cd4e

Contents?: true

Size: 1.34 KB

Versions: 36

Compression:

Stored size: 1.34 KB

Contents

require "ostruct"
require "pact_broker/api/pact_broker_urls"

module PactBroker
  module Api
    module Decorators
      class DashboardTextDecorator
        include PactBroker::Api::PactBrokerUrls

        Line = Struct.new(:consumer_name, :c_version, :c_tags , :provider_name, :p_version, :p_tags, :success)

        def initialize(index_items)
          @index_items = index_items
        end

        def to_json(options)
          to_hash(options).to_json
        end

        def to_text(options)
          data = items(index_items, options[:user_options][:base_url])
          printer = TablePrint::Printer.new(data)
          printer.table_print + "\n"
        end

        private

        attr_reader :index_items

        def items(index_items, _base_url)
          index_items.collect do | index_item |
            index_item_object(index_item)
          end
        end

        def index_item_object(index_item)
          Line.new(
            index_item.consumer_name,
            index_item.consumer_version_number,
            index_item.tag_names.sort.join(", "),
            index_item.provider_name,
            index_item.provider_version_number,
            index_item.latest_verification_latest_tags.collect(&:name).sort.join(", "),
            index_item.pseudo_branch_verification_status.to_s
          )
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
pact_broker-2.106.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.105.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.104.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.103.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.102.2 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.102.1 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.102.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.101.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.100.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.99.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.98.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.97.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.96.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.95.1 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.95.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.94.0 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.93.4 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.93.3 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.93.2 lib/pact_broker/api/decorators/dashboard_text_decorator.rb
pact_broker-2.93.1 lib/pact_broker/api/decorators/dashboard_text_decorator.rb