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
data/README ADDED
@@ -0,0 +1,46 @@
1
+ README
2
+ ========================================================================
3
+
4
+ This gem provides access to data from Channel Advisor (CA). It contains files generated by soap4r using the WSDL files
5
+ provided on the Channel Advisor Developer Network web site and a thin wrapper to help with authorization and
6
+ error handling.
7
+
8
+ How to Access CA
9
+ ----------
10
+
11
+ require 'rubygems'
12
+ require 'channel_advisor/inventory_service'
13
+
14
+ configatron.channel_advisor.account_id = 'YOUR ACCOUNT ID'
15
+ configatron.channel_advisor.developer_key = 'YOUR DEVELOPER KEY'
16
+ configatron.channel_advisor.password = 'YOUR API PASSWORD'
17
+
18
+ criteria = ChannelAdvisor::InventoryServiceSOAP::InventoryItemCriteria.new
19
+ criteria.skuStartsWith = 'SR123'
20
+ criteria.pageNumber = 1
21
+ criteria.pageSize = 10
22
+
23
+ inventory = ChannelAdvisor::InventoryService.new
24
+ result = inventory.getFilteredSkuList(criteria)
25
+ ["SR123756282", "SR123666418", "SR1232641972"]
26
+
27
+
28
+ How to Generate the API Classes
29
+ ----------
30
+
31
+ * If there is a new service, add it to "services = %w(admin_service inventory_service ...)" in Rakefile
32
+ * Execute "rake generate"
33
+ * Remove all the "require" statements from the generated files.
34
+
35
+ Change Log
36
+ ----------
37
+ = 0.0.8 - Updated to reflect the latest Channel Advisor API Spec; Adding ListingService
38
+ = 0.0.7 - Updated to reflect the 2009-10-24 Channel Advisor Release; Added error messages to ChannelAdvisor::Error
39
+ < 0.0.6 - Everything else
40
+
41
+
42
+ Resources
43
+ ----------
44
+ http://developer.channeladvisor.com/display/cadn/ChannelAdvisor+Developer+Network
45
+
46
+
@@ -0,0 +1,63 @@
1
+ module ChannelAdvisor::AdminServiceSOAP
2
+
3
+ class AdminServiceSoap < ::SOAP::RPC::Driver
4
+ DefaultEndpointUrl = "https://api.channeladvisor.com/ChannelAdvisorAPI/v1/AdminService.asmx"
5
+
6
+ Methods = [
7
+ [ "http://api.channeladvisor.com/webservices/GetAuthorizationList",
8
+ "getAuthorizationList",
9
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetAuthorizationList"]],
10
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetAuthorizationListResponse"]] ],
11
+ { :request_style => :document, :request_use => :literal,
12
+ :response_style => :document, :response_use => :literal,
13
+ :faults => {} }
14
+ ],
15
+ [ "http://api.channeladvisor.com/webservices/RequestAccess",
16
+ "requestAccess",
17
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "RequestAccess"]],
18
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "RequestAccessResponse"]] ],
19
+ { :request_style => :document, :request_use => :literal,
20
+ :response_style => :document, :response_use => :literal,
21
+ :faults => {} }
22
+ ],
23
+ [ "http://api.channeladvisor.com/webservices/Ping",
24
+ "ping",
25
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "Ping"]],
26
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "PingResponse"]] ],
27
+ { :request_style => :document, :request_use => :literal,
28
+ :response_style => :document, :response_use => :literal,
29
+ :faults => {} }
30
+ ]
31
+ ]
32
+
33
+ def initialize(endpoint_url = nil)
34
+ endpoint_url ||= DefaultEndpointUrl
35
+ super(endpoint_url, nil)
36
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
37
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
38
+ init_methods
39
+ end
40
+
41
+ private
42
+
43
+ def init_methods
44
+ Methods.each do |definitions|
45
+ opt = definitions.last
46
+ if opt[:request_style] == :document
47
+ add_document_operation(*definitions)
48
+ else
49
+ add_rpc_operation(*definitions)
50
+ qname = definitions[0]
51
+ name = definitions[2]
52
+ if qname.name != name and qname.name.capitalize == name.capitalize
53
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
54
+ __send__(name, *arg)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+
63
+ end
@@ -0,0 +1,206 @@
1
+ module ChannelAdvisor; module AdminServiceSOAP
2
+
3
+ module DefaultMappingRegistry
4
+ EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
5
+ LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
6
+ NsWebservices = "http://api.channeladvisor.com/webservices/"
7
+
8
+ EncodedRegistry.register(
9
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfArrayOfAuthorizationResponse,
10
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfArrayOfAuthorizationResponse"),
11
+ :schema_element => [
12
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
13
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
14
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
15
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
16
+ ["resultData", ["ChannelAdvisor::AdminServiceSOAP::ArrayOfAuthorizationResponse", XSD::QName.new(NsWebservices, "ResultData")], [0, 1]]
17
+ ]
18
+ )
19
+
20
+ EncodedRegistry.register(
21
+ :class => ChannelAdvisor::AdminServiceSOAP::ArrayOfAuthorizationResponse,
22
+ :schema_type => XSD::QName.new(NsWebservices, "ArrayOfAuthorizationResponse"),
23
+ :schema_element => [
24
+ ["authorizationResponse", ["ChannelAdvisor::AdminServiceSOAP::AuthorizationResponse[]", XSD::QName.new(NsWebservices, "AuthorizationResponse")], [0, nil]]
25
+ ]
26
+ )
27
+
28
+ EncodedRegistry.register(
29
+ :class => ChannelAdvisor::AdminServiceSOAP::AuthorizationResponse,
30
+ :schema_type => XSD::QName.new(NsWebservices, "AuthorizationResponse"),
31
+ :schema_element => [
32
+ ["accountID", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountID")], [0, 1]],
33
+ ["localID", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "LocalID")]],
34
+ ["accountName", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountName")], [0, 1]],
35
+ ["accountType", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountType")], [0, 1]],
36
+ ["resourceName", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "ResourceName")], [0, 1]],
37
+ ["status", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Status")], [0, 1]]
38
+ ]
39
+ )
40
+
41
+ EncodedRegistry.register(
42
+ :class => ChannelAdvisor::AdminServiceSOAP::APICredentials,
43
+ :schema_type => XSD::QName.new(NsWebservices, "APICredentials"),
44
+ :schema_element => [
45
+ ["developerKey", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "DeveloperKey")], [0, 1]],
46
+ ["password", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Password")], [0, 1]]
47
+ ]
48
+ )
49
+
50
+ EncodedRegistry.register(
51
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfBoolean,
52
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfBoolean"),
53
+ :schema_element => [
54
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
55
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
56
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
57
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
58
+ ["resultData", ["SOAP::SOAPBoolean", XSD::QName.new(NsWebservices, "ResultData")]]
59
+ ]
60
+ )
61
+
62
+ EncodedRegistry.register(
63
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfString,
64
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfString"),
65
+ :schema_element => [
66
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
67
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
68
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
69
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
70
+ ["resultData", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "ResultData")], [0, 1]]
71
+ ]
72
+ )
73
+
74
+ EncodedRegistry.register(
75
+ :class => ChannelAdvisor::AdminServiceSOAP::ResultStatus,
76
+ :schema_type => XSD::QName.new(NsWebservices, "ResultStatus")
77
+ )
78
+
79
+ LiteralRegistry.register(
80
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfArrayOfAuthorizationResponse,
81
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfArrayOfAuthorizationResponse"),
82
+ :schema_element => [
83
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
84
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
85
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
86
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
87
+ ["resultData", ["ChannelAdvisor::AdminServiceSOAP::ArrayOfAuthorizationResponse", XSD::QName.new(NsWebservices, "ResultData")], [0, 1]]
88
+ ]
89
+ )
90
+
91
+ LiteralRegistry.register(
92
+ :class => ChannelAdvisor::AdminServiceSOAP::ArrayOfAuthorizationResponse,
93
+ :schema_type => XSD::QName.new(NsWebservices, "ArrayOfAuthorizationResponse"),
94
+ :schema_element => [
95
+ ["authorizationResponse", ["ChannelAdvisor::AdminServiceSOAP::AuthorizationResponse[]", XSD::QName.new(NsWebservices, "AuthorizationResponse")], [0, nil]]
96
+ ]
97
+ )
98
+
99
+ LiteralRegistry.register(
100
+ :class => ChannelAdvisor::AdminServiceSOAP::AuthorizationResponse,
101
+ :schema_type => XSD::QName.new(NsWebservices, "AuthorizationResponse"),
102
+ :schema_element => [
103
+ ["accountID", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountID")], [0, 1]],
104
+ ["localID", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "LocalID")]],
105
+ ["accountName", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountName")], [0, 1]],
106
+ ["accountType", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "AccountType")], [0, 1]],
107
+ ["resourceName", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "ResourceName")], [0, 1]],
108
+ ["status", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Status")], [0, 1]]
109
+ ]
110
+ )
111
+
112
+ LiteralRegistry.register(
113
+ :class => ChannelAdvisor::AdminServiceSOAP::APICredentials,
114
+ :schema_type => XSD::QName.new(NsWebservices, "APICredentials"),
115
+ :schema_element => [
116
+ ["developerKey", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "DeveloperKey")], [0, 1]],
117
+ ["password", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Password")], [0, 1]]
118
+ ]
119
+ )
120
+
121
+ LiteralRegistry.register(
122
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfBoolean,
123
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfBoolean"),
124
+ :schema_element => [
125
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
126
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
127
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
128
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
129
+ ["resultData", ["SOAP::SOAPBoolean", XSD::QName.new(NsWebservices, "ResultData")]]
130
+ ]
131
+ )
132
+
133
+ LiteralRegistry.register(
134
+ :class => ChannelAdvisor::AdminServiceSOAP::APIResultOfString,
135
+ :schema_type => XSD::QName.new(NsWebservices, "APIResultOfString"),
136
+ :schema_element => [
137
+ ["status", ["ChannelAdvisor::AdminServiceSOAP::ResultStatus", XSD::QName.new(NsWebservices, "Status")]],
138
+ ["messageCode", ["SOAP::SOAPInt", XSD::QName.new(NsWebservices, "MessageCode")]],
139
+ ["message", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Message")], [0, 1]],
140
+ ["data", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Data")], [0, 1]],
141
+ ["resultData", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "ResultData")], [0, 1]]
142
+ ]
143
+ )
144
+
145
+ LiteralRegistry.register(
146
+ :class => ChannelAdvisor::AdminServiceSOAP::ResultStatus,
147
+ :schema_type => XSD::QName.new(NsWebservices, "ResultStatus")
148
+ )
149
+
150
+ LiteralRegistry.register(
151
+ :class => ChannelAdvisor::AdminServiceSOAP::GetAuthorizationList,
152
+ :schema_name => XSD::QName.new(NsWebservices, "GetAuthorizationList"),
153
+ :schema_element => [
154
+ ["localID", "SOAP::SOAPInt"]
155
+ ]
156
+ )
157
+
158
+ LiteralRegistry.register(
159
+ :class => ChannelAdvisor::AdminServiceSOAP::GetAuthorizationListResponse,
160
+ :schema_name => XSD::QName.new(NsWebservices, "GetAuthorizationListResponse"),
161
+ :schema_element => [
162
+ ["getAuthorizationListResult", ["ChannelAdvisor::AdminServiceSOAP::APIResultOfArrayOfAuthorizationResponse", XSD::QName.new(NsWebservices, "GetAuthorizationListResult")], [0, 1]]
163
+ ]
164
+ )
165
+
166
+ LiteralRegistry.register(
167
+ :class => ChannelAdvisor::AdminServiceSOAP::APICredentials,
168
+ :schema_name => XSD::QName.new(NsWebservices, "APICredentials"),
169
+ :schema_element => [
170
+ ["developerKey", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "DeveloperKey")], [0, 1]],
171
+ ["password", ["SOAP::SOAPString", XSD::QName.new(NsWebservices, "Password")], [0, 1]]
172
+ ]
173
+ )
174
+
175
+ LiteralRegistry.register(
176
+ :class => ChannelAdvisor::AdminServiceSOAP::RequestAccess,
177
+ :schema_name => XSD::QName.new(NsWebservices, "RequestAccess"),
178
+ :schema_element => [
179
+ ["localID", "SOAP::SOAPInt"]
180
+ ]
181
+ )
182
+
183
+ LiteralRegistry.register(
184
+ :class => ChannelAdvisor::AdminServiceSOAP::RequestAccessResponse,
185
+ :schema_name => XSD::QName.new(NsWebservices, "RequestAccessResponse"),
186
+ :schema_element => [
187
+ ["requestAccessResult", ["ChannelAdvisor::AdminServiceSOAP::APIResultOfBoolean", XSD::QName.new(NsWebservices, "RequestAccessResult")], [0, 1]]
188
+ ]
189
+ )
190
+
191
+ LiteralRegistry.register(
192
+ :class => ChannelAdvisor::AdminServiceSOAP::Ping,
193
+ :schema_name => XSD::QName.new(NsWebservices, "Ping"),
194
+ :schema_element => []
195
+ )
196
+
197
+ LiteralRegistry.register(
198
+ :class => ChannelAdvisor::AdminServiceSOAP::PingResponse,
199
+ :schema_name => XSD::QName.new(NsWebservices, "PingResponse"),
200
+ :schema_element => [
201
+ ["pingResult", ["ChannelAdvisor::AdminServiceSOAP::APIResultOfString", XSD::QName.new(NsWebservices, "PingResult")], [0, 1]]
202
+ ]
203
+ )
204
+ end
205
+
206
+ end; end
@@ -0,0 +1,175 @@
1
+ module ChannelAdvisor; module AdminServiceSOAP
2
+
3
+
4
+ # {http://api.channeladvisor.com/webservices/}APIResultOfArrayOfAuthorizationResponse
5
+ # status - ChannelAdvisor::AdminServiceSOAP::ResultStatus
6
+ # messageCode - SOAP::SOAPInt
7
+ # message - SOAP::SOAPString
8
+ # data - SOAP::SOAPString
9
+ # resultData - ChannelAdvisor::AdminServiceSOAP::ArrayOfAuthorizationResponse
10
+ class APIResultOfArrayOfAuthorizationResponse
11
+ attr_accessor :status
12
+ attr_accessor :messageCode
13
+ attr_accessor :message
14
+ attr_accessor :data
15
+ attr_accessor :resultData
16
+
17
+ def initialize(status = nil, messageCode = nil, message = nil, data = nil, resultData = nil)
18
+ @status = status
19
+ @messageCode = messageCode
20
+ @message = message
21
+ @data = data
22
+ @resultData = resultData
23
+ end
24
+ end
25
+
26
+ # {http://api.channeladvisor.com/webservices/}ArrayOfAuthorizationResponse
27
+ class ArrayOfAuthorizationResponse < ::Array
28
+ end
29
+
30
+ # {http://api.channeladvisor.com/webservices/}AuthorizationResponse
31
+ # accountID - SOAP::SOAPString
32
+ # localID - SOAP::SOAPInt
33
+ # accountName - SOAP::SOAPString
34
+ # accountType - SOAP::SOAPString
35
+ # resourceName - SOAP::SOAPString
36
+ # status - SOAP::SOAPString
37
+ class AuthorizationResponse
38
+ attr_accessor :accountID
39
+ attr_accessor :localID
40
+ attr_accessor :accountName
41
+ attr_accessor :accountType
42
+ attr_accessor :resourceName
43
+ attr_accessor :status
44
+
45
+ def initialize(accountID = nil, localID = nil, accountName = nil, accountType = nil, resourceName = nil, status = nil)
46
+ @accountID = accountID
47
+ @localID = localID
48
+ @accountName = accountName
49
+ @accountType = accountType
50
+ @resourceName = resourceName
51
+ @status = status
52
+ end
53
+ end
54
+
55
+ # {http://api.channeladvisor.com/webservices/}APICredentials
56
+ # developerKey - SOAP::SOAPString
57
+ # password - SOAP::SOAPString
58
+ class APICredentials
59
+ attr_accessor :developerKey
60
+ attr_accessor :password
61
+
62
+ def initialize(developerKey = nil, password = nil)
63
+ @developerKey = developerKey
64
+ @password = password
65
+ end
66
+ end
67
+
68
+ # {http://api.channeladvisor.com/webservices/}APIResultOfBoolean
69
+ # status - ChannelAdvisor::AdminServiceSOAP::ResultStatus
70
+ # messageCode - SOAP::SOAPInt
71
+ # message - SOAP::SOAPString
72
+ # data - SOAP::SOAPString
73
+ # resultData - SOAP::SOAPBoolean
74
+ class APIResultOfBoolean
75
+ attr_accessor :status
76
+ attr_accessor :messageCode
77
+ attr_accessor :message
78
+ attr_accessor :data
79
+ attr_accessor :resultData
80
+
81
+ def initialize(status = nil, messageCode = nil, message = nil, data = nil, resultData = nil)
82
+ @status = status
83
+ @messageCode = messageCode
84
+ @message = message
85
+ @data = data
86
+ @resultData = resultData
87
+ end
88
+ end
89
+
90
+ # {http://api.channeladvisor.com/webservices/}APIResultOfString
91
+ # status - ChannelAdvisor::AdminServiceSOAP::ResultStatus
92
+ # messageCode - SOAP::SOAPInt
93
+ # message - SOAP::SOAPString
94
+ # data - SOAP::SOAPString
95
+ # resultData - SOAP::SOAPString
96
+ class APIResultOfString
97
+ attr_accessor :status
98
+ attr_accessor :messageCode
99
+ attr_accessor :message
100
+ attr_accessor :data
101
+ attr_accessor :resultData
102
+
103
+ def initialize(status = nil, messageCode = nil, message = nil, data = nil, resultData = nil)
104
+ @status = status
105
+ @messageCode = messageCode
106
+ @message = message
107
+ @data = data
108
+ @resultData = resultData
109
+ end
110
+ end
111
+
112
+ # {http://api.channeladvisor.com/webservices/}ResultStatus
113
+ class ResultStatus < ::String
114
+ Failure = ResultStatus.new("Failure")
115
+ Success = ResultStatus.new("Success")
116
+ end
117
+
118
+ # {http://api.channeladvisor.com/webservices/}GetAuthorizationList
119
+ # localID - SOAP::SOAPInt
120
+ class GetAuthorizationList
121
+ attr_accessor :localID
122
+
123
+ def initialize(localID = nil)
124
+ @localID = localID
125
+ end
126
+ end
127
+
128
+ # {http://api.channeladvisor.com/webservices/}GetAuthorizationListResponse
129
+ # getAuthorizationListResult - ChannelAdvisor::AdminServiceSOAP::APIResultOfArrayOfAuthorizationResponse
130
+ class GetAuthorizationListResponse
131
+ attr_accessor :getAuthorizationListResult
132
+
133
+ def initialize(getAuthorizationListResult = nil)
134
+ @getAuthorizationListResult = getAuthorizationListResult
135
+ end
136
+ end
137
+
138
+ # {http://api.channeladvisor.com/webservices/}RequestAccess
139
+ # localID - SOAP::SOAPInt
140
+ class RequestAccess
141
+ attr_accessor :localID
142
+
143
+ def initialize(localID = nil)
144
+ @localID = localID
145
+ end
146
+ end
147
+
148
+ # {http://api.channeladvisor.com/webservices/}RequestAccessResponse
149
+ # requestAccessResult - ChannelAdvisor::AdminServiceSOAP::APIResultOfBoolean
150
+ class RequestAccessResponse
151
+ attr_accessor :requestAccessResult
152
+
153
+ def initialize(requestAccessResult = nil)
154
+ @requestAccessResult = requestAccessResult
155
+ end
156
+ end
157
+
158
+ # {http://api.channeladvisor.com/webservices/}Ping
159
+ class Ping
160
+ def initialize
161
+ end
162
+ end
163
+
164
+ # {http://api.channeladvisor.com/webservices/}PingResponse
165
+ # pingResult - ChannelAdvisor::AdminServiceSOAP::APIResultOfString
166
+ class PingResponse
167
+ attr_accessor :pingResult
168
+
169
+ def initialize(pingResult = nil)
170
+ @pingResult = pingResult
171
+ end
172
+ end
173
+
174
+
175
+ end; end
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'shared_requires.rb'))
2
+ ['types.rb', 'mapping_registry.rb', 'client.rb'].each do |required|
3
+ require File.expand_path(File.join(File.dirname(__FILE__), 'admin_service', required))
4
+ end
5
+
6
+ module ChannelAdvisor
7
+ class AdminService
8
+ include ChannelAdvisor::ServiceProxy
9
+ define_service_methods(
10
+ ChannelAdvisor::AdminServiceSOAP,
11
+ ChannelAdvisor::AdminServiceSOAP::AdminServiceSoap
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ require 'soap/header/simplehandler'
2
+
3
+ module ChannelAdvisor
4
+ class AuthHandler < SOAP::Header::SimpleHandler
5
+ API_CREDENTIALS = XSD::QName.new('http://api.channeladvisor.com/webservices/', 'APICredentials')
6
+ DEVELOPER_KEY = XSD::QName.new('http://api.channeladvisor.com/webservices/', 'DeveloperKey')
7
+ PASSWORD = XSD::QName.new('http://api.channeladvisor.com/webservices/', 'Password')
8
+
9
+ attr_accessor :developer_key, :password
10
+
11
+ def initialize(developer_key = nil, password = nil)
12
+ super(API_CREDENTIALS)
13
+ @developer_key = developer_key || configatron.channel_advisor.developer_key
14
+ @password = password || configatron.channel_advisor.password
15
+ end
16
+
17
+ def on_simple_outbound
18
+ {PASSWORD => @password, DEVELOPER_KEY => @developer_key}
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,79 @@
1
+ module ChannelAdvisor::CartServiceSOAP
2
+
3
+ class CartServiceSoap < ::SOAP::RPC::Driver
4
+ DefaultEndpointUrl = "https://api.channeladvisor.com/ChannelAdvisorAPI/v1/CartService.asmx"
5
+
6
+ Methods = [
7
+ [ "http://api.channeladvisor.com/webservices/GetCart",
8
+ "getCart",
9
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetCart"]],
10
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetCartResponse"]] ],
11
+ { :request_style => :document, :request_use => :literal,
12
+ :response_style => :document, :response_use => :literal,
13
+ :faults => {} }
14
+ ],
15
+ [ "http://api.channeladvisor.com/webservices/DeleteCart",
16
+ "deleteCart",
17
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "DeleteCart"]],
18
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "DeleteCartResponse"]] ],
19
+ { :request_style => :document, :request_use => :literal,
20
+ :response_style => :document, :response_use => :literal,
21
+ :faults => {} }
22
+ ],
23
+ [ "http://api.channeladvisor.com/webservices/CreateCart",
24
+ "createCart",
25
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "CreateCart"]],
26
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "CreateCartResponse"]] ],
27
+ { :request_style => :document, :request_use => :literal,
28
+ :response_style => :document, :response_use => :literal,
29
+ :faults => {} }
30
+ ],
31
+ [ "http://api.channeladvisor.com/webservices/ModifyCart",
32
+ "modifyCart",
33
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "ModifyCart"]],
34
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "ModifyCartResponse"]] ],
35
+ { :request_style => :document, :request_use => :literal,
36
+ :response_style => :document, :response_use => :literal,
37
+ :faults => {} }
38
+ ],
39
+ [ "http://api.channeladvisor.com/webservices/Ping",
40
+ "ping",
41
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "Ping"]],
42
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "PingResponse"]] ],
43
+ { :request_style => :document, :request_use => :literal,
44
+ :response_style => :document, :response_use => :literal,
45
+ :faults => {} }
46
+ ]
47
+ ]
48
+
49
+ def initialize(endpoint_url = nil)
50
+ endpoint_url ||= DefaultEndpointUrl
51
+ super(endpoint_url, nil)
52
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
53
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
54
+ init_methods
55
+ end
56
+
57
+ private
58
+
59
+ def init_methods
60
+ Methods.each do |definitions|
61
+ opt = definitions.last
62
+ if opt[:request_style] == :document
63
+ add_document_operation(*definitions)
64
+ else
65
+ add_rpc_operation(*definitions)
66
+ qname = definitions[0]
67
+ name = definitions[2]
68
+ if qname.name != name and qname.name.capitalize == name.capitalize
69
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
70
+ __send__(name, *arg)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+
78
+
79
+ end