Sha256: 3e5b373578539f159f1be290c683de6ca96daf8e46eb629ba07bf5ef28306ce1
Contents?: true
Size: 772 Bytes
Versions: 1
Compression:
Stored size: 772 Bytes
Contents
require 'json-schema' module Fitting class Request def initialize(env_request, tomogram) @method = env_request.request_method @path = env_request.env['PATH_INFO'] || env_request.fullpath @body = env_request.env['action_dispatch.request.request_parameters'] @schema = tomogram.find_request(method: @method, path: @path) self end def route "#{@schema.method}\t#{@schema.path}" end def real_method_with_path "#{@method}\t#{@path}" end def schemas_of_possible_responses(status:) if @schema @schema.find_responses(status: status).map do |response| response['body'] end end end def within_prefix?(prefix) @path.start_with?(prefix) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fitting-2.0.3 | lib/fitting/request.rb |