Module: OrderItemsGroups

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

Instance Method Summary collapse

Instance Method Details

#create_order_item_group(data) ⇒ Object

Create order item group.

Create a order item group with data.

Parameters

data

(Hash) – Data to be submited.

Example

data = {
  "name": "New Order Item Group",
  "order_id": 1,
  "quantity": 1,
  "sale_price": 200
}
@data = @mints_user.create_order_item_group(data)

78
79
80
# File 'lib/user/ecommerce/order_items_groups.rb', line 78

def create_order_item_group(data)
    return @client.raw("post", "/ecommerce/order-items-groups", nil, data_transform(data))
end

#delete_order_item_group(id) ⇒ Object

Delete order item group.

Delete a order item group.

Parameters

id

(Integer) – Order item group id.

Example

@data = @mints_user.delete_order_item_group(147)

106
107
108
# File 'lib/user/ecommerce/order_items_groups.rb', line 106

def delete_order_item_group(id)
    return @client.raw("delete", "/ecommerce/order-items-groups/#{id}")
end

#get_order_item_group(id, options = nil) ⇒ Object

Get order item group.

Get a order item group info.

Parameters

id

(Integer) – Order item group id.

options

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

First Example

@data = @mints_user.get_order_item_group(1)

Second Example

options = { "fields": "name" }
@data = @mints_user.get_order_item_group(1, options)

60
61
62
# File 'lib/user/ecommerce/order_items_groups.rb', line 60

def get_order_item_group(id, options = nil)
    return @client.raw("get", "/ecommerce/order-items-groups/#{id}", options)
end

#get_order_item_group_support_data_by_order_id(orderId) ⇒ Object

Get order item group support data by order id.

Get support data of an order item group by an order id.

Parameters

orderId

(Integer) – Order id.

Example

@data = @mints_user.get_order_item_group_support_data_by_order_id(1)

27
28
29
# File 'lib/user/ecommerce/order_items_groups.rb', line 27

def get_order_item_group_support_data_by_order_id(orderId) #FIXME: Return in OrderItemsGroupController.getTemplateSupportDataByOrderId method doesnt create data variable.
    return @client.raw("get", "/ecommerce/order-items-groups/support-data/#{orderId}")
end

#get_order_item_groups(options = nil) ⇒ Object

Get order item groups.

Get a collection of order item groups.

Parameters

options

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

First Example

@data = @mints_user.get_order_item_groups

Second Example

options = { "fields": "name" }
@data = @mints_user.get_order_item_groups(options)

43
44
45
# File 'lib/user/ecommerce/order_items_groups.rb', line 43

def get_order_item_groups(options = nil)
    return @client.raw("get", "/ecommerce/order-items-groups", options)
end

#get_pending_order_template_from_order_item_group(parentOrderId, orderTemplateId) ⇒ Object

Get pending order template from order item group.

Get a pending order template from an order item group.

Parameters

parentOrderId

(Integer) – Order items group id.

orderTemplateId

(Integer) – Order template id.

Example

@data = @mints_user.get_pending_order_template_from_order_item_group(1, 1)

15
16
17
# File 'lib/user/ecommerce/order_items_groups.rb', line 15

def get_pending_order_template_from_order_item_group(parentOrderId, orderTemplateId)
    return @client.raw("get", "/ecommerce/order-items-groups/#{parentOrderId}/pending-items/order-template/#{orderTemplateId}")
end

#update_order_item_group(id, data) ⇒ Object

Update order item group.

Update a order item group info.

Parameters

id

(Integer) – Order item group id.

data

(Hash) – Data to be submited.

Example

data = {
  "name": "New Order Item Group Modified"
}
@data = @mints_user.update_order_item_group(147, data)

94
95
96
# File 'lib/user/ecommerce/order_items_groups.rb', line 94

def update_order_item_group(id, data)
    return @client.raw("put", "/ecommerce/order-items-groups/#{id}", nil, data_transform(data))
end