Class: ForemanTasks::Api::RecurringLogicsController
- Inherits:
-
Api::V2::BaseController
- Object
- Api::V2::BaseController
- ForemanTasks::Api::RecurringLogicsController
- Includes:
- Api::Version2, Concerns::Parameters::RecurringLogic
- Defined in:
- app/controllers/foreman_tasks/api/recurring_logics_controller.rb
Defined Under Namespace
Classes: BadRequest
Instance Method Summary collapse
- #action_permission ⇒ Object
- #bulk_destroy ⇒ Object
- #cancel ⇒ Object
- #index ⇒ Object
- #resource_class ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Concerns::Parameters::RecurringLogic
Instance Method Details
#action_permission ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 61 def case params[:action] when 'cancel', 'bulk_destroy' 'edit' else super end end |
#bulk_destroy ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 50 def bulk_destroy if params[:search].blank? raise BadRequest, _('Please provide a search parameter in the request') end scope = resource_scope.search_for(params[:search]) scope.each(&:destroy!) render json: { destroyed: scope } rescue ActiveRecord::RecordNotDestroyed => error render json: { error: error, scope: scope }, status: :bad_request end |
#cancel ⇒ Object
40 41 42 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 40 def cancel process_response @recurring_logic.cancel end |
#index ⇒ Object
23 24 25 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 23 def index @recurring_logics = resource_scope_for_index end |
#resource_class ⇒ Object
44 45 46 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 44 def resource_class ForemanTasks::RecurringLogic end |
#show ⇒ Object
29 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 29 def show; end |
#update ⇒ Object
34 35 36 |
# File 'app/controllers/foreman_tasks/api/recurring_logics_controller.rb', line 34 def update process_response @recurring_logic.update(recurring_logic_params) end |