class Returnly::Builders::CustomerReturn

Public Class Methods

build_by_return_items(return_items) click to toggle source
# File lib/returnly/builders/customer_return.rb, line 5
def build_by_return_items(return_items)
  Spree::CustomerReturn.create(
    return_items: return_items,
    stock_location_id: stock_location_id(return_items.first)
  )
end
build_by_stock_location(stock_location) click to toggle source
# File lib/returnly/builders/customer_return.rb, line 12
def build_by_stock_location(stock_location)
  Spree::CustomerReturn.new(stock_location: stock_location)
end

Private Class Methods

return_item_order(return_item) click to toggle source
# File lib/returnly/builders/customer_return.rb, line 22
def return_item_order(return_item)
  return_item.inventory_unit.order
end
stock_location_id(return_item) click to toggle source
# File lib/returnly/builders/customer_return.rb, line 18
def stock_location_id(return_item)
  return_item_order(return_item).shipments.last.stock_location_id
end