Class: Pact::Consumer::InteractionDelete

Inherits:
MockServiceAdministrationEndpoint show all
Includes:
RackRequestHelper
Defined in:
lib/pact/consumer/mock_service/interaction_delete.rb

Constant Summary

Constants included from RackRequestHelper

RackRequestHelper::REQUEST_KEYS

Instance Attribute Summary collapse

Attributes inherited from MockServiceAdministrationEndpoint

#logger, #name

Instance Method Summary collapse

Methods included from RackRequestHelper

#params_hash, #request_as_hash_from

Methods inherited from MockServiceAdministrationEndpoint

#match?

Constructor Details

#initialize(name, logger, interaction_list) ⇒ InteractionDelete

Returns a new instance of InteractionDelete.



13
14
15
16
# File 'lib/pact/consumer/mock_service/interaction_delete.rb', line 13

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

Instance Attribute Details

#interaction_listObject

Returns the value of attribute interaction_list.



11
12
13
# File 'lib/pact/consumer/mock_service/interaction_delete.rb', line 11

def interaction_list
  @interaction_list
end

Instance Method Details

#request_methodObject



22
23
24
# File 'lib/pact/consumer/mock_service/interaction_delete.rb', line 22

def request_method
  'DELETE'
end

#request_pathObject



18
19
20
# File 'lib/pact/consumer/mock_service/interaction_delete.rb', line 18

def request_path
  '/interactions'
end

#respond(env) ⇒ Object



26
27
28
29
30
# File 'lib/pact/consumer/mock_service/interaction_delete.rb', line 26

def respond env
  interaction_list.clear
  logger.info "Cleared interactions before example \"#{params_hash(env)['example_description']}\""
  [200, {}, ['Deleted interactions']]
end