Class: Workarea::Orderbot::ParentProduct

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Filters

#add_filter_values, #first_variable, #second_variable

Constructor Details

#initialize(parent_product) ⇒ ParentProduct

Returns a new instance of ParentProduct.



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

def initialize(parent_product)
  @parent_product = parent_product
end

Instance Attribute Details

#parent_productObject (readonly)

Returns the value of attribute parent_product.



6
7
8
# File 'app/services/workarea/orderbot/parent_product.rb', line 6

def parent_product
  @parent_product
end

Instance Method Details

#processObject



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

def process
  product.name = product_details[:name]
  product.description = product_details[:description]
  product.active = product_details[:active]

  product.filters = build_product_filters
  product.template = product_template
  set_details
  product.save!
end