Class: Lita::Interactors::AddQuantity
- Inherits:
-
BaseInteractor
- Object
- BaseInteractor
- Lita::Interactors::AddQuantity
- Includes:
- Helpers::MessagesHelper
- Defined in:
- lib/lita/interactors/add_quantity.rb
Overview
Adds the given quantity to the customer’s balance
Constant Summary collapse
- DEFAULT_QUANTITY =
1
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Attributes inherited from BaseInteractor
Instance Method Summary collapse
-
#initialize(handler, data) ⇒ AddQuantity
constructor
A new instance of AddQuantity.
- #perform ⇒ Object
Methods included from Helpers::MessagesHelper
#msg_customer_duplicated, #msg_customer_not_found, #msg_duplicated, #msg_not_found
Methods inherited from BaseInteractor
Constructor Details
#initialize(handler, data) ⇒ AddQuantity
Returns a new instance of AddQuantity.
13 14 15 16 |
# File 'lib/lita/interactors/add_quantity.rb', line 13 def initialize(handler, data) @handler = handler @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/lita/interactors/add_quantity.rb', line 10 def data @data end |
Instance Method Details
#perform ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/lita/interactors/add_quantity.rb', line 18 def perform if service_exists? update_costumer_if_exist else @error = msg_not_found(service_name: name) end self end |