Class: SolidusImporter::Processors::LineItem

Inherits:
Base
  • Object
show all
Defined in:
lib/solidus_importer/processors/line_item.rb

Instance Method Summary collapse

Methods inherited from Base

#options

Instance Method Details

#call(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/solidus_importer/processors/line_item.rb', line 6

def call(context)
  @data = context[:data]

  return if @data['Lineitem sku'].blank?

  order = context.fetch(:order, {})

  order[:line_items_attributes] ||= {}

  index = order[:line_items_attributes].size

  order[:line_items_attributes][index] = line_items_attributes

  context.merge!(order: order)
end