ruby_omx 0.0.27 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,9 +16,10 @@ module RubyOmx
16
16
  raise MissingRequestOptions if required_fields.any? { |option| attrs[option].nil? }
17
17
  super
18
18
  self.version = attrs[:version] ||= '1.00'
19
+ self.type = attrs[:keycode] ? 'Keycode' : 'DefaultPrice' # There are only 2 options, and if keycode is provided, it must be of type keycode, otherwise default
19
20
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'ItemCode', :value=>attrs[:item_code]})
21
+ self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'Type', :value=>self.type})
20
22
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'Keycode', :value=>attrs[:keycode]}) if attrs[:keycode]
21
- self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'Type', :value=>attrs[:type]}) if attrs[:type]
22
23
  self.price_points = attrs[:price_points].collect { |h| PricePoint.new(h) }
23
24
  end
24
25
 
@@ -6,6 +6,8 @@ module RubyOmx
6
6
  xml_accessor :incomplete_flag #<IncompleteFlag>True</IncompleteFlag>
7
7
  xml_accessor :product_name #<ProductName>Deluxe Princess Fiona™ Child</ProductName>
8
8
  xml_accessor :product_group, :as=>Integer #<ProductGroup>45</ProductGroup>
9
+ xml_accessor :weight, :as=>Float
10
+ xml_accessor :shipping_weight, :as=>Float
9
11
  xml_accessor :cost_of_goods, :as=>Float #<CostOfGoods>10</CostOfGoods>
10
12
  xml_accessor :upc_code, :from=>'UPCCode' #<UPCCode></UPCCode>
11
13
  xml_accessor :accounting_reference #<AccountingReference></AccountingReference>
@@ -1,3 +1,3 @@
1
1
  module RubyOmx
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
data/test/real_test.rb CHANGED
@@ -9,31 +9,71 @@ class RealTestTest < MiniTest::Unit::TestCase
9
9
  @line2 = { :item_code=>'APPLE-12', :quantity => 31, :price => 1.50 }
10
10
  end
11
11
  =begin
12
- def test_real_item_update
13
- request_attrs = {:items=> [{
14
- :item_code => '1234567890123451043235234234',
15
- :product_status=>'True',
16
- :incomplete_flag=>'False',
17
- :product_name=>'Apple Product',
18
- :product_group=>45,
19
- :cost_of_goods=>10,
20
- :upc_code=>'234234234',
21
- :allow_order_line_info=>'True',
22
- :launch_date=>'2/23/2006',
23
- :file_sub_code=>20,
24
- :inventory_product_flag=>'True',
25
- :tax_code=>'TC4',
26
- :inventory_type=>3,
27
- :drop_ship_file_sub_code=>31 }]}
12
+ def test_item_update
13
+ request_attrs = {:items=>[{
14
+ :item_code=>"73080U.GNM.2",
15
+ :product_status=>"True",
16
+ :incomplete_flag=>"False",
17
+ :product_name=>"Sugoi Men's RSE Jacket Gunmetal S",
18
+ :product_group=>1,
19
+ :weight=>0.6,
20
+ :shipping_weight=>0.6,
21
+ :cost_of_goods=>125.0,
22
+ :upc_code=>nil,
23
+ :allow_order_line_info=>"True",
24
+ :launch_date=>"08/23/2012 03:14:37 PM",
25
+ :file_sub_code=>0,
26
+ :inventory_product_flag=>"True",
27
+ :tax_code=>"TC1",
28
+ :inventory_type=>1,
29
+ :inventory_manager=>"AMCLEAN",
30
+ :drop_ship_file_sub_code=>0,
31
+ :order_split_flag=>"True",
32
+ :inventory_warning_ooi=>"True",
33
+ :inventory_warning_loi=>"True"}]}
28
34
 
29
35
  r = @connection.build_item_update_request(request_attrs)
30
36
  assert_instance_of String, r.to_xml.to_s
37
+ puts r.to_xml.to_s
31
38
 
32
39
  response = @connection.append_item(request_attrs)
33
40
  puts response.to_s
34
41
  assert_kind_of ItemUpdateResponse, response
35
42
  end
43
+
44
+ def test_supplier_item_update
45
+ request_attrs =
46
+ request_attrs = {:items=>[{
47
+ :item_code=>"73080U.GNM.2",
48
+ :supplier_id=>"1120",
49
+ :supplier_item_code=>"73080U.GNM.2",
50
+ :standard_price=>125.0}]}
36
51
 
52
+ r = @connection.build_supplier_item_update_request(request_attrs)
53
+ assert_instance_of String, r.to_xml.to_s
54
+ puts r.to_xml.to_s
55
+
56
+ response = @connection.append_supplier_item(request_attrs)
57
+ puts response.to_s
58
+ assert_kind_of SupplierItemUpdateResponse, response
59
+ end
60
+
61
+ def test_item_price_update
62
+ request_attrs = {
63
+ :item_code=>"73080U.GNM.2",
64
+ :price_type=>"unit",
65
+ :quantity_type=>"restricted",
66
+ :price_points=>[{:quantity=>1, :price=>249.95, :shipping_handling=>0.0}]
67
+ }
68
+ r = @connection.build_item_price_update_request(request_attrs)
69
+ assert_instance_of String, r.to_xml.to_s
70
+ puts r.to_xml.to_s
71
+
72
+ response = @connection.append_item_price(request_attrs)
73
+ puts response.to_s
74
+ assert_kind_of ItemPriceUpdateResponse, response
75
+ end
76
+
37
77
  def test_real_purchase_order
38
78
  po_data = { :line_items => [@line1, @line2], :supplier_id => '76' }
39
79
  r = @connection.build_purchase_order_update_request(po_data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_omx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-21 00:00:00.000000000 Z
12
+ date: 2012-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: roxml