Class: Veeqo::Product

Inherits:
Base
  • Object
show all
Includes:
Actions::Base
Defined in:
lib/veeqo/product.rb

Instance Method Summary collapse

Methods included from Actions::Delete

#delete

Methods included from Actions::Find

#find

Methods included from Actions::List

#list

Methods inherited from Base

method_missing

Instance Method Details

#create(title:, variants:, images: [], **attributes) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/veeqo/product.rb', line 5

def create(title:, variants:, images: [], **attributes)
  required_attributes = {
    title: title,
    product_variants_attributes: variants,
    images_attributes: images,
  }

  create_resource(product: required_attributes.merge(attributes))
end

#update(product_id, attributes) ⇒ Object



15
16
17
# File 'lib/veeqo/product.rb', line 15

def update(product_id, attributes)
  update_resource(product_id, product: attributes)
end