Module: ProductTemplates

Included in:
Ecommerce
Defined in:
lib/user/ecommerce/product_templates.rb

Instance Method Summary collapse

Instance Method Details

#create_product_template(data) ⇒ Object

Create product template.

Create a product template with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Product Template',
  slug: 'new-product-template'
}
@data = @cxf_user.create_product_template(data)


86
87
88
# File 'lib/user/ecommerce/product_templates.rb', line 86

def create_product_template(data)
  @client.raw('post', '/ecommerce/product-templates/', nil, data_transform(data))
end

#get_product_template(id, options = nil) ⇒ Object

Get product template.

Get a product template info.

Parameters

id

(Integer) – Product template id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @cxf_user.get_product_template(1)

Second Example

options = { fields: 'title' }
@data = @cxf_user.get_product_template(1, options)


70
71
72
# File 'lib/user/ecommerce/product_templates.rb', line 70

def get_product_template(id, options = nil)
  @client.raw('get', "/ecommerce/product-templates/#{id}", options)
end

#get_product_templates(options = nil) ⇒ Object

Get product templates.

Get a collection of product templates.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @cxf_user.get_product_templates

Second Example

options = { fields: 'title' }
@data = @cxf_user.get_product_templates(options)


53
54
55
# File 'lib/user/ecommerce/product_templates.rb', line 53

def get_product_templates(options = nil)
  @client.raw('get', '/ecommerce/product-templates', options)
end

#get_product_templates_support_dataObject

Get product templates support data.

Get support data used in product templates.

Example

@data = @cxf_user.get_product_templates_support_data


37
38
39
# File 'lib/user/ecommerce/product_templates.rb', line 37

def get_product_templates_support_data
  @client.raw('get', '/ecommerce/product-templates/support-data')
end

#get_product_templates_support_data_from_order_items_group(id) ⇒ Object

Get product templates support data from order items group.

Get product templates support data from a order items group.

Parameters

id

(Integer) – Order items group id.

Example

@data = @cxf_user.get_product_templates_support_data_from_order_items_group(1)


28
29
30
# File 'lib/user/ecommerce/product_templates.rb', line 28

def get_product_templates_support_data_from_order_items_group(id)
  @client.raw('get', "/ecommerce/product-templates/support-data/order-items-groups/#{id}")
end

#get_product_templates_support_data_from_product(id) ⇒ Object

Get product templates support data from product.

Get product templates support data from a product.

Parameters

id

(Integer) – Product id.

Example

@data = @cxf_user.get_product_templates_support_data_from_product(1)


16
17
18
# File 'lib/user/ecommerce/product_templates.rb', line 16

def get_product_templates_support_data_from_product(id)
  @client.raw('get', "/ecommerce/product-templates/support-data/products/#{id}")
end

#update_product_template(id, data) ⇒ Object

Update product template.

Update a product template info.

Parameters

id

(Integer) – Product template id.

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Product Template Modified',
  slug: 'new-product-template'
}
@data = @cxf_user.update_product_template(3, data)


103
104
105
# File 'lib/user/ecommerce/product_templates.rb', line 103

def update_product_template(id, data)
  @client.raw('put', "/ecommerce/product-templates/#{id}", nil, data_transform(data))
end