Class: Apress::Api::V1::CallbacksController

Inherits:
ApiController::Base show all
Includes:
Pundit
Defined in:
app/controllers/apress/api/v1/callbacks_controller.rb

Constant Summary

Constants included from ApiController::Pagination

ApiController::Pagination::DEFAULT_PER_PAGE, ApiController::Pagination::MAX_PER_PAGE

Instance Method Summary collapse

Methods included from ApiController::Compatibility

#allow_forgery_protection=, #assets_dir=, #helper, #helpers_path=, #include_all_helpers=, #javascripts_dir=, #page_cache_directory=, #relative_url_root=, #stylesheets_dir=

Methods included from ApiController::Pagination

#pagination_headers, #prepare_pagination

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/apress/api/v1/callbacks_controller.rb', line 8

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