Sha256: 6d0e686ed055a91ede0f11696a84c87cab5135a371f2d2ad6171ee8a34e9976b

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 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')
      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

10 entries across 10 versions & 1 rubygems

Version Path
foreman-tasks-0.11.3 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.13.1 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.13.0 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.12.2 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.11.2 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.12.1 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.12.0 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.11.1 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.10.9 app/controllers/foreman_tasks/api/recurring_logics_controller.rb
foreman-tasks-0.11.0 app/controllers/foreman_tasks/api/recurring_logics_controller.rb