active_fulfillment 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  = ActiveFulfillment CHANGELOG
2
2
 
3
+ == Version 1.0.2 (Jan 12, 2010)
4
+
5
+ * Include "pending" counts in stock levels for Shipwire [wisq]
6
+
3
7
  == Version 1.0.1 (Dec 13, 2010)
4
8
 
5
9
  * Updated common files with changes from activemerchant [Dennis Theisen]
@@ -8,7 +12,7 @@
8
12
 
9
13
  == Version 1.0.0 (July 12, 2010)
10
14
 
11
- * Add inventory support to Amazon and Webgistix [Adrian Irving-Beer]
15
+ * Add inventory support to Amazon and Webgistix [wisq]
12
16
 
13
17
  == Version 0.10.0 (July 6, 2010)
14
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_fulfillment}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cody Fauser", "James MacAulay"]
@@ -196,7 +196,8 @@ module ActiveMerchant
196
196
  document = REXML::Document.new(xml)
197
197
  document.root.elements.each do |node|
198
198
  if node.name == 'Product'
199
- response[:stock_levels][node.attributes['code']] = node.attributes['quantity'].to_i
199
+ amount = ['quantity', 'pending'].map { |a| node.attributes[a].to_i }.sum
200
+ response[:stock_levels][node.attributes['code']] = amount
200
201
  else
201
202
  response[node.name.underscore.to_sym] = node.text
202
203
  end
@@ -59,7 +59,17 @@ class ShipwireTest < Test::Unit::TestCase
59
59
  country_node = REXML::XPath.first(xml, "//Country")
60
60
  assert_equal 'US', country_node.text
61
61
  end
62
-
62
+
63
+ def test_stock_levels
64
+ @shipwire.expects(:ssl_post).returns(xml_fixture('shipwire/inventory_get_response'))
65
+
66
+ response = @shipwire.fetch_stock_levels
67
+ assert response.success?
68
+ assert_equal 926, response.stock_levels['BlackDog']
69
+ assert_equal 805, response.stock_levels['MoustacheCat']
70
+ assert_equal 921, response.stock_levels['KingMonkey']
71
+ end
72
+
63
73
  def test_no_tracking_numbers_available
64
74
  @shipwire.expects(:ssl_post).returns(successful_empty_tracking_response)
65
75
  response = @shipwire.fetch_tracking_numbers(['1234'])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fulfillment
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cody Fauser
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-12-13 00:00:00 -05:00
19
+ date: 2010-12-13 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency