module Apicraft::Web::Router
def self.add(path, view_path)
def self.add(path, view_path) routes[path] = { action: :contract, view_path: view_path } end
def self.contract_urls
def self.contract_urls contract_keys = routes.select do |_k, v| v[:action] == :contract end.keys contract_keys.map do |k| "#{Router.namespace}#{k}" end end
def self.load_response!(_method, path)
def self.load_response!(_method, path) Actions.send( routes[path][:action], routes[path][:view_path] ) end
def self.namespace
def self.namespace @namespace end
def self.namespace=(namespace)
def self.namespace=(namespace) @namespace = namespace end
def self.routes
def self.routes @routes ||= { "/": { action: :render_erb, view_path: "#{WEB_ROOT}/views/index.erb" }, "/swaggerdoc": { action: :render_erb, view_path: "#{WEB_ROOT}/views/swaggerdoc.erb" }, "/redoc": { action: :render_erb, view_path: "#{WEB_ROOT}/views/redoc.erb" }, "/rapidoc": { action: :render_erb, view_path: "#{WEB_ROOT}/views/rapidoc.erb" }, "/assets/images/thumb.png": { action: :images, view_path: "#{IMAGES_DIR}/apicraft_thumb.png" }, "/assets/images/logo.png": { action: :images, view_path: "#{IMAGES_DIR}/apicraft.png" } }.with_indifferent_access end