Sha256: 259ba1ba20055bc4fa4f1ec054d298193353f4ac03317e1b91de0a55dfc27f85
Contents?: true
Size: 960 Bytes
Versions: 11
Compression:
Stored size: 960 Bytes
Contents
require 'pact/consumer/mock_service/mock_service_administration_endpoint' require 'pact/consumer_contract/consumer_contract_writer' module Pact module Consumer class PactPost < MockServiceAdministrationEndpoint attr_accessor :consumer_contract, :interactions def initialize name, logger, interactions super name, logger @interactions = interactions end def request_path '/pact' end def request_method 'POST' end def respond env consumer_contract_details = JSON.parse(env['rack.input'].string, symbolize_names: true) logger.info "Writing pact with details #{consumer_contract_details}" consumer_contract_writer = ConsumerContractWriter.new(consumer_contract_details.merge(interactions: interactions), logger) json = consumer_contract_writer.write [200, {'Content-Type' =>'application/json'}, [json]] end end end end
Version data entries
11 entries across 11 versions & 2 rubygems