Module: Mutx::Paths

Defined in:
lib/mutx/lib/paths.rb

Constant Summary collapse

PATHS =
{

   api_results_show: '/api/results/:result_id',
   api_results_data: '/api/results/:result_id/data',
   api_results_reset: '/api/results/:result_id/reset',

   admin_index: '/admin',

   admin_configurations_index: '/admin/config',
   admin_tasks_index: '/admin/tasks',
   admin_tasks_new: '/admin/tasks/new',
   admin_tasks_show: '/admin/tasks/:task_id/view',
   admin_tasks_edit: '/admin/tasks/:task_id/edit',
   admin_tasks_delete: '/admin/tasks/:task_id/delete',
   admin_tasks_create: '/admin/tasks',
   admin_tasks_update: '/admin/tasks/:task_id',
   admin_tasks_destroy: '/admin/tasks/:task_id/delete',

   admin_custom_params_index: '/admin/custom-params',
   admin_custom_params_new: '/admin/custom-params/new',
   admin_custom_params_edit: '/admin/custom-params/:custom_param_id/edit',
   admin_custom_params_delete: '/admin/custom-params/:custom_param_id/delete',
   admin_custom_params_create: '/admin/custom-params',
   admin_custom_params_update: '/admin/custom-params/:custom_param_id',
   admin_custom_params_destroy: '/admin/custom-params/:custom_param_id/delete',
   
   admin_repositories_index: '/admin/repositories',
   admin_repositories_new: '/admin/repositories/new',
   admin_repositories_create: '/admin/repositories',
   admin_repositories_delete: '/admin/repositories/:repository_id/delete',
   admin_repositories_edit: '/admin/repositories/:repository_id/edit',
   admin_repositories_update: '/admin/repositories/:repository_id',
   

   logs_index: '/logs',
   logs_show: '/logs/:log_name',

   task_results_index: '/task-results',

   results_index: '/results',
   results_log: '/results/:result_id/log',
   results_report: '/results/:result_id/report',
   results_reset: '/results/:result_id/reset',

   tasks_index: '/tasks',
   tasks_show: '/tasks/:task_name',
   tasks_run: '/tasks/:task_name/run',
   tasks_status: '/tasks/:task_name/status',

   tests_index: '/tests',
   tests_show: '/tests/:test_name',
   tests_run: '/tests/:test_name/run',
   tests_status: '/tests/:test_name/status',

   alerts_index: '/alerts',
   alerts_show: '/alerts/:alert_name',
   alerts_on: '/alerts/:alert_name/run',
   alerts_off: '/alerts/:alert_name/stop',
   alerts_clear: '/alerts/:alert_name/clear',

   features_index: '/features',
   features_file: '/features/file',

   repositories_index: '/repositories',
   repositories_show: '/repositories/:repository_id',

   help_index: '/help',
   help_page: '/help/:page',

   logout: '/logout'
}

Instance Method Summary collapse

Instance Method Details

#path_for(key, args = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/mutx/lib/paths.rb', line 77

def path_for(key, args={})
   my_path = PATHS[key.to_sym]
   fail "Path not found for #{key}" unless my_path
   a_query_string = args.delete(:query_string)
   args.each do |k,v|
     my_path = my_path.gsub(":#{k}", v)
   end
   my_path += "?#{ Rack::Utils.build_nested_query(a_query_string) }" if a_query_string
   my_path
end