Class: Pact::MockService::RequestHandlers::BaseAdministrationRequestHandler
- Inherits:
-
BaseRequestHandler
- Object
- BaseRequestHandler
- Pact::MockService::RequestHandlers::BaseAdministrationRequestHandler
- Defined in:
- lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
Direct Known Subclasses
IndexGet, InteractionDelete, InteractionPost, InteractionsPut, LogGet, MissingInteractionsGet, PactPost, SessionDelete, VerificationGet
Constant Summary
Constants inherited from BaseRequestHandler
Pact::MockService::RequestHandlers::BaseRequestHandler::NOT_FOUND_RESPONSE
Constants included from Consumer::RackRequestHelper
Consumer::RackRequestHelper::REQUEST_KEYS
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #has_mock_service_header?(env) ⇒ Boolean
-
#initialize(name, logger) ⇒ BaseAdministrationRequestHandler
constructor
A new instance of BaseAdministrationRequestHandler.
- #match?(env) ⇒ Boolean
- #method_matches?(env) ⇒ Boolean
- #path_matches?(env) ⇒ Boolean
- #request_method ⇒ Object
- #request_path ⇒ Object
Methods inherited from BaseRequestHandler
#call, #json_response, #text_response
Methods included from Consumer::RackRequestHelper
#params_hash, #request_as_hash_from
Constructor Details
#initialize(name, logger) ⇒ BaseAdministrationRequestHandler
Returns a new instance of BaseAdministrationRequestHandler.
11 12 13 14 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 11 def initialize name, logger @name = name @logger = logger end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 9 def logger @logger end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 9 def name @name end |
Instance Method Details
#has_mock_service_header?(env) ⇒ Boolean
20 21 22 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 20 def has_mock_service_header? env env['HTTP_X_PACT_MOCK_SERVICE'] end |
#match?(env) ⇒ Boolean
16 17 18 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 16 def match? env has_mock_service_header?(env) && path_matches?(env) && method_matches?(env) end |
#method_matches?(env) ⇒ Boolean
28 29 30 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 28 def method_matches? env env['REQUEST_METHOD'] == request_method end |
#path_matches?(env) ⇒ Boolean
24 25 26 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 24 def path_matches? env env['PATH_INFO'].chomp("/") == request_path end |
#request_method ⇒ Object
36 37 38 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 36 def request_method raise NotImplementedError end |
#request_path ⇒ Object
32 33 34 |
# File 'lib/pact/mock_service/request_handlers/base_administration_request_handler.rb', line 32 def request_path raise NotImplementedError end |