Class: Api::V2::ForeignInputSetsController

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

Instance Method Summary collapse

Instance Method Details

#action_permissionObject



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

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

#controller_permissionObject



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

def controller_permission
  'templates'
end

#createObject



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

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

#destroyObject



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

def destroy
  process_response @foreign_input_set.destroy
end

#indexObject



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

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

#resource_name(nested_resource = nil) ⇒ Object



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

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

#showObject



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

def show
end

#updateObject



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

def update
  process_response @foreign_input_set.update_attributes(params[:foreign_input_set])
end