Class: Lita::Interactors::ResetQuantity

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

Overview

Set the customer quantity to zero

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) ⇒ ResetQuantity

Returns a new instance of ResetQuantity.



12
13
14
15
# File 'lib/lita/interactors/reset_quantity.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/reset_quantity.rb', line 10

def data
  @data
end

Instance Method Details

#performObject



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

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