Class: Pact::MockService::RequestHandlers::LogGet

Inherits:
BaseAdministrationRequestHandler show all
Defined in:
lib/pact/mock_service/request_handlers/log_get.rb

Constant Summary

Constants inherited from BaseRequestHandler

BaseRequestHandler::NOT_FOUND_RESPONSE

Constants included from Consumer::RackRequestHelper

Consumer::RackRequestHelper::REQUEST_KEYS

Instance Attribute Summary

Attributes inherited from BaseAdministrationRequestHandler

#logger, #name

Instance Method Summary collapse

Methods inherited from BaseAdministrationRequestHandler

#has_mock_service_header?, #initialize, #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

This class inherits a constructor from Pact::MockService::RequestHandlers::BaseAdministrationRequestHandler

Instance Method Details

#message(env) ⇒ Object



21
22
23
# File 'lib/pact/mock_service/request_handlers/log_get.rb', line 21

def message env
  params_hash(env).fetch('msg', [])[0]
end

#request_methodObject



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

def request_method
  'GET'
end

#request_pathObject



8
9
10
# File 'lib/pact/mock_service/request_handlers/log_get.rb', line 8

def request_path
  '/log'
end

#respond(env) ⇒ Object



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

def respond env
  logger.info "Debug message from client - #{message(env)}"
  text_response
end