Class: Api::V2::ForemanDatacenter::DeviceBaysController

Inherits:
BaseController
  • Object
show all
Includes:
ForemanDatacenter::Controller::Parameters::DeviceBay
Defined in:
app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#action_permission, #controller_permission, #find_resource, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for

Instance Method Details

#createObject



34
35
36
37
# File 'app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb', line 34

def create
  @device_bay = ::ForemanDatacenter::DeviceBay.new(device_bay_params)
  process_response @device_bay.save
end

#depopulateObject



68
69
70
# File 'app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb', line 68

def depopulate
  process_response @device_bay.update(installed_device_id: nil)
end

#destroyObject



50
51
52
# File 'app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb', line 50

def destroy
  process_response @device_bay.destroy
end

#indexObject



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

def index
  @device_bays = resource_scope_for_index
end

#populateObject



59
60
61
62
# File 'app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb', line 59

def populate
  device_id = params[:installed_device_id]
  process_response @device_bay.update(installed_device_id: device_id)
end

#showObject



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

def show
end

#updateObject



43
44
45
# File 'app/controllers/api/v2/foreman_datacenter/device_bays_controller.rb', line 43

def update
  process_response @device_bay.update(device_bay_params)
end