g4s_client 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ require 'default.rb'
2
+ require 'defaultMappingRegistry.rb'
3
+ require 'soap/rpc/driver'
4
+
5
+ class IPSShippingSoap < ::SOAP::RPC::Driver
6
+ DefaultEndpointUrl = "https://ws.g4si.com/IPSshipping.asmx"
7
+
8
+ Methods = [
9
+ [ "http://WS.G4SI.COM/CalculateEstimatedPrice",
10
+ "calculateEstimatedPrice",
11
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CalculateEstimatedPrice"]],
12
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CalculateEstimatedPriceResponse"]] ],
13
+ { :request_style => :document, :request_use => :literal,
14
+ :response_style => :document, :response_use => :literal,
15
+ :faults => {} }
16
+ ],
17
+ [ "http://WS.G4SI.COM/CreateShipment",
18
+ "createShipment",
19
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CreateShipment"]],
20
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CreateShipmentResponse"]] ],
21
+ { :request_style => :document, :request_use => :literal,
22
+ :response_style => :document, :response_use => :literal,
23
+ :faults => {} }
24
+ ],
25
+ [ "http://WS.G4SI.COM/VoidShipment",
26
+ "voidShipment",
27
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "VoidShipment"]],
28
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "VoidShipmentResponse"]] ],
29
+ { :request_style => :document, :request_use => :literal,
30
+ :response_style => :document, :response_use => :literal,
31
+ :faults => {} }
32
+ ]
33
+ ]
34
+
35
+ def initialize(endpoint_url = nil)
36
+ endpoint_url ||= DefaultEndpointUrl
37
+ super(endpoint_url, nil)
38
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
39
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
40
+ init_methods
41
+ end
42
+
43
+ private
44
+
45
+ def init_methods
46
+ Methods.each do |definitions|
47
+ opt = definitions.last
48
+ if opt[:request_style] == :document
49
+ add_document_operation(*definitions)
50
+ else
51
+ add_rpc_operation(*definitions)
52
+ qname = definitions[0]
53
+ name = definitions[2]
54
+ if qname.name != name and qname.name.capitalize == name.capitalize
55
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
56
+ __send__(name, *arg)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+