module Angus::BaseActions
Public Instance Methods
api_path()
click to toggle source
# File lib/angus/base_actions.rb, line 41 def api_path "#{base_path}/api/#{service_version}" end
discover_paths()
click to toggle source
# File lib/angus/base_actions.rb, line 4 def discover_paths { 'doc' => doc_path, 'api' => api_path } end
doc_path()
click to toggle source
# File lib/angus/base_actions.rb, line 37 def doc_path "#{base_path}/doc/#{service_version}" end
register_base_routes()
click to toggle source
# File lib/angus/base_actions.rb, line 11 def register_base_routes router.on(:get, '/') do |env, params| response = Response.new render(response, discover_paths) end router.on(:get, base_path) do |env, params| response = Response.new render(response, discover_paths) end router.on(:get, doc_path) do |env, params| response = Response.new if params[:format] == 'json' render(response, Angus::SDoc::JsonFormatter.format_service(@definitions), format: :json) else language = params[:lang] || self.default_doc_language render(response, Angus::SDoc::HtmlFormatter.format_service(@definitions, language), format: :html) end end end