Class: ForemanPatch::Api::V2::InvocationsController
- Inherits:
-
BaseController
- Object
- Api::V2::BaseController
- BaseController
- ForemanPatch::Api::V2::InvocationsController
- Defined in:
- app/controllers/foreman_patch/api/v2/invocations_controller.rb
Instance Method Summary collapse
- #cancel ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #move ⇒ Object
- #resource_class ⇒ Object
- #resource_scope(options = {}) ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#cancel ⇒ Object
55 56 57 58 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 55 def cancel @invocations = ForemanPatch::Invocation.where(id: params[:ids]) @invocations.update_all(status: 'cancelled') end |
#destroy ⇒ Object
62 63 64 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 62 def destroy process_response @invocation.destroy end |
#index ⇒ Object
19 20 21 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 19 def index @invocations = resource_scope_for_index end |
#move ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 40 def move @invocations = ForemanPatch::Invocation.where(id: params[:ids]) @errors = [] @invocations.each do |invocation| round = invocation.round.cycle.rounds.find(params[:round_id]) invocation.update(round: round) rescue end @invocations = ForemanPatch::Invocation.where(id: params[:ids], round_id: params[:round_id]) end |
#resource_class ⇒ Object
66 67 68 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 66 def resource_class ForemanPatch::Invocation end |
#resource_scope(options = {}) ⇒ Object
70 71 72 73 74 75 76 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 70 def resource_scope( = {}) if action_name == 'index' @round.invocations.includes(:host).where(host: ::Host.(:view_hosts, ::Host)) else super() end end |
#show ⇒ Object
25 26 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 25 def show end |
#update ⇒ Object
33 34 35 |
# File 'app/controllers/foreman_patch/api/v2/invocations_controller.rb', line 33 def update process_response @invocation.update(invocation_params) end |