Class: Api::V2::ForeignInputSetsController

Inherits:
BaseController
  • Object
show all
Includes:
Api::Version2, Foreman::Controller::Parameters::ForeignInputSet, Foreman::Renderer
Defined in:
app/controllers/api/v2/foreign_input_sets_controller.rb

Instance Method Summary collapse

Instance Method Details

#action_permissionObject



65
66
67
68
69
70
71
72
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 65

def action_permission
  case params[:action]
  when :create, :edit, :destroy
    'edit'
  else
    super
  end
end

#controller_permissionObject



61
62
63
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 61

def controller_permission
  'templates'
end

#createObject



37
38
39
40
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 37

def create
  @foreign_input_set = resource_class.new(foreign_input_set_params.merge(:template_id => @nested_obj.id))
  process_response @foreign_input_set.save
end

#destroyObject



45
46
47
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 45

def destroy
  process_response @foreign_input_set.destroy
end

#indexObject



14
15
16
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 14

def index
  @foreign_input_sets = nested_obj.foreign_input_sets.search_for(*search_options).paginate(paginate_options)
end

#resource_name(nested_resource = nil) ⇒ Object



57
58
59
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 57

def resource_name(nested_resource = nil)
  nested_resource || 'foreign_input_set'
end

#showObject



21
22
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 21

def show
end

#updateObject



53
54
55
# File 'app/controllers/api/v2/foreign_input_sets_controller.rb', line 53

def update
  process_response @foreign_input_set.update(foreign_input_set_params)
end