Class: Wrappi::AsyncHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/wrappi/async_handler.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, options) ⇒ AsyncHandler

Returns a new instance of AsyncHandler.



7
8
9
10
# File 'lib/wrappi/async_handler.rb', line 7

def initialize(endpoint, options)
  @endpoint = endpoint
  @options = options
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



6
7
8
# File 'lib/wrappi/async_handler.rb', line 6

def endpoint
  @endpoint
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/wrappi/async_handler.rb', line 6

def options
  @options
end

Class Method Details

.call(*args) ⇒ Object



3
4
5
# File 'lib/wrappi/async_handler.rb', line 3

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



12
13
14
15
# File 'lib/wrappi/async_handler.rb', line 12

def call
  AsyncJob.set((options[:set] || {}))
       .perform_later(endpoint.class.to_s, { params: endpoint.input_params, options: endpoint.options }, options)
end