Class: HttpStub::Server::Stub::Match::Controller
- Inherits:
-
Object
- Object
- HttpStub::Server::Stub::Match::Controller
- Defined in:
- lib/http_stub/server/stub/match/controller.rb
Instance Method Summary collapse
- #find_last(request, logger) ⇒ Object
-
#initialize(result_registry) ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize(result_registry) ⇒ Controller
Returns a new instance of Controller.
8 9 10 |
# File 'lib/http_stub/server/stub/match/controller.rb', line 8 def initialize(result_registry) @result_registry = result_registry end |
Instance Method Details
#find_last(request, logger) ⇒ Object
12 13 14 15 |
# File 'lib/http_stub/server/stub/match/controller.rb', line 12 def find_last(request, logger) result = @result_registry.find(request.parameters.slice(:method, :uri), logger) result ? HttpStub::Server::Response.ok("body" => result.to_json) : HttpStub::Server::Response::NOT_FOUND end |