Class: Pact::MockService::RequestHandlers::InteractionDelete
- Inherits:
-
BaseAdministrationRequestHandler
- Object
- BaseRequestHandler
- BaseAdministrationRequestHandler
- Pact::MockService::RequestHandlers::InteractionDelete
- Defined in:
- lib/pact/mock_service/request_handlers/interaction_delete.rb
Constant Summary
Constants inherited from BaseRequestHandler
BaseRequestHandler::NOT_FOUND_RESPONSE
Constants included from Consumer::RackRequestHelper
Consumer::RackRequestHelper::REQUEST_KEYS
Instance Attribute Summary collapse
-
#session ⇒ Object
Returns the value of attribute session.
Attributes inherited from BaseAdministrationRequestHandler
Instance Method Summary collapse
- #example_description(env) ⇒ Object
-
#initialize(name, logger, session) ⇒ InteractionDelete
constructor
A new instance of InteractionDelete.
- #request_method ⇒ Object
- #request_path ⇒ Object
- #respond(env) ⇒ Object
Methods inherited from BaseAdministrationRequestHandler
#has_mock_service_header?, #match?, #method_matches?, #path_matches?
Methods inherited from BaseRequestHandler
#call, #json_response, #match?, #text_response
Methods included from Consumer::RackRequestHelper
#params_hash, #request_as_hash_from
Constructor Details
#initialize(name, logger, session) ⇒ InteractionDelete
Returns a new instance of InteractionDelete.
11 12 13 14 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 11 def initialize name, logger, session super name, logger @session = session end |
Instance Attribute Details
#session ⇒ Object
Returns the value of attribute session.
9 10 11 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 9 def session @session end |
Instance Method Details
#example_description(env) ⇒ Object
32 33 34 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 32 def example_description env params_hash(env).fetch('example_description', [])[0] end |
#request_method ⇒ Object
20 21 22 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 20 def request_method 'DELETE' end |
#request_path ⇒ Object
16 17 18 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 16 def request_path '/interactions' end |
#respond(env) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/pact/mock_service/request_handlers/interaction_delete.rb', line 24 def respond env session.clear_expected_and_actual_interactions example_desc = example_description(env) example_desc = example_desc ? " for example #{example_desc.inspect}" : '' logger.info "Cleared interactions#{example_desc}" text_response('Cleared interactions') end |