Class: Lita::Interactors::InscribeCustomer

Inherits:
BaseInteractor show all
Includes:
Helpers::MessagesHelper
Defined in:
lib/lita/interactors/inscribe_customer.rb

Overview

Inscribes a customer in a service

Instance Attribute Summary collapse

Attributes inherited from BaseInteractor

#error, #handler, #message

Instance Method Summary collapse

Methods included from Helpers::MessagesHelper

#msg_customer_duplicated, #msg_customer_not_found, #msg_duplicated, #msg_not_found

Methods inherited from BaseInteractor

#repository, #success?

Constructor Details

#initialize(handler, data) ⇒ InscribeCustomer

Returns a new instance of InscribeCustomer.



12
13
14
15
# File 'lib/lita/interactors/inscribe_customer.rb', line 12

def initialize(handler, data)
  @handler = handler
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/lita/interactors/inscribe_customer.rb', line 10

def data
  @data
end

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
# File 'lib/lita/interactors/inscribe_customer.rb', line 17

def perform
  if service_exists?
    inscribe_customer_if_new
  else
    @error = msg_not_found(service_name: name)
  end
  self
end