Class: Decidim::Budgets::RemoveLineItem
- Inherits:
-
Command
- Object
- Command
- Decidim::Budgets::RemoveLineItem
- Defined in:
- app/commands/decidim/budgets/remove_line_item.rb
Overview
A command with all the business to add remove line items from orders
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(order, project) ⇒ RemoveLineItem
constructor
Public: Initializes the command.
Constructor Details
#initialize(order, project) ⇒ RemoveLineItem
Public: Initializes the command.
order - The current order for the user project - The the project to remove from the order
11 12 13 14 |
# File 'app/commands/decidim/budgets/remove_line_item.rb', line 11 def initialize(order, project) @order = order @project = project end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the there is an error.
Returns nothing.
22 23 24 25 26 27 |
# File 'app/commands/decidim/budgets/remove_line_item.rb', line 22 def call return broadcast(:invalid) if @order.checked_out? remove_line_item broadcast(:ok, @order) end |