magento 0.25.0 → 0.26.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: 39351f6f0160cca4294ba7f1eb49a9d45ad4928f23c1e16a119ea15a9d35de76
4
- data.tar.gz: 0b57db15034198ca599d545966b63aaf535675a0ba122f0056f823617395e163
3
+ metadata.gz: 05b964b40491a1dc85eab1440137ab38089116468c2bd1d4d3fc86cd63a2c106
4
+ data.tar.gz: 38f1348057912147922411e91494621e3fc8ad7047b6c275f5ce9be9d67b3eb7
5
5
  SHA512:
6
- metadata.gz: aaa7594c1b4d21fc2585552ce9187ce33a9b4605c6809d5d735c4ea82269f5acef51ae370e43688a16cf04faf826cf990f280dc005a010329d01be2214d86341
7
- data.tar.gz: 0f07ba186842264c655e32637c48f8fdf557e8f6c97cbe5914cbb4ed5c3657308e41dc22e379de235ed97c38cd194fb27b8c613acccf0cbbb92d1a379e31f883
6
+ metadata.gz: ea2acea7866041af1c49d8d453fc52c483aa4d0d9e99bc3620447e50630f6e0aec0724a29536fc1f3e9081c88684b6f4a83a9c1b3c9ac6ef1e71fdf662e4478c
7
+ data.tar.gz: 69593620dfafef7a3e2290471afc6278e4de583cb3762b23a0c891d63680df3d694e2bdbfda05caff0651b907cd6648938e37ca7a7d6f2ce5cecbb8635e49da1
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Add in your Gemfile
6
6
 
7
7
  ```rb
8
- gem 'magento', '~> 0.25.0'
8
+ gem 'magento', '~> 0.26.0'
9
9
  ```
10
10
 
11
11
  or run
@@ -61,6 +61,10 @@ module Magento
61
61
  self.class.ship(id, params)
62
62
  end
63
63
 
64
+ def send_email
65
+ self.class.send_email(id)
66
+ end
67
+
64
68
  class << self
65
69
  def update(entity_id, attributes)
66
70
  attributes[:entity_id] = entity_id
@@ -172,6 +176,10 @@ module Magento
172
176
  def ship(order_id, shipment_params = nil)
173
177
  request.post("order/#{order_id}/ship", shipment_params).parse
174
178
  end
179
+
180
+ def send_email(order_id)
181
+ request.post("orders/#{order_id}/emails").parse
182
+ end
175
183
  end
176
184
  end
177
185
  end
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.25.0'
2
+ VERSION = '0.26.0'
3
3
  end
@@ -0,0 +1,38 @@
1
+ class RequestMock
2
+ attr_reader :path
3
+
4
+ def post(path)
5
+ @path = path
6
+ OpenStruct.new(success?: true, parse: true)
7
+ end
8
+ end
9
+
10
+ RSpec.describe Magento::Order do
11
+ before { Magento.url = 'https://site.com' }
12
+
13
+ describe '.send_email' do
14
+ it 'shuld request POST /orders/:id/emails' do
15
+ request = RequestMock.new
16
+ allow(Magento::Order).to receive(:request).and_return(request)
17
+
18
+ order_id = 25
19
+ result = Magento::Order.send_email(order_id)
20
+
21
+ expect(request.path).to eql("orders/#{order_id}/emails")
22
+ expect(result).to be true
23
+ end
24
+ end
25
+
26
+ describe '#send_email' do
27
+ it 'shuld request POST /orders/:id/emails' do
28
+ request = RequestMock.new
29
+ allow(Magento::Order).to receive(:request).and_return(request)
30
+
31
+ order = Magento::Order.build(id: 25)
32
+ result = order.send_email
33
+
34
+ expect(request.path).to eql("orders/25/emails")
35
+ expect(result).to be true
36
+ end
37
+ end
38
+ 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.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria
@@ -156,6 +156,7 @@ files:
156
156
  - lib/magento/shared/value.rb
157
157
  - lib/magento/version.rb
158
158
  - magento.gemspec
159
+ - spec/magento/order_spec.rb
159
160
  - spec/magento_spec.rb
160
161
  - spec/product_spec.rb
161
162
  - spec/spec_helper.rb