gentle 0.2.0 → 0.3

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
  SHA1:
3
- metadata.gz: ac1168e00550479a4f358c13eedfb72000994ad3
4
- data.tar.gz: 9bf880dbdc5a3d542b5ec0ed0b589b03dded03c2
3
+ metadata.gz: f32f0c7a6f1a1b865917abd975208a9348f637d0
4
+ data.tar.gz: 05243d09565638e9e54c3a19b9ee1327083059fa
5
5
  SHA512:
6
- metadata.gz: 0cba459dd7c952479b79e822864c5952cb8a2454b3617ac3e7c61f3cfe2f52741e871cfe56198876c7736b30244d7523cf339faa88cf12ed5892c5d2a58c5089
7
- data.tar.gz: eba1ea53a4c8438ea4ebff136c3bf35e599c9f6778beb044aa9e8b36be4c3907f9dba513bfcc9d6ee0dfcf9e2689fc32b918315b4c34852f77d0cc1c38960893
6
+ metadata.gz: fd2052df7216f4cc139239272236b1f3343168822bda7f61cb2b24cbc5aaf09e318125b56477d4bcd266daa9b076a796dff2190f42b9327d59480d1072697acf
7
+ data.tar.gz: d469b745417d673de1a052d15407b172cfe4bbaa784f0928da1da16dab7ea6769a91c4f974ddd39681bc052e77c19f30f035be97b4fbec06de7cb858cf1cf9a2
@@ -31,11 +31,11 @@ module Gentle
31
31
  'Warehouse' => warehouse,
32
32
  'TrackingNumber' => @rma.tracking_number) do
33
33
 
34
- @rma.returned_items.each do |returned_item|
35
- xml.Line('LineNo' => returned_item.line_item_id,
34
+ @rma.returned_items.each_with_index do |returned_item, line_number|
35
+ xml.Line('LineNo' => line_number + 1,
36
36
  'OrderNumber' => @order.number,
37
37
  'ItemNumber' => returned_item.sku,
38
- 'Quantity' => returned_item.quantity,
38
+ 'Quantity' => 1,
39
39
  'SaleUOM' => 'EA', #Each
40
40
  'ReturnReason' => @rma.reason.name,
41
41
  'CustomerComment' => ''
@@ -1,3 +1,3 @@
1
1
  module Gentle
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3"
3
3
  end
@@ -17,7 +17,7 @@
17
17
  ServiceLevel="FIRST"
18
18
  TrackingId="40000000000"
19
19
  Weight="0.66">
20
- <Content Line="1"Quantity="1" />
21
- <Content Line="2"Quantity="1" />
20
+ <Content Line="1" Quantity="1" />
21
+ <Content Line="2" Quantity="1" />
22
22
  </Carton>
23
23
  </SOResult>
@@ -269,33 +269,18 @@ class ReasonDouble
269
269
  end
270
270
  end
271
271
 
272
- class InventoryUnitDouble
273
- attr_accessor :variant, :line_item, :line_item_id
274
-
275
- DEFAULT_OPTIONS = {
276
- line_item_id: 1,
277
- line_item: LineItemDouble.example,
278
- variant: VariantDouble.example
279
- }
280
- def initialize(options = {})
281
- @line_item_id = options[:line_item_id]
282
- @line_item = options[:line_item]
283
- @variant = options[:variant]
284
- end
285
- def self.example(options = {})
286
- self.new(DEFAULT_OPTIONS.merge(options))
287
- end
288
- end
289
272
 
290
273
  class ReturnItemDouble
291
- attr_accessor :inventory_unit
274
+ attr_accessor :sku
292
275
 
293
276
  DEFAULT_OPTIONS = {
294
- inventory_unit: InventoryUnitDouble.example,
277
+ sku: "ABC-123",
295
278
  }
279
+
296
280
  def initialize(options = {})
297
- @inventory_unit = options[:inventory_unit]
281
+ @sku = options[:sku]
298
282
  end
283
+
299
284
  def self.example(options = {})
300
285
  self.new(DEFAULT_OPTIONS.merge(options))
301
286
  end
@@ -303,6 +288,7 @@ end
303
288
 
304
289
  class RMADouble
305
290
  attr_accessor :return_items, :order, :config, :reason, :number, :tracking_number, :created_at
291
+ alias_method :returned_items, :return_items
306
292
 
307
293
  DEFAULT_OPTIONS = {
308
294
  number: 'RMA1234567',
@@ -37,17 +37,28 @@ module Gentle
37
37
 
38
38
  line_items = document.css('Line')
39
39
  assert_equal 1, line_items.length
40
- assert_line_item(@order.line_items.first, line_items.first)
40
+ assert_line_item("1", @order.line_items.first, line_items.first)
41
41
  end
42
42
 
43
+ it "should create 1 line for each returned item" do
44
+ @rma.return_items = [ReturnItemDouble.example, ReturnItemDouble.example]
45
+ @object = @RMADocument = RMADocument.new(config: @config, rma: @rma)
46
+
47
+ document = Nokogiri::XML::Document.parse(@RMADocument.to_xml)
48
+ line_items = document.css('Line')
49
+ assert_equal 2, line_items.length
50
+ assert_line_item("1", @order.line_items.first, line_items.first)
51
+ assert_line_item("2", @order.line_items.first, line_items.last)
52
+
53
+ end
43
54
 
44
55
  private
45
56
 
46
- def assert_line_item(expected_line_item, line_item)
47
- assert_equal "1", line_item['LineNo']
57
+ def assert_line_item(line_number, expected_line_item, line_item)
58
+ assert_equal line_number, line_item['LineNo']
48
59
  assert_equal @order.number, line_item['OrderNumber']
49
60
  assert_equal expected_line_item.sku.to_s, line_item['ItemNumber']
50
- assert_equal expected_line_item.quantity.to_s, line_item['Quantity']
61
+ assert_equal "1", line_item['Quantity']
51
62
  assert_equal "EA", line_item['SaleUOM']
52
63
  assert_equal @rma.reason.name, line_item['ReturnReason']
53
64
  assert_equal "", line_item['CustomerComment']
@@ -14,7 +14,7 @@ module Gentle
14
14
  assert_equal 'Gentle', order_result.client_id
15
15
  assert_equal 'Gentle', order_result.business_unit
16
16
  assert_equal 1, order_result.carton_count
17
- assert_equal Time.new(2009, 9, 1, 0, 0, 0).utc, order_result.date_shipped
17
+ assert_equal Time.utc(2009, 9, 1, 4, 0, 0), order_result.date_shipped
18
18
 
19
19
  assert_equal "40000000000", order_result.tracking_number
20
20
  assert_equal "FIRST", order_result.service_level
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gentle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - DynamoMTL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.4.5.1
177
+ rubygems_version: 2.4.5
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Integrates with QL Blackboard and work Queue
@@ -197,4 +197,3 @@ test_files:
197
197
  - spec/unit/message_spec.rb
198
198
  - spec/unit/phase_1_set_spec.rb
199
199
  - spec/unit/queue_spec.rb
200
- has_rdoc: