Class: HttpStub::Server::Stub::Match::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/server/stub/match/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(result_registry) ⇒ 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