Class: Lesli::Courier

Inherits:
Object
  • Object
show all
Defined in:
lib/lesli/courier.rb

Instance Method Summary collapse

Constructor Details

#initialize(module_name, on_error = nil) ⇒ Courier

Store the module_name (e.g., :lesli_support as LesliSupport)



37
38
39
40
# File 'lib/lesli/courier.rb', line 37

def initialize(module_name, on_error=nil)
    @module_name = module_name.to_s.camelize
    @on_error = on_error
end

Instance Method Details

#call(method_name, *args) ⇒ Object

Store the method name to call on the service (e.g., :index_with_deadline)



50
51
52
53
54
# File 'lib/lesli/courier.rb', line 50

def call(method_name, *args)
    @method_params = args 
    @method_name = method_name
    self.execute
end

#from(service_name, *args) ⇒ Object

Dynamically determine the class to call (e.g., :ticket_service as TicketService)



43
44
45
46
47
# File 'lib/lesli/courier.rb', line 43

def from(service_name, *args)
    @service_params = args
    @service_name = service_name.to_s.camelize
    self
end