Module: Mountapi
- Defined in:
- lib/mountapi/railtie.rb,
lib/mountapi.rb,
lib/mountapi/route.rb,
lib/mountapi/config.rb,
lib/mountapi/router.rb,
lib/mountapi/schema.rb,
lib/mountapi/request.rb,
lib/mountapi/version.rb,
lib/mountapi/open_api.rb,
lib/mountapi/rack_app.rb,
lib/mountapi/response.rb,
lib/mountapi/route/path.rb,
lib/mountapi/response/ok.rb,
lib/mountapi/schema/base.rb,
lib/mountapi/doc_rack_app.rb,
lib/mountapi/route/method.rb,
lib/mountapi/schema/array.rb,
lib/mountapi/open_api/path.rb,
lib/mountapi/response/base.rb,
lib/mountapi/route/handler.rb,
lib/mountapi/schema/number.rb,
lib/mountapi/schema/object.rb,
lib/mountapi/schema/string.rb,
lib/mountapi/route/response.rb,
lib/mountapi/schema/boolean.rb,
lib/mountapi/schema/integer.rb,
lib/mountapi/error/forbidden.rb,
lib/mountapi/route/parameter.rb,
lib/mountapi/route/responses.rb,
lib/mountapi/handler/registry.rb,
lib/mountapi/route/parameters.rb,
lib/mountapi/schema/validator.rb,
lib/mountapi/handler/behaviour.rb,
lib/mountapi/open_api/document.rb,
lib/mountapi/open_api/operation.rb,
lib/mountapi/request/parameters.rb,
lib/mountapi/response/forbidden.rb,
lib/mountapi/response/not_found.rb,
lib/mountapi/request/param_parser.rb,
lib/mountapi/response/bad_request.rb,
lib/mountapi/error/handler_missing.rb,
lib/mountapi/error/route_not_found.rb,
lib/mountapi/error/invalid_response.rb,
lib/mountapi/error/invalid_parameter.rb,
lib/mountapi/response/internal_error.rb,
lib/mountapi/error/missing_response_status.rb
Overview
lib/railtie.rb
Defined Under Namespace
Modules: Adapters, Error, Handler, OpenApi, Request, Response, Route, Schema Classes: Config, DocRackApp, RackApp, Railtie, Router
Constant Summary collapse
- VERSION =
"0.11.1".freeze
Class Attribute Summary collapse
-
.config ⇒ Mountapi::Config
Mountapi config.
Class Method Summary collapse
- .call(*args) ⇒ Mountapi::Response
- .configure {|Mountapi::Config| ... } ⇒ Object
- .handlers ⇒ Object
- .logger ⇒ Object
-
.reset ⇒ Object
Reset config and router May be usefull for test purposes.
-
.router ⇒ Mountapi::Router
The router instance.
- .url_for(*args) ⇒ Object
Class Attribute Details
.config ⇒ Mountapi::Config
Returns mountapi config.
21 22 23 |
# File 'lib/mountapi.rb', line 21 def self.config @config ||= Config.new end |
Class Method Details
.call(*args) ⇒ Mountapi::Response
62 63 64 |
# File 'lib/mountapi.rb', line 62 def self.call(*args) Mountapi::Request.call(*args) end |
.configure {|Mountapi::Config| ... } ⇒ Object
26 27 28 |
# File 'lib/mountapi.rb', line 26 def self.configure yield(config) end |
.handlers ⇒ Object
41 42 43 |
# File 'lib/mountapi.rb', line 41 def self.handlers @handlers ||= Handler::Registry.new end |
.logger ⇒ Object
52 53 54 |
# File 'lib/mountapi.rb', line 52 def self.logger config.logger end |
.reset ⇒ Object
Reset config and router May be usefull for test purposes
47 48 49 50 |
# File 'lib/mountapi.rb', line 47 def self.reset @router = nil @config = nil end |
.router ⇒ Mountapi::Router
Returns the router instance.
31 32 33 34 35 36 37 38 39 |
# File 'lib/mountapi.rb', line 31 def self.router @router ||= Router.new.tap do |router| config.open_api_spec.each do |document| OpenApi.document(document).routes.each do |route| router.add(route) end end end end |
.url_for(*args) ⇒ Object
56 57 58 |
# File 'lib/mountapi.rb', line 56 def self.url_for(*args) router.url_for(*args) end |