Sha256: 24c482ea3d94ccda76720626f7a9776ab9b6aa033abe952a9764e689517e0515

Contents?: true

Size: 761 Bytes

Versions: 9

Compression:

Stored size: 761 Bytes

Contents

require 'pact/shared/active_support_support'
require 'pact/consumer_contract/interaction_decorator'

module Pact
  class ConsumerContractDecorator

    include ActiveSupportSupport

    def initialize consumer_contract
      @consumer_contract = consumer_contract
    end

    def as_json(options = {})
      fix_all_the_things(
        consumer: consumer_contract.consumer.as_json,
        provider: consumer_contract.provider.as_json,
        interactions: consumer_contract.interactions.collect{ |i| InteractionDecorator.new(i).as_json},
        metadata: {
          pactSpecificationVersion: "1.0.0"
        }
      )
    end

    def to_json(options = {})
      as_json.to_json(options)
    end

    private

    attr_reader :consumer_contract

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact-mock_service-0.3.0 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.4 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.3 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.3.pre.rc2 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.3.pre.rc1 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.2 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.1 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.2.0 lib/pact/consumer_contract/consumer_contract_decorator.rb
pact-mock_service-0.1.0 lib/pact/consumer_contract/consumer_contract_decorator.rb