Sha256: 02517e53c73ae636023a3f2bea4cdafe9cc61262c727890135f14bd3301eb90e

Contents?: true

Size: 806 Bytes

Versions: 11

Compression:

Stored size: 806 Bytes

Contents

require 'pact/consumer/mock_service/mock_service_administration_endpoint'

module Pact
  module Consumer
    class InteractionPost < MockServiceAdministrationEndpoint

      attr_accessor :interaction_list

      def initialize name, logger, interaction_list
        super name, logger
        @interaction_list = interaction_list
      end

      def request_path
        '/interactions'
      end

      def request_method
        'POST'
      end

      def respond env
        interaction = Interaction.from_hash(JSON.load(env['rack.input'].string))
        interaction_list.add interaction
        logger.info "Registered expected interaction #{interaction.request.method_and_path} for #{name}"
        logger.ap interaction.as_json
        [200, {}, ['Added interaction']]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact-1.0.39 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.1.0.rc2 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.38 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.1.0.rc1 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.37 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.36 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.35 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.34 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.33 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.32 lib/pact/consumer/mock_service/interaction_post.rb
pact-1.0.31 lib/pact/consumer/mock_service/interaction_post.rb