Sha256: 87d4f801e20195567a45b31f7e062ea5b5f09d9b007f9e6cb571a11dc101a654

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

module ForemanTasks
  module Api
    class RecurringLogicsController < ::Api::V2::BaseController
      include ::Api::Version2

      resource_description do
        resource_id 'recurring_logics'
        api_version 'v2'
        api_base_url '/foreman_tasks/api'
      end

      before_action :find_resource, :only => %w[show cancel]

      api :GET, '/recurring_logics', N_('List recurring logics')
      param_group :search_and_pagination, ::Api::V2::BaseController
      def index
        @recurring_logics = resource_scope_for_index
      end

      api :GET, '/recurring_logics/:id', N_('Show recurring logic details')
      param :id, :identifier, desc: 'ID of the recurring logic', required: true
      def show; end

      api :POST, '/recurring_logics/:id/cancel', N_('Cancel recurring logic')
      param :id, :identifier, desc: 'ID of the recurring logic', required: true
      def cancel
        process_response @recurring_logic.cancel
      end

      def resource_class
        ForemanTasks::RecurringLogic
      end

      def action_permission
        case params[:action]
        when 'cancel'
          'edit'
        else
          super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman-tasks-0.13.4 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.13.3 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.13.2 app/controllers/foreman_tasks/api/recurring_logics_controller.rb