magento 0.14.0 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3df17670fd9bcb57f90cdb5cfdb17f098fc2e68676b32205d60db11609fdc346
4
- data.tar.gz: 7ab232a58616a24b0b1c672d3d5d8e8510eda79c4f72b7baf85950d3c06f7895
3
+ metadata.gz: 0d7a340d50d7233fcb8e0eb877d49e1c29e0785fb76413c2216bf79c86bb420b
4
+ data.tar.gz: 6c1ad15d2b246e145d7d83082749431d89303f9c82a6fe74dd525ed52615fe28
5
5
  SHA512:
6
- metadata.gz: b3486c69930399a5b002ca33f014f1e5abc725c741d125790588bdadd472855b9858c6d1a596b07ac6e4e63e4069954bf75cc77b391ec06aec900fc868d5048f
7
- data.tar.gz: 17f02541d592aa6fdc1211685bb0163bbaadb59f4f31d635b5b894a3f37c22082b19a8e55bbefc383831f8617c818685a23813648723adf6a6f380c1378d5162
6
+ metadata.gz: a1e2e8fc442888fc6cd2e45f16d10186a1abf86ca990517cd0b9dbba60b2a57d015c9af2dc25e93d492413491cc4e7e1c37efa479c8e74581ce319b5d623a1ec
7
+ data.tar.gz: 219111f025c6189e6c83605e6a08f0479e1080e7ae40ff8f740aa0190df298ab71ef3b1c6c8a3757466e5a74b4d78e64c50827ad84da0a7b1a47774e6571aff8
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Add in your Gemfile
6
6
 
7
7
  ```rb
8
- gem 'magento', '~> 0.14.0'
8
+ gem 'magento', '~> 0.15.0'
9
9
  ```
10
10
 
11
11
  or run
@@ -350,6 +350,17 @@ Magento::GuestCart.add_coupon('gXsepZcgJbY8RCJXgGioKOO9iBCR20r7', 'COAU4HXE0I')
350
350
  >> true # return true on success
351
351
  ```
352
352
 
353
+ Delete coupon from cart
354
+ ```rb
355
+ cart = Magento::GuestCart.find('gXsepZcgJbY8RCJXgGioKOO9iBCR20r7')
356
+
357
+ cart.delete_coupon()
358
+ # You can also use the class method
359
+ Magento::GuestCart.delete_coupon('gXsepZcgJbY8RCJXgGioKOO9iBCR20r7')
360
+
361
+ >> true # return true on success
362
+ ```
363
+
353
364
  ## Invoice an Order
354
365
 
355
366
  ```rb
@@ -551,7 +562,7 @@ rule = Magento::SalesRule.create(
551
562
  rule.generate_coupon(quantity: 1, length: 10)
552
563
  ```
553
564
 
554
- Renarate by class method
565
+ Generate by class method
555
566
  ```rb
556
567
  Magento::SalesRule.generate_coupon(
557
568
  couponSpec: {
@@ -564,6 +575,8 @@ Magento::SalesRule.generate_coupon(
564
575
  see all params in:
565
576
  - [Magento docs Coupon](https://magento.redoc.ly/2.3.5-admin/tag/couponsgenerate#operation/salesRuleCouponManagementV1GeneratePost)
566
577
  - [Magento docs SalesRules](https://magento.redoc.ly/2.3.5-admin/tag/salesRules#operation/salesRuleRuleRepositoryV1SavePost)
578
+
579
+ See [how to add coupons to cart](#guestcart)
567
580
 
568
581
  ### First result
569
582
  ```rb
@@ -44,6 +44,17 @@ module Magento
44
44
  self.class.add_coupon(cart_id, coupon)
45
45
  end
46
46
 
47
+ # Delete cart's coupon
48
+ #
49
+ # Example:
50
+ # cart = Magento::GuestCart.find('gXsepZcgJbY8RCJXgGioKOO9iBCR20r7')
51
+ # cart.delete_coupon()
52
+ #
53
+ # @return Boolean: true on success, raise exception otherwise
54
+ def delete_coupon
55
+ self.class.delete_coupon(cart_id)
56
+ end
57
+
47
58
  class << self
48
59
  def create(load_cart_info: false)
49
60
  cart = build(cart_id: request.post(api_resource).parse)
@@ -91,6 +102,18 @@ module Magento
91
102
  url = "#{api_resource}/#{id}/coupons/#{coupon}"
92
103
  request.put(url, nil).parse
93
104
  end
105
+
106
+ #
107
+ # Delete a coupon from a specified cart.
108
+ #
109
+ # Example:
110
+ # Magento::GuestCart.delete_coupon('aj8oUtY1Qi44Fror6UWVN7ftX1idbBKN')
111
+ #
112
+ # @return Boolean: true on success, raise exception otherwise
113
+ def delete_coupon(id)
114
+ url = "#{api_resource}/#{id}/coupons"
115
+ request.delete(url).parse
116
+ end
94
117
  end
95
118
  end
96
119
  end
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.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.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria