magento 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/magento/params/create_product.rb +26 -26
- data/lib/magento/product.rb +24 -0
- data/lib/magento/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2212acd226570a0dc73fc66683290aca3469006680b1e7946f3426177d0368a3
|
4
|
+
data.tar.gz: 1b3029f0f0eb3f0c6b583e4c025f8ab5d53dba8bfeed197e6e8ffc3c08ebf473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d4b55ba92ddfe5e7831da80ccdf170139a6b8f3459be07d35bfc877ee0638cbcaf15f98d7215f01b017510bb4d8458cf45e229acca7b3dc5d5fa2054e8f00b1
|
7
|
+
data.tar.gz: e35feff6cb0a82ece59cf57cb4bde0b0f9d7ea5989ff307c17211045fee78fff1dafbbcc8aaec34be3249e14c784679569d2d9d8dfc773124033592cc82189cf
|
data/README.md
CHANGED
@@ -4,33 +4,33 @@ require_relative 'create_custom_attribute'
|
|
4
4
|
module Magento
|
5
5
|
module Params
|
6
6
|
# Example
|
7
|
-
#
|
8
|
-
# params = Magento::Params::CreateProduct.new(
|
9
|
-
# sku: '556-teste-builder',
|
10
|
-
# name: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
11
|
-
# description: 'Descrição do produto',
|
12
|
-
# brand: 'Coca-Cola',
|
13
|
-
# price: 4.99,
|
14
|
-
# special_price: 3.49,
|
15
|
-
# quantity: 2,
|
16
|
-
# weight: 0.3,
|
17
|
-
# attribute_set_id: 4,
|
18
|
-
# images: [
|
19
|
-
# *Magento::Params::CreateImage.new(
|
20
|
-
# path: 'https://urltoimage.com/image.jpg',
|
21
|
-
# title: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
22
|
-
# position: 0,
|
23
|
-
# main: true
|
24
|
-
# ).variants, # it's generate all variants thumbnail => '100x100', small_image => '300x300' and image => '800x800'
|
25
|
-
# Magento::Params::CreateImage.new(
|
26
|
-
# path: '/path/to/image.jpg',
|
27
|
-
# title: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
28
|
-
# position: 1
|
29
|
-
# )
|
30
|
-
# ]
|
31
|
-
# )
|
32
7
|
#
|
33
|
-
# Magento::
|
8
|
+
# params = Magento::Params::CreateProduct.new(
|
9
|
+
# sku: '556-teste-builder',
|
10
|
+
# name: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
11
|
+
# description: 'Descrição do produto',
|
12
|
+
# brand: 'Coca-Cola',
|
13
|
+
# price: 4.99,
|
14
|
+
# special_price: 3.49,
|
15
|
+
# quantity: 2,
|
16
|
+
# weight: 0.3,
|
17
|
+
# attribute_set_id: 4,
|
18
|
+
# images: [
|
19
|
+
# *Magento::Params::CreateImage.new(
|
20
|
+
# path: 'https://urltoimage.com/image.jpg',
|
21
|
+
# title: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
22
|
+
# position: 0,
|
23
|
+
# main: true
|
24
|
+
# ).variants, # it's generate all variants thumbnail => '100x100', small_image => '300x300' and image => '800x800'
|
25
|
+
# Magento::Params::CreateImage.new(
|
26
|
+
# path: '/path/to/image.jpg',
|
27
|
+
# title: 'REFRIGERANTE PET COCA-COLA 1,5L ORIGINAL',
|
28
|
+
# position: 1
|
29
|
+
# )
|
30
|
+
# ]
|
31
|
+
# )
|
32
|
+
#
|
33
|
+
# Magento::Product.create(params.to_h)
|
34
34
|
#
|
35
35
|
class CreateProduct < Dry::Struct
|
36
36
|
ProductTypes = Type::String.default('simple'.freeze).enum(
|
data/lib/magento/product.rb
CHANGED
@@ -52,6 +52,19 @@ module Magento
|
|
52
52
|
)
|
53
53
|
end
|
54
54
|
|
55
|
+
#
|
56
|
+
# Remove tier price
|
57
|
+
#
|
58
|
+
# product = Magento::Product.find(1)
|
59
|
+
# product.remove_tier_price(quantity: 1, customer_group_id: :all)
|
60
|
+
#
|
61
|
+
# @return {Boolean}
|
62
|
+
def remove_tier_price(quantity:, customer_group_id: :all)
|
63
|
+
self.class.remove_tier_price(
|
64
|
+
sku, quantity: quantity, customer_group_id: customer_group_id
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
55
68
|
# Update product stock
|
56
69
|
#
|
57
70
|
# product = Magento::Product.find('sku')
|
@@ -85,6 +98,17 @@ module Magento
|
|
85
98
|
).parse
|
86
99
|
end
|
87
100
|
|
101
|
+
# Remove tier price
|
102
|
+
#
|
103
|
+
# Product.remove_tier_price('sku', quantity: 1, customer_group_id: :all)
|
104
|
+
#
|
105
|
+
# @return {Boolean}
|
106
|
+
def remove_tier_price(sku, quantity:, customer_group_id: :all)
|
107
|
+
request.delete(
|
108
|
+
"products/#{sku}/group-prices/#{customer_group_id}/tiers/#{quantity}"
|
109
|
+
).parse
|
110
|
+
end
|
111
|
+
|
88
112
|
# Update product stock
|
89
113
|
#
|
90
114
|
# Magento::Product.update_stock(sku, id, {
|
data/lib/magento/version.rb
CHANGED