Module: Angus::BaseActions
- Included in:
- Base
- Defined in:
- lib/angus/base_actions.rb
Instance Method Summary collapse
Instance Method Details
#api_path ⇒ Object
33 34 35 |
# File 'lib/angus/base_actions.rb', line 33 def api_path "#{base_path}/api/#{service_version}" end |
#discover_paths ⇒ Object
4 5 6 7 8 9 |
# File 'lib/angus/base_actions.rb', line 4 def discover_paths { 'doc' => doc_path, 'api' => api_path } end |
#doc_path ⇒ Object
29 30 31 |
# File 'lib/angus/base_actions.rb', line 29 def doc_path "#{base_path}/doc/#{service_version}" end |
#register_base_routes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/angus/base_actions.rb', line 11 def register_base_routes router.on(:get, '/') do render discover_paths end router.on(:get, base_path) do render discover_paths end router.on(:get, doc_path) do |env, params| if params[:format] == 'json' render(Angus::SDoc::JsonFormatter.format_service(@definitions), format: :json) else render(Angus::SDoc::HtmlFormatter.format_service(@definitions), format: :html) end end end |