magento 0.18.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bab9845aefc480901b6d4fae6181054bcb4337f52c7ecdcb5c43d9256489c498
4
- data.tar.gz: 31510059e22ae9c29eb9ad8d134122342fc58330ca6f382867f530e700035aef
3
+ metadata.gz: bd6a94c17db3ebc55bcc96cbae5118128326e3d7ca2d0e96bfb5b530edea5561
4
+ data.tar.gz: a0e86d4bc16f5c4338281fcadb07ee62f18017cc59bcd89cb15804110472021c
5
5
  SHA512:
6
- metadata.gz: 7a03f247c66668011492453cc90e146968cc39c1ead0dc8823593187f3169a5cd63885f0d5bc53abd781840520df0a7c026228fcf9a501f8338ea342b7874ab7
7
- data.tar.gz: cce4a8ee5d5abe1b4c6d2f93e11aa21b5724e6965c9c6812a31020967c56d8b572ef2e92012346b7848de2da3e9e56189be663b0a9a05ae7155d75e29712a272
6
+ metadata.gz: 1a7ebe7b9a4b24d0644ef31ddaee95ff17c07e702f001ec18ad632886e538187ff5a02ef841fe648d8c5eb0a5348b13579a15c9450c9442ad08f5fd29c17333f
7
+ data.tar.gz: 3252ea89c262918fce7b206e842197510929e1acb998da5613ba8f7d37f4f68de4b0cde29e765199f0bb0f177882dd33bd16efe98454231e909ee3cd3cb76b34
@@ -3,8 +3,6 @@ name: Ruby Gem
3
3
  on:
4
4
  push:
5
5
  branches: [ release ]
6
- pull_request:
7
- branches: [ release ]
8
6
 
9
7
  jobs:
10
8
  build:
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Add in your Gemfile
6
6
 
7
7
  ```rb
8
- gem 'magento', '~> 0.15.1'
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.18.1'
2
+ VERSION = '0.19.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magento
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria