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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b2408f7d630a838f697a67fd49e5c9821cb3876867ac1ca3bd895b7907aed3d
4
- data.tar.gz: a96cf27ae84be012af63fcb7a85c012680abfcc8a605317176d30b306b75099e
3
+ metadata.gz: 2212acd226570a0dc73fc66683290aca3469006680b1e7946f3426177d0368a3
4
+ data.tar.gz: 1b3029f0f0eb3f0c6b583e4c025f8ab5d53dba8bfeed197e6e8ffc3c08ebf473
5
5
  SHA512:
6
- metadata.gz: 11472a37cda254fdec29a954cb96255326bf10abe0d50c2ef5befb2ebf894e446c5d89faec168fd010949edc7a7b009a8ed4aeddebf63a7152f4cf2b2eb52395
7
- data.tar.gz: f3d20a4db9adddd584271fc653cffedd9131db1b4ed2d1fa5cdadf18cc48e6086cb3a6e940e2eaee0cc40639071e384442e92535209078d006d30e2c966b20c4
6
+ metadata.gz: 6d4b55ba92ddfe5e7831da80ccdf170139a6b8f3459be07d35bfc877ee0638cbcaf15f98d7215f01b017510bb4d8458cf45e229acca7b3dc5d5fa2054e8f00b1
7
+ data.tar.gz: e35feff6cb0a82ece59cf57cb4bde0b0f9d7ea5989ff307c17211045fee78fff1dafbbcc8aaec34be3249e14c784679569d2d9d8dfc773124033592cc82189cf
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Add in your Gemfile
6
6
 
7
7
  ```rb
8
- gem 'magento', '~> 0.22.0'
8
+ gem 'magento', '~> 0.23.0'
9
9
  ```
10
10
 
11
11
  or run
@@ -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::Product.create(params.to_h)
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(
@@ -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, {
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.22.0'
2
+ VERSION = '0.23.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.22.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria