Sha256: 10ba177eb676a9f83a30f715c947fe2da62cb35c8a5c6a7219ea8cc2eb5c8525

Contents?: true

Size: 1.08 KB

Versions: 16

Compression:

Stored size: 1.08 KB

Contents

require 'pact/mock_service/request_handlers/base_administration_request_handler'
require 'pact/mock_service/interaction_decorator'
require 'pact/shared/json_differ'
require 'pact/mock_service/request_handlers/interaction_post' #Refactor diff message

module Pact
  module MockService
    module RequestHandlers
      class InteractionsPut < BaseAdministrationRequestHandler

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

        def request_path
          '/interactions'
        end

        def request_method
          'PUT'
        end

        def respond env
          request_body = JSON.load(env['rack.input'].string)
          interactions = request_body['interactions'].collect { | hash | Interaction.from_hash(hash) }
          begin
            session.set_expected_interactions interactions
            [200, {}, ['Set interactions']]
          rescue AlmostDuplicateInteractionError => e
            [500, {}, e.message]
          end
        end

        private

        attr_accessor :session

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pact-mock_service-0.8.1 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.8.0 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.7.2 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.7.1 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.7.0 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.6.0 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.5 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.4 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.3 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.2 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.1 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.5.0 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.4.2 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.4.1 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.4.0 lib/pact/mock_service/request_handlers/interactions_put.rb
pact-mock_service-0.3.0 lib/pact/mock_service/request_handlers/interactions_put.rb