Class: Pact::MockService::RequestHandlers::SessionDelete

Inherits:
BaseAdministrationRequestHandler show all
Defined in:
lib/pact/mock_service/request_handlers/session_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

Attributes inherited from BaseAdministrationRequestHandler

#logger, #name

Instance Method Summary collapse

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) ⇒ SessionDelete

Returns a new instance of SessionDelete.



11
12
13
14
# File 'lib/pact/mock_service/request_handlers/session_delete.rb', line 11

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

Instance Attribute Details

#sessionObject

Returns the value of attribute session.



9
10
11
# File 'lib/pact/mock_service/request_handlers/session_delete.rb', line 9

def session
  @session
end

Instance Method Details

#request_methodObject



20
21
22
# File 'lib/pact/mock_service/request_handlers/session_delete.rb', line 20

def request_method
  'DELETE'
end

#request_pathObject



16
17
18
# File 'lib/pact/mock_service/request_handlers/session_delete.rb', line 16

def request_path
  '/session'
end

#respond(env) ⇒ Object



24
25
26
27
28
# File 'lib/pact/mock_service/request_handlers/session_delete.rb', line 24

def respond env
  session.clear_all
  logger.info "Cleared session"
  text_response 'Cleared session'
end