Module: WeChat::REST::Store
Instance Method Summary collapse
-
#category_get_children(category_id) ⇒ Object
Categories ————————.
- #category_get_properties(category_id) ⇒ Object
- #category_get_sku_definitions(category_id) ⇒ Object
-
#delivery_template_create(data) ⇒ Object
Delivery Template ————————.
- #delivery_template_delete(template_id) ⇒ Object
- #delivery_template_get(template_id) ⇒ Object
- #delivery_template_get_all ⇒ Object
- #delivery_template_update(new_data) ⇒ Object
-
#group_create(data) ⇒ Object
Group ————————.
- #group_delete(group_id) ⇒ Object
- #group_get(group_id) ⇒ Object
- #group_get_all ⇒ Object
- #group_product_update(data) ⇒ Object
- #group_update(new_data) ⇒ Object
- #order_close(order_id) ⇒ Object
-
#order_get(order_id) ⇒ Object
Order ————————.
- #order_get_by_filter(filter) ⇒ Object
- #order_set_delivery(data) ⇒ Object
- #product_create(merchant) ⇒ Object
- #product_delete(product_id) ⇒ Object
-
#product_get(product_id) ⇒ Object
Products ————————.
- #product_get_by_status(status) ⇒ Object
- #product_modify_product_status(product_id, status) ⇒ Object
- #product_update(new_merchant) ⇒ Object
-
#shelf_create(data) ⇒ Object
Shelf ————————.
- #shelf_delete(shelf_id) ⇒ Object
- #shelf_get(shelf_id) ⇒ Object
- #shelf_get_all ⇒ Object
- #shelf_update(new_data) ⇒ Object
-
#stock_add(product_id, sku_info, quantity) ⇒ Object
Stock ————————.
- #stock_reduce(product_id, sku_info, quantity) ⇒ Object
- #stock_update(product_id, sku_info, original_quantity, new_quantity) ⇒ Object
-
#store_upload_image(file_path, file_name) ⇒ Object
Misc ————————.
Instance Method Details
#category_get_children(category_id) ⇒ Object
Categories
38 39 40 |
# File 'lib/we_chat/rest/store.rb', line 38 def category_get_children(category_id) perform_post '/merchant/category/getsub', { cate_id: category_id } end |
#category_get_properties(category_id) ⇒ Object
46 47 48 |
# File 'lib/we_chat/rest/store.rb', line 46 def category_get_properties(category_id) perform_post '/merchant/category/getproperty', { cate_id: category_id } end |
#category_get_sku_definitions(category_id) ⇒ Object
42 43 44 |
# File 'lib/we_chat/rest/store.rb', line 42 def category_get_sku_definitions(category_id) perform_post '/merchant/category/getsku', { cate_id: category_id } end |
#delivery_template_create(data) ⇒ Object
Delivery Template
74 75 76 |
# File 'lib/we_chat/rest/store.rb', line 74 def delivery_template_create(data) perform_post 'merchant/express/add', data end |
#delivery_template_delete(template_id) ⇒ Object
78 79 80 |
# File 'lib/we_chat/rest/store.rb', line 78 def delivery_template_delete(template_id) perform_post 'merchant/express/del', { template_id: template_id } end |
#delivery_template_get(template_id) ⇒ Object
86 87 88 |
# File 'lib/we_chat/rest/store.rb', line 86 def delivery_template_get(template_id) perform_post 'merchant/express/getbyid', { template_id: template_id } end |
#delivery_template_get_all ⇒ Object
90 91 92 |
# File 'lib/we_chat/rest/store.rb', line 90 def delivery_template_get_all perform_post 'merchant/express/getall' end |
#delivery_template_update(new_data) ⇒ Object
82 83 84 |
# File 'lib/we_chat/rest/store.rb', line 82 def delivery_template_update(new_data) perform_post 'merchant/express/update', new_data end |
#group_create(data) ⇒ Object
Group
97 98 99 |
# File 'lib/we_chat/rest/store.rb', line 97 def group_create(data) perform_post 'merchant/group/add', data end |
#group_delete(group_id) ⇒ Object
101 102 103 |
# File 'lib/we_chat/rest/store.rb', line 101 def group_delete(group_id) perform_post 'merchant/group/del', { group_id: group_id } end |
#group_get(group_id) ⇒ Object
117 118 119 |
# File 'lib/we_chat/rest/store.rb', line 117 def group_get(group_id) perform_post 'merchant/group/getbyid', { group_id: group_id } end |
#group_get_all ⇒ Object
113 114 115 |
# File 'lib/we_chat/rest/store.rb', line 113 def group_get_all perform_post 'merchant/group/getall' end |
#group_product_update(data) ⇒ Object
109 110 111 |
# File 'lib/we_chat/rest/store.rb', line 109 def group_product_update(data) perform_post 'merchant/group/productmod', data end |
#group_update(new_data) ⇒ Object
105 106 107 |
# File 'lib/we_chat/rest/store.rb', line 105 def group_update(new_data) perform_post 'merchant/group/propertymod', new_data end |
#order_close(order_id) ⇒ Object
159 160 161 |
# File 'lib/we_chat/rest/store.rb', line 159 def order_close(order_id) perform_post 'merchant/order/close', {order_id: order_id} end |
#order_get(order_id) ⇒ Object
Order
147 148 149 |
# File 'lib/we_chat/rest/store.rb', line 147 def order_get(order_id) perform_post 'merchant/order/getbyid', {order_id: order_id} end |
#order_get_by_filter(filter) ⇒ Object
151 152 153 |
# File 'lib/we_chat/rest/store.rb', line 151 def order_get_by_filter(filter) perform_post 'merchant/order/getbyfilter', filter end |
#order_set_delivery(data) ⇒ Object
155 156 157 |
# File 'lib/we_chat/rest/store.rb', line 155 def order_set_delivery(data) perform_post 'merchant/order/setdelivery', data end |
#product_create(merchant) ⇒ Object
19 20 21 |
# File 'lib/we_chat/rest/store.rb', line 19 def product_create(merchant) perform_post('/merchant/create', merchant) end |
#product_delete(product_id) ⇒ Object
23 24 25 |
# File 'lib/we_chat/rest/store.rb', line 23 def product_delete(product_id) perform_post('/merchant/del', {product_id: product_id}) end |
#product_get(product_id) ⇒ Object
Products
11 12 13 |
# File 'lib/we_chat/rest/store.rb', line 11 def product_get(product_id) perform_get('/merchant/get', {product_id: product_id}) end |
#product_get_by_status(status) ⇒ Object
15 16 17 |
# File 'lib/we_chat/rest/store.rb', line 15 def product_get_by_status(status) perform_post('/merchant/getbystatus', {status: status}) end |
#product_modify_product_status(product_id, status) ⇒ Object
31 32 33 |
# File 'lib/we_chat/rest/store.rb', line 31 def product_modify_product_status(product_id, status) perform_post('/merchant/modproductstatus', {product_id: product_id, status: status}) end |
#product_update(new_merchant) ⇒ Object
27 28 29 |
# File 'lib/we_chat/rest/store.rb', line 27 def product_update(new_merchant) perform_post('/merchant/update', new_merchant) end |
#shelf_create(data) ⇒ Object
Shelf
124 125 126 |
# File 'lib/we_chat/rest/store.rb', line 124 def shelf_create(data) perform_post 'merchant/shelf/add', data end |
#shelf_delete(shelf_id) ⇒ Object
128 129 130 |
# File 'lib/we_chat/rest/store.rb', line 128 def shelf_delete(shelf_id) perform_post 'merchant/shelf/del', { shelf_id: shelf_id } end |
#shelf_get(shelf_id) ⇒ Object
140 141 142 |
# File 'lib/we_chat/rest/store.rb', line 140 def shelf_get(shelf_id) perform_post 'merchant/shelf/getbyid', { shelf_id: shelf_id } end |
#shelf_get_all ⇒ Object
136 137 138 |
# File 'lib/we_chat/rest/store.rb', line 136 def shelf_get_all perform_post 'merchant/shelf/getall' end |
#shelf_update(new_data) ⇒ Object
132 133 134 |
# File 'lib/we_chat/rest/store.rb', line 132 def shelf_update(new_data) perform_post 'merchant/shelf/mod', new_data end |
#stock_add(product_id, sku_info, quantity) ⇒ Object
Stock
53 54 55 |
# File 'lib/we_chat/rest/store.rb', line 53 def stock_add(product_id, sku_info, quantity) perform_post '/merchant/stock/add', { product_id: product_id, sku_info: sku_info, quantity: quantity} end |
#stock_reduce(product_id, sku_info, quantity) ⇒ Object
57 58 59 |
# File 'lib/we_chat/rest/store.rb', line 57 def stock_reduce(product_id, sku_info, quantity) perform_post '/merchant/stock/reduce', { product_id: product_id, sku_info: sku_info, quantity: quantity} end |
#stock_update(product_id, sku_info, original_quantity, new_quantity) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/we_chat/rest/store.rb', line 61 def stock_update(product_id, sku_info, original_quantity, new_quantity) if new_quantity > original_quantity # Adding stock stock_add(product_id, sku_info, new_quantity - original_quantity) end if new_quantity < original_quantity # Reducing stock stock_reduce(product_id, sku_info, original_quantity - new_quantity) end end |
#store_upload_image(file_path, file_name) ⇒ Object
Misc
166 167 168 |
# File 'lib/we_chat/rest/store.rb', line 166 def store_upload_image(file_path, file_name) perform_multipart_post('/merchant/common/upload_img', { key: 'media', file: file_path, params: { filename: file_name } }) end |