Sha256: 9cfc08496f64fcff506ac89d1a50fb4d5a1a1f0b6440389761249b2b51fd98fa
Contents?: true
Size: 1007 Bytes
Versions: 1
Compression:
Stored size: 1007 Bytes
Contents
require "mountapi/request/parameters" require "mountapi/request/param_parser" module Mountapi # Request processing module Request def self.call(args) Request.new(**args).call end # Request can be called to be processed class Request attr_reader :path, :http_method, :params, :options def initialize(path:, http_method:, params:, options: {}) @path = path @http_method = http_method @params = Parameters.new(**params) @options = options end def call response.validate(route.responses) && response end private def path_params route.path.get_params(path) end def handler_params ParamParser.call(params.to_h.merge(path: path_params), route.parameters) end def response @response ||= route.handler.call(handler_params, options) end def route @route ||= Mountapi.router.find_route(path, http_method) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | lib/mountapi/request.rb |