Sha256: dc68d625de98613d6c06a8713274884e0655f3b19fa252afd631f66b6c6acfdf

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true
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

1 entries across 1 versions & 1 rubygems

Version Path
apress-api-1.24.2 app/controllers/apress/api/v1/callbacks_controller.rb