Class: ForemanPatch::Api::V2::InvocationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/foreman_patch/api/v2/invocations_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



40
41
42
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 40

def destroy
  process_response @invocation.destroy
end

#indexObject



19
20
21
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 19

def index
  @invocations = resource_scope_for_index
end

#resource_classObject



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

def resource_class
  ForemanPatch::Invocation
end

#resource_scope(options = {}) ⇒ Object



48
49
50
51
52
53
54
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 48

def resource_scope(options = {})
  if action_name == 'index'
    @round.invocations.includes(:host).where(host: ::Host.authorized(:view_hosts, ::Host))
  else
    super(options)
  end
end

#showObject



25
26
27
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 25

def show
  @invocation = ForemanPatch::Invocation.find(params[:id])
end

#updateObject



34
35
36
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 34

def update
  process_response @invocation.update(invocation_params)
end