channel_advisor 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README +46 -0
- data/lib/channel_advisor/admin_service/client.rb +63 -0
- data/lib/channel_advisor/admin_service/mapping_registry.rb +206 -0
- data/lib/channel_advisor/admin_service/types.rb +175 -0
- data/lib/channel_advisor/admin_service.rb +14 -0
- data/lib/channel_advisor/auth_handler.rb +21 -0
- data/lib/channel_advisor/cart_service/client.rb +79 -0
- data/lib/channel_advisor/cart_service/mapping_registry.rb +344 -0
- data/lib/channel_advisor/cart_service/types.rb +386 -0
- data/lib/channel_advisor/cart_service.rb +14 -0
- data/lib/channel_advisor/errors.rb +13 -0
- data/lib/channel_advisor/inventory_service/client.rb +223 -0
- data/lib/channel_advisor/inventory_service/mapping_registry.rb +1765 -0
- data/lib/channel_advisor/inventory_service/types.rb +1708 -0
- data/lib/channel_advisor/inventory_service.rb +14 -0
- data/lib/channel_advisor/listing_service/client.rb +55 -0
- data/lib/channel_advisor/listing_service/mapping_registry.rb +153 -0
- data/lib/channel_advisor/listing_service/types.rb +125 -0
- data/lib/channel_advisor/listing_service.rb +14 -0
- data/lib/channel_advisor/marketplace_ad_service/client.rb +71 -0
- data/lib/channel_advisor/marketplace_ad_service/mapping_registry.rb +334 -0
- data/lib/channel_advisor/marketplace_ad_service/types.rb +317 -0
- data/lib/channel_advisor/marketplace_ad_service.rb +14 -0
- data/lib/channel_advisor/message_code.rb +30 -0
- data/lib/channel_advisor/order_service/client.rb +111 -0
- data/lib/channel_advisor/order_service/mapping_registry.rb +1696 -0
- data/lib/channel_advisor/order_service/types.rb +1781 -0
- data/lib/channel_advisor/order_service.rb +14 -0
- data/lib/channel_advisor/service_proxy.rb +62 -0
- data/lib/channel_advisor/shared_requires.rb +11 -0
- data/lib/channel_advisor/shipping_service/client.rb +79 -0
- data/lib/channel_advisor/shipping_service/mapping_registry.rb +500 -0
- data/lib/channel_advisor/shipping_service/types.rb +431 -0
- data/lib/channel_advisor/shipping_service.rb +14 -0
- data/lib/channel_advisor/store_service/client.rb +55 -0
- data/lib/channel_advisor/store_service/mapping_registry.rb +250 -0
- data/lib/channel_advisor/store_service/types.rb +180 -0
- data/lib/channel_advisor/store_service.rb +14 -0
- data/lib/channel_advisor/tax_service/client.rb +55 -0
- data/lib/channel_advisor/tax_service/mapping_registry.rb +233 -0
- data/lib/channel_advisor/tax_service/types.rb +221 -0
- data/lib/channel_advisor/tax_service.rb +14 -0
- data/lib/channel_advisor.rb +4 -0
- data/spec/integration/inventory_sync_spec.rb +55 -0
- data/spec/lib/channel_advisor/admin_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/auth_handler_spec.rb +46 -0
- data/spec/lib/channel_advisor/cart_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/errors_spec.rb +23 -0
- data/spec/lib/channel_advisor/inventory_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/marketplace_ad_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/message_code_spec.rb +40 -0
- data/spec/lib/channel_advisor/order_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/service_proxy_spec.rb +130 -0
- data/spec/lib/channel_advisor/shipping_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/store_service_spec.rb +12 -0
- data/spec/lib/channel_advisor/tax_service_spec.rb +12 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +4 -0
- metadata +170 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
module ChannelAdvisor
|
2
|
+
class MessageCode
|
3
|
+
attr_accessor :code, :message
|
4
|
+
|
5
|
+
def initialize(code, message)
|
6
|
+
@code = code
|
7
|
+
@message = message
|
8
|
+
end
|
9
|
+
|
10
|
+
Success = MessageCode.new(0, 'Success')
|
11
|
+
Unexpected = MessageCode.new(1, 'Unexpected')
|
12
|
+
NoAccountID = MessageCode.new(3, 'No Account ID value was specified')
|
13
|
+
NoSkuValue = MessageCode.new(5, 'No Sku value was specified')
|
14
|
+
TooManySkus = MessageCode.new(8, 'The number of Sku values specified was greater than the maximum amount allowed by the method definition')
|
15
|
+
|
16
|
+
def self.get(code)
|
17
|
+
code = code.to_i
|
18
|
+
message = nil
|
19
|
+
case code
|
20
|
+
when 0: Success
|
21
|
+
when 1: Unexpected
|
22
|
+
when 3: NoAccountID
|
23
|
+
when 5: NoSkuValue
|
24
|
+
when 8: TooManySkus
|
25
|
+
else
|
26
|
+
MessageCode.new(code, 'Unknown Error')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module ChannelAdvisor::OrderServiceSOAP
|
2
|
+
|
3
|
+
class OrderServiceSoap < ::SOAP::RPC::Driver
|
4
|
+
DefaultEndpointUrl = "https://api.channeladvisor.com/ChannelAdvisorAPI/v1/OrderService.asmx"
|
5
|
+
|
6
|
+
Methods = [
|
7
|
+
[ "http://api.channeladvisor.com/webservices/SubmitAmazonFullRefund",
|
8
|
+
"submitAmazonFullRefund",
|
9
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitAmazonFullRefund"]],
|
10
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitAmazonFullRefundResponse"]] ],
|
11
|
+
{ :request_style => :document, :request_use => :literal,
|
12
|
+
:response_style => :document, :response_use => :literal,
|
13
|
+
:faults => {} }
|
14
|
+
],
|
15
|
+
[ "http://api.channeladvisor.com/webservices/SetOrdersExportStatus",
|
16
|
+
"setOrdersExportStatus",
|
17
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SetOrdersExportStatus"]],
|
18
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SetOrdersExportStatusResponse"]] ],
|
19
|
+
{ :request_style => :document, :request_use => :literal,
|
20
|
+
:response_style => :document, :response_use => :literal,
|
21
|
+
:faults => {} }
|
22
|
+
],
|
23
|
+
[ "http://api.channeladvisor.com/webservices/SubmitAmazonPartialRefund",
|
24
|
+
"submitAmazonPartialRefund",
|
25
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitAmazonPartialRefund"]],
|
26
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitAmazonPartialRefundResponse"]] ],
|
27
|
+
{ :request_style => :document, :request_use => :literal,
|
28
|
+
:response_style => :document, :response_use => :literal,
|
29
|
+
:faults => {} }
|
30
|
+
],
|
31
|
+
[ "http://api.channeladvisor.com/webservices/SubmitOrderRefund",
|
32
|
+
"submitOrderRefund",
|
33
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitOrderRefund"]],
|
34
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitOrderRefundResponse"]] ],
|
35
|
+
{ :request_style => :document, :request_use => :literal,
|
36
|
+
:response_style => :document, :response_use => :literal,
|
37
|
+
:faults => {} }
|
38
|
+
],
|
39
|
+
[ "http://api.channeladvisor.com/webservices/GetOrderList",
|
40
|
+
"getOrderList",
|
41
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetOrderList"]],
|
42
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetOrderListResponse"]] ],
|
43
|
+
{ :request_style => :document, :request_use => :literal,
|
44
|
+
:response_style => :document, :response_use => :literal,
|
45
|
+
:faults => {} }
|
46
|
+
],
|
47
|
+
[ "http://api.channeladvisor.com/webservices/SubmitOrder",
|
48
|
+
"submitOrder",
|
49
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitOrder"]],
|
50
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SubmitOrderResponse"]] ],
|
51
|
+
{ :request_style => :document, :request_use => :literal,
|
52
|
+
:response_style => :document, :response_use => :literal,
|
53
|
+
:faults => {} }
|
54
|
+
],
|
55
|
+
[ "http://api.channeladvisor.com/webservices/SetSellerOrderID",
|
56
|
+
"setSellerOrderID",
|
57
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SetSellerOrderID"]],
|
58
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "SetSellerOrderIDResponse"]] ],
|
59
|
+
{ :request_style => :document, :request_use => :literal,
|
60
|
+
:response_style => :document, :response_use => :literal,
|
61
|
+
:faults => {} }
|
62
|
+
],
|
63
|
+
[ "http://api.channeladvisor.com/webservices/GetOrderRefundHistory",
|
64
|
+
"getOrderRefundHistory",
|
65
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetOrderRefundHistory"]],
|
66
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "GetOrderRefundHistoryResponse"]] ],
|
67
|
+
{ :request_style => :document, :request_use => :literal,
|
68
|
+
:response_style => :document, :response_use => :literal,
|
69
|
+
:faults => {} }
|
70
|
+
],
|
71
|
+
[ "http://api.channeladvisor.com/webservices/Ping",
|
72
|
+
"ping",
|
73
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "Ping"]],
|
74
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://api.channeladvisor.com/webservices/", "PingResponse"]] ],
|
75
|
+
{ :request_style => :document, :request_use => :literal,
|
76
|
+
:response_style => :document, :response_use => :literal,
|
77
|
+
:faults => {} }
|
78
|
+
]
|
79
|
+
]
|
80
|
+
|
81
|
+
def initialize(endpoint_url = nil)
|
82
|
+
endpoint_url ||= DefaultEndpointUrl
|
83
|
+
super(endpoint_url, nil)
|
84
|
+
self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
|
85
|
+
self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
|
86
|
+
init_methods
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def init_methods
|
92
|
+
Methods.each do |definitions|
|
93
|
+
opt = definitions.last
|
94
|
+
if opt[:request_style] == :document
|
95
|
+
add_document_operation(*definitions)
|
96
|
+
else
|
97
|
+
add_rpc_operation(*definitions)
|
98
|
+
qname = definitions[0]
|
99
|
+
name = definitions[2]
|
100
|
+
if qname.name != name and qname.name.capitalize == name.capitalize
|
101
|
+
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
102
|
+
__send__(name, *arg)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
end
|