ForemanOpenstackSimplify::ControllerPatches

Public Class Methods

not_implemented(controller_class, method_names, type = :text) click to toggle source
# File lib/foreman_openstack_simplify/controller_patches.rb, line 4
def not_implemented(controller_class, method_names, type = :text)
  controller_class.class_eval do
    method_names.each do |method_name|
      case type
      when :text
        define_method(method_name) do
          render :text => "Not Implemented", :status => :not_implemented
        end
      when :json
        define_method(method_name) do
          render :json => '{"error":{"message":"Not Implemented"}}', :status => :not_implemented
        end
      else
        raise ArgumentError, "Wrong response type '#{type.to_s}'"
      end
    end
  end
end
not_implemented_api_crud(controller_class, skip_find_resource = true) click to toggle source
# File lib/foreman_openstack_simplify/controller_patches.rb, line 28
def not_implemented_api_crud(controller_class, skip_find_resource = true)
  not_implemented(controller_class,
                  [:index, :show, :create, :update, :destroy], :json)
  controller_class.skip_filter :find_resource if skip_find_resource
end
not_implemented_ui_crud(controller_class) click to toggle source
# File lib/foreman_openstack_simplify/controller_patches.rb, line 23
def not_implemented_ui_crud(controller_class)
  not_implemented(controller_class,
                  [:index, :show, :new, :create, :edit, :update, :destroy])
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.