Class: Lita::Interactors::AddAll
- Inherits:
-
BaseInteractor
- Object
- BaseInteractor
- Lita::Interactors::AddAll
- Includes:
- Helpers::MessagesHelper
- Defined in:
- lib/lita/interactors/add_all.rb
Overview
Increases all customers’ quantity with the given value or with 1 if nothing is specified.
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) ⇒ AddAll
constructor
A new instance of AddAll.
- #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) ⇒ AddAll
Returns a new instance of AddAll.
14 15 16 17 |
# File 'lib/lita/interactors/add_all.rb', line 14 def initialize(handler, data) @handler = handler @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/lita/interactors/add_all.rb', line 11 def data @data end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/lita/interactors/add_all.rb', line 19 def perform if service_exists? update_all_quantities else @error = msg_not_found(service_name: name) end self end |