Class: DeferredRequest::TestController

Inherits:
ApplicationController show all
Defined in:
app/controllers/deferred_request/test_controller.rb

Instance Method Summary collapse

Instance Method Details

#status_callbackObject



3
4
5
6
# File 'app/controllers/deferred_request/test_controller.rb', line 3

def status_callback
  head :ok
  DeferredRequest.perform_later_from_request!(request)
end

#status_callback_deferred(deferred_request) ⇒ Object



8
9
10
11
# File 'app/controllers/deferred_request/test_controller.rb', line 8

def status_callback_deferred(deferred_request)
  # Do something with the deferred request
  deferred_request.params.dig("answer")
end

#status_errorObject



13
14
15
16
17
# File 'app/controllers/deferred_request/test_controller.rb', line 13

def status_error
  # don't add the "_deferred" method (used for testing)
  head :ok
  DeferredRequest.perform_later_from_request!(request)
end