magento 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +0 -2
- data/README.md +18 -1
- data/lib/magento/product.rb +30 -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: bd6a94c17db3ebc55bcc96cbae5118128326e3d7ca2d0e96bfb5b530edea5561
|
4
|
+
data.tar.gz: a0e86d4bc16f5c4338281fcadb07ee62f18017cc59bcd89cb15804110472021c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7ebe7b9a4b24d0644ef31ddaee95ff17c07e702f001ec18ad632886e538187ff5a02ef841fe648d8c5eb0a5348b13579a15c9450c9442ad08f5fd29c17333f
|
7
|
+
data.tar.gz: 3252ea89c262918fce7b206e842197510929e1acb998da5613ba8f7d37f4f68de4b0cde29e765199f0bb0f177882dd33bd16efe98454231e909ee3cd3cb76b34
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Add in your Gemfile
|
6
6
|
|
7
7
|
```rb
|
8
|
-
gem 'magento', '~> 0.
|
8
|
+
gem 'magento', '~> 0.19.0'
|
9
9
|
```
|
10
10
|
|
11
11
|
or run
|
@@ -83,6 +83,23 @@ product.respond_to? :description
|
|
83
83
|
> true
|
84
84
|
```
|
85
85
|
|
86
|
+
## add tier price
|
87
|
+
|
88
|
+
Add `price` on product `sku` for specified `customer_group_id`
|
89
|
+
|
90
|
+
Param `quantity` is the minimun amount to apply the price
|
91
|
+
|
92
|
+
```rb
|
93
|
+
product = Magento::Product.find(1)
|
94
|
+
product.add_tier_price(3.99, quantity: 1, customer_group_id: :all)
|
95
|
+
> true
|
96
|
+
|
97
|
+
# OR
|
98
|
+
|
99
|
+
Magento::Product.add_tier_price(1, 3.99, quantity: 1, customer_group_id: :all)
|
100
|
+
> true
|
101
|
+
```
|
102
|
+
|
86
103
|
## Get List
|
87
104
|
|
88
105
|
```rb
|
data/lib/magento/product.rb
CHANGED
@@ -25,6 +25,25 @@ module Magento
|
|
25
25
|
self.class.remove_media(sku, media_id)
|
26
26
|
end
|
27
27
|
|
28
|
+
#
|
29
|
+
# Add {price} on product {sku} for specified {customer_group_id}
|
30
|
+
#
|
31
|
+
# Param {quantity} is the minimun amount to apply the price
|
32
|
+
#
|
33
|
+
# product = Magento::Product.find(1)
|
34
|
+
# product.add_tier_price(3.99, quantity: 1, customer_group_id: :all)
|
35
|
+
#
|
36
|
+
# OR
|
37
|
+
#
|
38
|
+
# Magento::Product.add_tier_price(1, 3.99, quantity: 1, customer_group_id: :all)
|
39
|
+
#
|
40
|
+
# @return {Boolean}
|
41
|
+
def add_tier_price(price, quantity:, customer_group_id: :all)
|
42
|
+
self.class.add_tier_price(
|
43
|
+
sku, price, quantity: quantity, customer_group_id: customer_group_id
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
28
47
|
class << self
|
29
48
|
alias_method :find_by_sku, :find
|
30
49
|
|
@@ -36,6 +55,17 @@ module Magento
|
|
36
55
|
def remove_media(sku, media_id)
|
37
56
|
request.delete("products/#{sku}/media/#{media_id}").parse
|
38
57
|
end
|
58
|
+
|
59
|
+
# Add {price} on product {sku} for specified {customer_group_id}
|
60
|
+
#
|
61
|
+
# Param {quantity} is the minimun amount to apply the price
|
62
|
+
#
|
63
|
+
# @return {Boolean}
|
64
|
+
def add_tier_price(sku, price, quantity:, customer_group_id: :all)
|
65
|
+
request.post(
|
66
|
+
"products/#{sku}/group-prices/#{customer_group_id}/tiers/#{quantity}/price/#{price}"
|
67
|
+
).parse
|
68
|
+
end
|
39
69
|
end
|
40
70
|
end
|
41
71
|
end
|
data/lib/magento/version.rb
CHANGED