Sha256: a60616e4ef2d72dd9e4de0eba22d448c870c8aeb28b8bcecf3cd24843c5d7a68

Contents?: true

Size: 1.02 KB

Versions: 45

Compression:

Stored size: 1.02 KB

Contents

require 'pact_broker/client/base_command'
require 'pact_broker/client/describe_text_formatter'

module PactBroker
  module Client
    module Pacticipants2
      class Describe < PactBroker::Client::BaseCommand

        private

        def do_call
          PactBroker::Client::CommandResult.new(true, result_message)
        end

        def pacticipant_entity
          @pacticipant_entity ||= index_resource._link('pb:pacticipant').expand('pacticipant' => params[:name]).get!
        end

        def result_message
          if json_output?
            pacticipant_entity.response.raw_body
          else
            properties = pacticipant_entity.response.body.except("_links", "_embedded")
            if pacticipant_entity._embedded && pacticipant_entity._embedded["labels"] && pacticipant_entity._embedded["labels"].any?
              properties["labels"] = pacticipant_entity._embedded["labels"]
            end
            PactBroker::Client::DescribeTextFormatter.call(properties)
          end
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
pact_broker-client-1.63.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.62.1 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.62.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.61.1 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.61.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.60.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.59.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.58.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.57.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.56.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.55.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.54.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.53.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.52.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.51.2 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.51.1 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.51.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.50.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.49.0 lib/pact_broker/client/pacticipants/describe.rb
pact_broker-client-1.48.0 lib/pact_broker/client/pacticipants/describe.rb