class PactBroker::Api::Decorators::DashboardTextDecorator

Constants

Line

Attributes

index_items[R]

Public Class Methods

new(index_items) click to toggle source
# File lib/pact_broker/api/decorators/dashboard_text_decorator.rb, line 12
def initialize(index_items)
  @index_items = index_items
end

Public Instance Methods

to_json(options) click to toggle source
# File lib/pact_broker/api/decorators/dashboard_text_decorator.rb, line 16
def to_json(options)
  to_hash(options).to_json
end
to_text(options) click to toggle source
# File lib/pact_broker/api/decorators/dashboard_text_decorator.rb, line 20
def to_text(options)
  data = items(index_items, options[:user_options][:base_url])
  printer = TablePrint::Printer.new(data)
  printer.table_print + "\n"
end

Private Instance Methods

index_item_object(index_item) click to toggle source
# File lib/pact_broker/api/decorators/dashboard_text_decorator.rb, line 36
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
items(index_items, _base_url) click to toggle source
# File lib/pact_broker/api/decorators/dashboard_text_decorator.rb, line 30
def items(index_items, _base_url)
  index_items.collect do | index_item |
    index_item_object(index_item)
  end
end