Class: Returnly::Services::MarkItemsAsReturned
- Inherits:
-
Object
- Object
- Returnly::Services::MarkItemsAsReturned
- Defined in:
- lib/returnly/services/mark_items_as_returned.rb
Instance Attribute Summary collapse
-
#line_items ⇒ Object
Returns the value of attribute line_items.
-
#order ⇒ Object
Returns the value of attribute order.
Instance Method Summary collapse
-
#initialize(order, line_items) ⇒ MarkItemsAsReturned
constructor
A new instance of MarkItemsAsReturned.
- #perform! ⇒ Object
Constructor Details
#initialize(order, line_items) ⇒ MarkItemsAsReturned
Returns a new instance of MarkItemsAsReturned.
6 7 8 9 |
# File 'lib/returnly/services/mark_items_as_returned.rb', line 6 def initialize(order, line_items) @order = order @line_items = line_items end |
Instance Attribute Details
#line_items ⇒ Object
Returns the value of attribute line_items.
4 5 6 |
# File 'lib/returnly/services/mark_items_as_returned.rb', line 4 def line_items @line_items end |
#order ⇒ Object
Returns the value of attribute order.
4 5 6 |
# File 'lib/returnly/services/mark_items_as_returned.rb', line 4 def order @order end |
Instance Method Details
#perform! ⇒ Object
11 12 13 14 15 16 |
# File 'lib/returnly/services/mark_items_as_returned.rb', line 11 def perform! line_items.each do |line_item| quantity = line_item[:units].to_i inventory_units_by(line_item[:order_line_item_id]).take(quantity).each(&:return) end end |