magento 0.28.1 → 0.29.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: 47301da95e36321d8fffa288795c6f1743bcec798a9ae89c66428e5497c312ef
4
- data.tar.gz: 1957e42ca2462dd919572b301e3ebccddd1cf48b83a293e3f7ca5c102f178b92
3
+ metadata.gz: 4850d2918cd100c473f235d63ae185e51daf8cd0f94e9670bd660816b8fa2fd8
4
+ data.tar.gz: fd1e48ed85a8c881f6c99a22bd8c0f503c1836e5a59ff56d603ae4cf25b08dd2
5
5
  SHA512:
6
- metadata.gz: 1419c34fd375555ac0898a71db689e0414bfbacc10c40943f4a3d66c0db4baa65bcbe51a3f958fb2fadb0c6bd2cd68385bb6b1172fd401d89f910c8f9249cf23
7
- data.tar.gz: 4b5af9f9f7be9acb29df72835f1d85859f76af5a7ebefc531934cd532d6a389f3b9fbe3ce9212b07844a9996d50769fe1f28a50caa2d5f04a234f3279bcc2e36
6
+ metadata.gz: b4f7f6b02ac69f520cf5dbc28d7cccd351bb284fd6ef7da5d75c67eac31d1267a320d7aa93ae475ee8e08c46006db1d4c8dcc78a984b471df3a1325daf0044b4
7
+ data.tar.gz: 55c473b7835f4725c3bab994a84f494d61f677b7ace0a79f03c942f6e2435883f4103d71c2cf2e3c184cd70ccc0a0b35bbfb71512994c32d7c85d14316d0778a
data/README.md CHANGED
@@ -77,7 +77,7 @@ Ruby library to consume the magento 2 api
77
77
  Add in your Gemfile
78
78
 
79
79
  ```rb
80
- gem 'magento', '~> 0.28.1'
80
+ gem 'magento', '~> 0.29.0'
81
81
  ```
82
82
 
83
83
  or run
data/lib/magento/cart.rb CHANGED
@@ -31,6 +31,27 @@ module Magento
31
31
  self.class.delete_coupon(id)
32
32
  end
33
33
 
34
+ #
35
+ # Place order for cart
36
+ #
37
+ # Example:
38
+ #
39
+ # cart = Magento::Cart.find('12345')
40
+ #
41
+ # # or use "build" to not request information from the magento API
42
+ # cart = Magento::GuestCart.build({ 'cart_id' => '12345' })
43
+ #
44
+ # cart.order(
45
+ # email: 'customer@gmail.com',
46
+ # payment: { method: 'cashondelivery' }
47
+ # )
48
+ #
49
+ # @return String: return the order id
50
+ def order(email:, payment:)
51
+ attributes = { cartId: id, paymentMethod: payment, email: email }
52
+ self.class.order(attributes)
53
+ end
54
+
34
55
  class << self
35
56
  #
36
57
  # Add a coupon by code to a specified cart.
@@ -60,6 +81,24 @@ module Magento
60
81
  url = "#{api_resource}/#{id}/coupons"
61
82
  request.delete(url).parse
62
83
  end
84
+
85
+ #
86
+ # Place order for cart
87
+ #
88
+ # Example:
89
+ #
90
+ # Magento::Cart.order(
91
+ # cartId: '12345',
92
+ # paymentMethod: { method: 'cashondelivery' },
93
+ # email: email
94
+ # )
95
+ #
96
+ # @return String: return the order id
97
+ def order(attributes)
98
+ attributes.transform_keys(&:to_sym)
99
+ url = "#{api_resource}/#{attributes[:cartId]}/order"
100
+ request.put(url, attributes).parse
101
+ end
63
102
  end
64
103
  end
65
104
  end
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.28.1'
2
+ VERSION = '0.29.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.28.1
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria