channel_advisor 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/README +46 -0
  2. data/lib/channel_advisor/admin_service/client.rb +63 -0
  3. data/lib/channel_advisor/admin_service/mapping_registry.rb +206 -0
  4. data/lib/channel_advisor/admin_service/types.rb +175 -0
  5. data/lib/channel_advisor/admin_service.rb +14 -0
  6. data/lib/channel_advisor/auth_handler.rb +21 -0
  7. data/lib/channel_advisor/cart_service/client.rb +79 -0
  8. data/lib/channel_advisor/cart_service/mapping_registry.rb +344 -0
  9. data/lib/channel_advisor/cart_service/types.rb +386 -0
  10. data/lib/channel_advisor/cart_service.rb +14 -0
  11. data/lib/channel_advisor/errors.rb +13 -0
  12. data/lib/channel_advisor/inventory_service/client.rb +223 -0
  13. data/lib/channel_advisor/inventory_service/mapping_registry.rb +1765 -0
  14. data/lib/channel_advisor/inventory_service/types.rb +1708 -0
  15. data/lib/channel_advisor/inventory_service.rb +14 -0
  16. data/lib/channel_advisor/listing_service/client.rb +55 -0
  17. data/lib/channel_advisor/listing_service/mapping_registry.rb +153 -0
  18. data/lib/channel_advisor/listing_service/types.rb +125 -0
  19. data/lib/channel_advisor/listing_service.rb +14 -0
  20. data/lib/channel_advisor/marketplace_ad_service/client.rb +71 -0
  21. data/lib/channel_advisor/marketplace_ad_service/mapping_registry.rb +334 -0
  22. data/lib/channel_advisor/marketplace_ad_service/types.rb +317 -0
  23. data/lib/channel_advisor/marketplace_ad_service.rb +14 -0
  24. data/lib/channel_advisor/message_code.rb +30 -0
  25. data/lib/channel_advisor/order_service/client.rb +111 -0
  26. data/lib/channel_advisor/order_service/mapping_registry.rb +1696 -0
  27. data/lib/channel_advisor/order_service/types.rb +1781 -0
  28. data/lib/channel_advisor/order_service.rb +14 -0
  29. data/lib/channel_advisor/service_proxy.rb +62 -0
  30. data/lib/channel_advisor/shared_requires.rb +11 -0
  31. data/lib/channel_advisor/shipping_service/client.rb +79 -0
  32. data/lib/channel_advisor/shipping_service/mapping_registry.rb +500 -0
  33. data/lib/channel_advisor/shipping_service/types.rb +431 -0
  34. data/lib/channel_advisor/shipping_service.rb +14 -0
  35. data/lib/channel_advisor/store_service/client.rb +55 -0
  36. data/lib/channel_advisor/store_service/mapping_registry.rb +250 -0
  37. data/lib/channel_advisor/store_service/types.rb +180 -0
  38. data/lib/channel_advisor/store_service.rb +14 -0
  39. data/lib/channel_advisor/tax_service/client.rb +55 -0
  40. data/lib/channel_advisor/tax_service/mapping_registry.rb +233 -0
  41. data/lib/channel_advisor/tax_service/types.rb +221 -0
  42. data/lib/channel_advisor/tax_service.rb +14 -0
  43. data/lib/channel_advisor.rb +4 -0
  44. data/spec/integration/inventory_sync_spec.rb +55 -0
  45. data/spec/lib/channel_advisor/admin_service_spec.rb +12 -0
  46. data/spec/lib/channel_advisor/auth_handler_spec.rb +46 -0
  47. data/spec/lib/channel_advisor/cart_service_spec.rb +12 -0
  48. data/spec/lib/channel_advisor/errors_spec.rb +23 -0
  49. data/spec/lib/channel_advisor/inventory_service_spec.rb +12 -0
  50. data/spec/lib/channel_advisor/marketplace_ad_service_spec.rb +12 -0
  51. data/spec/lib/channel_advisor/message_code_spec.rb +40 -0
  52. data/spec/lib/channel_advisor/order_service_spec.rb +12 -0
  53. data/spec/lib/channel_advisor/service_proxy_spec.rb +130 -0
  54. data/spec/lib/channel_advisor/shipping_service_spec.rb +12 -0
  55. data/spec/lib/channel_advisor/store_service_spec.rb +12 -0
  56. data/spec/lib/channel_advisor/tax_service_spec.rb +12 -0
  57. data/spec/spec.opts +2 -0
  58. data/spec/spec_helper.rb +4 -0
  59. metadata +170 -0
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::MessageCode do
4
+ it "defines known message codes" do
5
+ message_code = ChannelAdvisor::MessageCode.get(0)
6
+ message_code.code.should == 0
7
+ message_code.message.should == 'Success'
8
+
9
+ message_code = ChannelAdvisor::MessageCode.get(1)
10
+ message_code.code.should == 1
11
+ message_code.message.should == 'Unexpected'
12
+
13
+ message_code = ChannelAdvisor::MessageCode.get(3)
14
+ message_code.code.should == 3
15
+ message_code.message.should == 'No Account ID value was specified'
16
+
17
+ message_code = ChannelAdvisor::MessageCode.get(5)
18
+ message_code.code.should == 5
19
+ message_code.message.should == 'No Sku value was specified'
20
+
21
+ message_code = ChannelAdvisor::MessageCode.get(8)
22
+ message_code.code.should == 8
23
+ message_code.message.should == 'The number of Sku values specified was greater than the maximum amount allowed by the method definition'
24
+ end
25
+
26
+ it "accepts codes as strings" do
27
+ message_code = ChannelAdvisor::MessageCode.get('0')
28
+ message_code.code.should == 0
29
+ end
30
+
31
+ it "returns an unknown code if the code is not defined" do
32
+ message_code = ChannelAdvisor::MessageCode.get('12')
33
+ message_code.code.should == 12
34
+ message_code.message.should == 'Unknown Error'
35
+ end
36
+
37
+ it "uses the class values for get" do
38
+ ChannelAdvisor::MessageCode.get(0).should == ChannelAdvisor::MessageCode::Success
39
+ end
40
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::OrderService do
4
+
5
+ describe "proxy configuration" do
6
+ it "should define soap dependencies" do
7
+ ChannelAdvisor::OrderService::SOAP_CLASS.should == ChannelAdvisor::OrderServiceSOAP::OrderServiceSoap
8
+ ChannelAdvisor::OrderService::SERVICE_MODULE.should == ChannelAdvisor::OrderServiceSOAP
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,130 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::ServiceProxy do
4
+
5
+ describe "generated methods" do
6
+
7
+ before(:each) do
8
+ configatron.channel_advisor.account_id = 'test_account_id'
9
+ @client = mock(ChannelAdvisor::InventoryServiceSOAP::InventoryServiceSoap)
10
+ @client.should_receive(:headerhandler).and_return([])
11
+
12
+ @ssl_config = mock(Object)
13
+ @ssl_config.stub!(:verify_mode=)
14
+ @streamhandler_client = mock(Object)
15
+ @streamhandler_client.stub!(:ssl_config).and_return(@ssl_config)
16
+ @streamhandler = mock(Object)
17
+ @streamhandler.stub!(:client).and_return(@streamhandler_client)
18
+ @client.stub!(:streamhandler).and_return(@streamhandler)
19
+
20
+ ChannelAdvisor::InventoryServiceSOAP::InventoryServiceSoap.should_receive(:new).and_return(@client)
21
+ end
22
+
23
+ describe 'SSL config' do
24
+ before(:each) do
25
+ mock_result = mock(Object, :status => 'Success', :resultData => {})
26
+ response = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuListResponse,
27
+ :getFilteredSkuListResult => mock_result
28
+ )
29
+ @client.should_receive(:getFilteredSkuList).and_return(response)
30
+ end
31
+
32
+ it "sets the default SSL verify mode to VERIFY_PEER" do
33
+ @ssl_config.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER)
34
+ inventory = ChannelAdvisor::InventoryService.new
35
+ inventory.getFilteredSkuList
36
+ end
37
+
38
+ it "sets the SSL verify mode from a configatron parameter" do
39
+ configatron.temp do
40
+ configatron.channel_advisor.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
41
+ @ssl_config.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
42
+ inventory = ChannelAdvisor::InventoryService.new
43
+ inventory.getFilteredSkuList
44
+ end
45
+ end
46
+ end
47
+
48
+ it "handles getFilteredSkuList request" do
49
+ criteria = ChannelAdvisor::InventoryServiceSOAP::InventoryItemCriteria.new
50
+ criteria.skuStartsWith = 'SR123'
51
+ criteria.pageNumber = 1
52
+ criteria.pageSize = 10
53
+
54
+ ChannelAdvisor::AuthHandler.should_receive(:new).with(nil, nil)
55
+
56
+ request = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList)
57
+ ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList.should_receive(:new).with(
58
+ configatron.channel_advisor.account_id, criteria
59
+ ).and_return(request)
60
+
61
+ expected_result = ['SR123', 'SR321']
62
+
63
+ mock_result = mock(Object)
64
+ mock_result.should_receive(:status).and_return('Success')
65
+ mock_result.should_receive(:resultData).and_return(expected_result)
66
+
67
+ response = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuListResponse)
68
+ response.should_receive(:getFilteredSkuListResult).and_return(mock_result)
69
+
70
+ @client.should_receive(:getFilteredSkuList).with(request).and_return(response)
71
+
72
+ inventory = ChannelAdvisor::InventoryService.new
73
+ result = inventory.getFilteredSkuList(criteria)
74
+ result.should == expected_result
75
+ end
76
+
77
+ it "raises an error the result is not Success" do
78
+ request = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList)
79
+ ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList.stub!(:new).and_return(request)
80
+
81
+ mock_result = mock(Object)
82
+ mock_result.should_receive(:status).and_return('Failure')
83
+ mock_result.should_receive(:messageCode).and_return(ChannelAdvisor::MessageCode::Unexpected.code)
84
+ mock_result.should_receive(:message).and_return('There was a problem')
85
+
86
+ response = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuListResponse)
87
+ response.should_receive(:getFilteredSkuListResult).and_return(mock_result)
88
+
89
+ @client.should_receive(:getFilteredSkuList).with(request).and_return(response)
90
+
91
+ begin
92
+ inventory = ChannelAdvisor::InventoryService.new
93
+ inventory.getFilteredSkuList
94
+ fail('Expected an exception')
95
+ rescue ChannelAdvisor::Error => e
96
+ e.message_code.should == ChannelAdvisor::MessageCode::Unexpected
97
+ end
98
+ end
99
+
100
+ it "should be able to specify accounts settings in the method" do
101
+ criteria = ChannelAdvisor::InventoryServiceSOAP::InventoryItemCriteria.new
102
+ criteria.skuStartsWith = 'SR123'
103
+ criteria.pageNumber = 1
104
+ criteria.pageSize = 10
105
+
106
+ ChannelAdvisor::AuthHandler.should_receive(:new).with("FAKEKEY", "FAKEPASS")
107
+
108
+ request = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList)
109
+ ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuList.should_receive(:new).with(
110
+ "FAKEID", criteria
111
+ ).and_return(request)
112
+
113
+ expected_result = ['SR123', 'SR321']
114
+
115
+ mock_result = mock(Object)
116
+ mock_result.should_receive(:status).and_return('Success')
117
+ mock_result.should_receive(:resultData).and_return(expected_result)
118
+
119
+ response = mock(ChannelAdvisor::InventoryServiceSOAP::GetFilteredSkuListResponse)
120
+ response.should_receive(:getFilteredSkuListResult).and_return(mock_result)
121
+
122
+ @client.should_receive(:getFilteredSkuList).with(request).and_return(response)
123
+
124
+ inventory = ChannelAdvisor::InventoryService.new
125
+ result = inventory.getFilteredSkuList(criteria, :account_id => "FAKEID", :developer_key => "FAKEKEY", :password => "FAKEPASS")
126
+ result.should == expected_result
127
+ end
128
+ end
129
+
130
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::ShippingService do
4
+
5
+ describe "proxy configuration" do
6
+ it "should define soap dependencies" do
7
+ ChannelAdvisor::ShippingService::SOAP_CLASS.should == ChannelAdvisor::ShippingServiceSOAP::ShippingServiceSoap
8
+ ChannelAdvisor::ShippingService::SERVICE_MODULE.should == ChannelAdvisor::ShippingServiceSOAP
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::StoreService do
4
+
5
+ describe "proxy configuration" do
6
+ it "should define soap dependencies" do
7
+ ChannelAdvisor::StoreService::SOAP_CLASS.should == ChannelAdvisor::StoreServiceSOAP::StoreServiceSoap
8
+ ChannelAdvisor::StoreService::SERVICE_MODULE.should == ChannelAdvisor::StoreServiceSOAP
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe ChannelAdvisor::TaxService do
4
+
5
+ describe "proxy configuration" do
6
+ it "should define soap dependencies" do
7
+ ChannelAdvisor::TaxService::SOAP_CLASS.should == ChannelAdvisor::TaxServiceSOAP::TaxServiceSoap
8
+ ChannelAdvisor::TaxService::SERVICE_MODULE.should == ChannelAdvisor::TaxServiceSOAP
9
+ end
10
+ end
11
+
12
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --format specdoc
2
+ --colour
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+
4
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'channel_advisor'))
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: channel_advisor
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 8
10
+ version: 0.0.8
11
+ platform: ruby
12
+ authors:
13
+ - Second Rotation, Inc.
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-25 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: soap4r
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 5
33
+ - 8
34
+ version: 1.5.8
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: configatron
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 2
48
+ - 0
49
+ - 0
50
+ version: 2.0.0
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description: "channel_advisor was developed by: Second Rotation, Inc."
54
+ email: jason@secondrotation.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files:
60
+ - README
61
+ files:
62
+ - lib/channel_advisor/admin_service/client.rb
63
+ - lib/channel_advisor/admin_service/mapping_registry.rb
64
+ - lib/channel_advisor/admin_service/types.rb
65
+ - lib/channel_advisor/admin_service.rb
66
+ - lib/channel_advisor/auth_handler.rb
67
+ - lib/channel_advisor/cart_service/client.rb
68
+ - lib/channel_advisor/cart_service/mapping_registry.rb
69
+ - lib/channel_advisor/cart_service/types.rb
70
+ - lib/channel_advisor/cart_service.rb
71
+ - lib/channel_advisor/errors.rb
72
+ - lib/channel_advisor/inventory_service/client.rb
73
+ - lib/channel_advisor/inventory_service/mapping_registry.rb
74
+ - lib/channel_advisor/inventory_service/types.rb
75
+ - lib/channel_advisor/inventory_service.rb
76
+ - lib/channel_advisor/listing_service/client.rb
77
+ - lib/channel_advisor/listing_service/mapping_registry.rb
78
+ - lib/channel_advisor/listing_service/types.rb
79
+ - lib/channel_advisor/listing_service.rb
80
+ - lib/channel_advisor/marketplace_ad_service/client.rb
81
+ - lib/channel_advisor/marketplace_ad_service/mapping_registry.rb
82
+ - lib/channel_advisor/marketplace_ad_service/types.rb
83
+ - lib/channel_advisor/marketplace_ad_service.rb
84
+ - lib/channel_advisor/message_code.rb
85
+ - lib/channel_advisor/order_service/client.rb
86
+ - lib/channel_advisor/order_service/mapping_registry.rb
87
+ - lib/channel_advisor/order_service/types.rb
88
+ - lib/channel_advisor/order_service.rb
89
+ - lib/channel_advisor/service_proxy.rb
90
+ - lib/channel_advisor/shared_requires.rb
91
+ - lib/channel_advisor/shipping_service/client.rb
92
+ - lib/channel_advisor/shipping_service/mapping_registry.rb
93
+ - lib/channel_advisor/shipping_service/types.rb
94
+ - lib/channel_advisor/shipping_service.rb
95
+ - lib/channel_advisor/store_service/client.rb
96
+ - lib/channel_advisor/store_service/mapping_registry.rb
97
+ - lib/channel_advisor/store_service/types.rb
98
+ - lib/channel_advisor/store_service.rb
99
+ - lib/channel_advisor/tax_service/client.rb
100
+ - lib/channel_advisor/tax_service/mapping_registry.rb
101
+ - lib/channel_advisor/tax_service/types.rb
102
+ - lib/channel_advisor/tax_service.rb
103
+ - lib/channel_advisor.rb
104
+ - README
105
+ - spec/integration/inventory_sync_spec.rb
106
+ - spec/lib/channel_advisor/admin_service_spec.rb
107
+ - spec/lib/channel_advisor/auth_handler_spec.rb
108
+ - spec/lib/channel_advisor/cart_service_spec.rb
109
+ - spec/lib/channel_advisor/errors_spec.rb
110
+ - spec/lib/channel_advisor/inventory_service_spec.rb
111
+ - spec/lib/channel_advisor/marketplace_ad_service_spec.rb
112
+ - spec/lib/channel_advisor/message_code_spec.rb
113
+ - spec/lib/channel_advisor/order_service_spec.rb
114
+ - spec/lib/channel_advisor/service_proxy_spec.rb
115
+ - spec/lib/channel_advisor/shipping_service_spec.rb
116
+ - spec/lib/channel_advisor/store_service_spec.rb
117
+ - spec/lib/channel_advisor/tax_service_spec.rb
118
+ - spec/spec.opts
119
+ - spec/spec_helper.rb
120
+ has_rdoc: true
121
+ homepage: http://github.com/secondrotation/channel_advisor/
122
+ licenses: []
123
+
124
+ post_install_message:
125
+ rdoc_options: []
126
+
127
+ require_paths:
128
+ - lib
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ hash: 3
136
+ segments:
137
+ - 0
138
+ version: "0"
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ requirements: []
149
+
150
+ rubyforge_project: channel_advisor
151
+ rubygems_version: 1.3.7
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: channel_advisor
155
+ test_files:
156
+ - spec/integration/inventory_sync_spec.rb
157
+ - spec/lib/channel_advisor/admin_service_spec.rb
158
+ - spec/lib/channel_advisor/auth_handler_spec.rb
159
+ - spec/lib/channel_advisor/cart_service_spec.rb
160
+ - spec/lib/channel_advisor/errors_spec.rb
161
+ - spec/lib/channel_advisor/inventory_service_spec.rb
162
+ - spec/lib/channel_advisor/marketplace_ad_service_spec.rb
163
+ - spec/lib/channel_advisor/message_code_spec.rb
164
+ - spec/lib/channel_advisor/order_service_spec.rb
165
+ - spec/lib/channel_advisor/service_proxy_spec.rb
166
+ - spec/lib/channel_advisor/shipping_service_spec.rb
167
+ - spec/lib/channel_advisor/store_service_spec.rb
168
+ - spec/lib/channel_advisor/tax_service_spec.rb
169
+ - spec/spec.opts
170
+ - spec/spec_helper.rb