Class: Fakeit::App::Routes::OpenapiRoute
- Inherits:
-
Object
- Object
- Fakeit::App::Routes::OpenapiRoute
- Defined in:
- lib/fakeit/app/routes/openapi_route.rb
Instance Method Summary collapse
- #call(request, options) ⇒ Object
-
#initialize(spec_file) ⇒ OpenapiRoute
constructor
A new instance of OpenapiRoute.
Constructor Details
#initialize(spec_file) ⇒ OpenapiRoute
5 6 7 |
# File 'lib/fakeit/app/routes/openapi_route.rb', line 5 def initialize(spec_file) @specification = Fakeit::Openapi::Specification.new(spec_file) end |
Instance Method Details
#call(request, options) ⇒ Object
9 10 11 12 13 |
# File 'lib/fakeit/app/routes/openapi_route.rb', line 9 def call(request, ) @specification .operation(request.request_method.downcase.to_sym, request.path_info, ) .then { _1 ? handle(_1, request, ) : Fakeit::App::Helpers::ResponseBuilder.not_found } end |