Class: WashoutBuilder::WashoutBuilderController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/washout_builder/washout_builder_controller.rb

Overview

controller that is used to prit all available services or print the documentation for a specific service

Instance Method Summary collapse

Instance Method Details

#allvoid

This method returns an undefined value.

Will show all api services if no name parameter is receiverd If a name parameter is present will try to use that and find a controller that was that name by camelcasing the name . IF a name is provided will show the documentation page for that controller

See Also:

  • #all_services
  • Document::Generator#new


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/washout_builder/washout_builder_controller.rb', line 18

def all
  params[:name] = env_controller_path if env_controller_path.present?
  find_all_routes
  route_details = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
  if route_details.present? && defined?(controller_class(params[:name]))
    @document = WashoutBuilder::Document::Generator.new(route_details, controller_class(params[:name]).controller_path)
    @file_to_serve = 'wash_with_html/doc'
    render_html(@file_to_serve)
  else
    @services = all_services
    @file_to_serve = 'wash_with_html/all_services'
    render_html(@file_to_serve)
  end
end