Sha256: fd6b01f34f19e8fcf322e3857bc9708110b73135b0856d8eee355b669c2d41d3

Contents?: true

Size: 676 Bytes

Versions: 4

Compression:

Stored size: 676 Bytes

Contents

module Apress
  module Api
    module V1
      class CallbacksController < ApiController::Base
        include Pundit

        def create
          authorize :'apress/api/callback'

          event_params = params[:params] || {}

          Resque.redis.multi do
            Apress::Api::Callbacks::Config.handlers(
              service: params.require(:service),
              event: params.require(:event)
            ).each { |handler| Resque.enqueue(Apress::Api::EventHandlerEnqueueingJob, handler, event_params) }
          end

          head 201
        end

        private

        def pundit_user
          current_api_client
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
apress-api-1.24.0 app/controllers/apress/api/v1/callbacks_controller.rb
apress-api-1.23.0 app/controllers/apress/api/v1/callbacks_controller.rb
apress-api-1.22.1 app/controllers/apress/api/v1/callbacks_controller.rb
apress-api-1.22.0 app/controllers/apress/api/v1/callbacks_controller.rb