Class: Workarea::Orderbot::ChildProduct

Inherits:
Object
  • Object
show all
Includes:
Filters
Defined in:
app/services/workarea/orderbot/child_product.rb

Defined Under Namespace

Classes: ChildProductImportError, NoParentProductImportError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Filters

#add_filter_values, #first_variable, #second_variable

Constructor Details

#initialize(child_product) ⇒ ChildProduct

Returns a new instance of ChildProduct.



10
11
12
# File 'app/services/workarea/orderbot/child_product.rb', line 10

def initialize(child_product)
  @child_product = child_product
end

Instance Attribute Details

#child_productObject (readonly)

Returns the value of attribute child_product.



8
9
10
# File 'app/services/workarea/orderbot/child_product.rb', line 8

def child_product
  @child_product
end

Instance Method Details

#processObject



14
15
16
17
18
19
20
21
22
# File 'app/services/workarea/orderbot/child_product.rb', line 14

def process
  raise ChildProductImportError, "Blank Sku for #{product_id}" if sku.blank?
  raise NoParentProductImportError, "No product found for #{product_id}" if product.blank?

  save_variant
  save_price
  save_shipping_sku
  set_product_filters
end