g4s_client 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,58 +2,69 @@ require 'default.rb'
2
2
  require 'defaultMappingRegistry.rb'
3
3
  require 'soap/rpc/driver'
4
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 => {} }
5
+ puts "About to load Shipping::IPSShippingSoap"
6
+
7
+ class Shipping
8
+ class IPSShippingSoap < ::SOAP::RPC::Driver
9
+ DefaultEndpointUrl = "https://ws.g4si.com/IPSshipping.asmx"
10
+
11
+ Methods = [
12
+ [ "http://WS.G4SI.COM/CalculateEstimatedPrice",
13
+ "calculateEstimatedPrice",
14
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CalculateEstimatedPrice"]],
15
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CalculateEstimatedPriceResponse"]] ],
16
+ { :request_style => :document, :request_use => :literal,
17
+ :response_style => :document, :response_use => :literal,
18
+ :faults => {} }
19
+ ],
20
+ [ "http://WS.G4SI.COM/CreateShipment",
21
+ "createShipment",
22
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CreateShipment"]],
23
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "CreateShipmentResponse"]] ],
24
+ { :request_style => :document, :request_use => :literal,
25
+ :response_style => :document, :response_use => :literal,
26
+ :faults => {} }
27
+ ],
28
+ [ "http://WS.G4SI.COM/VoidShipment",
29
+ "voidShipment",
30
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "VoidShipment"]],
31
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://WS.G4SI.COM/", "VoidShipmentResponse"]] ],
32
+ { :request_style => :document, :request_use => :literal,
33
+ :response_style => :document, :response_use => :literal,
34
+ :faults => {} }
35
+ ]
32
36
  ]
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
37
 
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)
38
+ def initialize(endpoint_url = nil)
39
+ endpoint_url ||= DefaultEndpointUrl
40
+ super(endpoint_url, nil)
41
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
42
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
43
+ init_methods
44
+ end
45
+
46
+ private
47
+
48
+ def init_methods
49
+ Methods.each do |definitions|
50
+ opt = definitions.last
51
+
52
+ # TURNS OFF n1 NAMESPACE: http://www.pluitsolutions.com/2007/08/10/remove-n1-namespace-for-soap4r/
53
+ opt.merge!({
54
+ :elementformdefault => true,
55
+ :attributeformdefault => true
56
+ })
57
+
58
+ if opt[:request_style] == :document
59
+ add_document_operation(*definitions)
60
+ else
61
+ add_rpc_operation(*definitions)
62
+ qname = definitions[0]
63
+ name = definitions[2]
64
+ if qname.name != name and qname.name.capitalize == name.capitalize
65
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
66
+ __send__(name, *arg)
67
+ end
57
68
  end
58
69
  end
59
70
  end
@@ -1,5 +1,9 @@
1
+ #puts "REQUIRING: #{Dir[__FILE__]}"
2
+
1
3
  #!/usr/bin/env ruby
2
- require 'defaultDriver.rb'
4
+ require 'g4s/tracking/defaultDriver'
5
+ require 'g4s/tracking/default'
6
+ require 'g4s/tracking/defaultMappingRegistry'
3
7
 
4
8
  endpoint_url = ARGV.shift
5
9
  obj = IPSTrackingSoap.new(endpoint_url)