Class: OpenapiFirst::Router
- Inherits:
-
Object
- Object
- OpenapiFirst::Router
- Defined in:
- lib/openapi_first/router.rb
Constant Summary collapse
- RAW_PATH_PARAMS =
The unconverted path parameters before they are converted to the types defined in the API description
'openapi.raw_path_params'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options) ⇒ Router
constructor
A new instance of Router.
Constructor Details
#initialize(app, options) ⇒ Router
Returns a new instance of Router.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/openapi_first/router.rb', line 13 def initialize( app, ) @app = app @raise = .fetch(:raise_error, false) @not_found = .fetch(:not_found, :halt) spec = .fetch(:spec) raise "You have to pass spec: when initializing #{self.class}" unless spec spec = OpenapiFirst.load(spec) unless spec.is_a?(Definition) @filepath = spec.filepath @router = build_router(spec.operations) end |