g4s_client 0.1.4 → 0.1.6

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.
data/lib/g4s/g4s.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "g4s_client"
1
2
 
2
3
  class G4s
3
4
 
@@ -12,27 +13,33 @@ class G4s
12
13
 
13
14
  def initialize
14
15
  if g4s_env == ::G4s::TEST
15
- @shipping_client = G4sClient::ShippingTest.new
16
- @utilities_client = G4sClient::UtilitiesTest.new
17
- @tracking_client = G4sClient::TrackingTest.new
16
+ @shipping_class = ::G4sClient::ShippingTest
17
+ @utilities_class = ::G4sClient::UtilitiesTest
18
+ @tracking_class = ::G4sClient::TrackingTest
18
19
  else
19
- @shipping_client = G4sClient::ShippingLive.new
20
- @utilities_client = G4sClient::UtilitiesLive.new
21
- @tracking_client = G4sClient::TrackingLive.new
20
+ @shipping_class = ::G4sClient::ShippingLive
21
+ @utilities_class = ::G4sClient::UtilitiesLive
22
+ @tracking_class = ::G4sClient::TrackingLive
22
23
  end
23
24
  end
24
25
 
25
- def shipping; @shipping_client; end
26
- def utilities; @utilities_client; end
27
- def tracking; @tracking_client; end
26
+ def shipping
27
+ @shipping_class.new # do not cache these between requests! need to clear-out headers!
28
+ end
29
+ def utilities
30
+ @utilities_class.new
31
+ end
32
+ def tracking
33
+ @tracking_class.new
34
+ end
28
35
 
29
36
  protected
30
37
 
31
38
  def g4s_env
32
- if (defined?(Rails) && Rails.env.development?) && !ENV['G4S_TEST_MODE']==false
33
- G4s::TEST
39
+ if (defined?(Rails) && Rails.env.development?) && !(ENV['G4S_TEST_MODE']==false)
40
+ ::G4s::TEST
34
41
  else
35
- G4s::LIVE
42
+ ::G4s::LIVE
36
43
  end
37
44
  end
38
45
 
@@ -0,0 +1,39 @@
1
+ require 'soap/header/simplehandler'
2
+
3
+ class CustomHeader < SOAP::Header::SimpleHandler
4
+
5
+ NAMESPACE = 'http://tempuri.org'
6
+
7
+ # def initialize(shipment_request)
8
+ # @shipment_request = shipment_request
9
+ # super(XSD::QName.new(NAMESPACE, 'ShipmentRequest'))
10
+ # end
11
+ #
12
+ # def on_simple_outbound
13
+ # to_hash(@shipment_request)
14
+ # # {"Username" => @username, "Password" => @password, "AccessKey"=>@accessKey}
15
+ # end
16
+
17
+ protected
18
+
19
+ # Transform a object into a hash of its instance variables
20
+ def to_hash(object)
21
+ return {} unless object
22
+ result = {}
23
+ object.instance_variables.each do |var|
24
+ value = object.instance_variable_get(var)
25
+ var.gsub!('@','')
26
+ var = capitalize_first_letter(var)
27
+ result[var] = value
28
+ #TODO: NESTING: some things like Address will need to result[var] = to_hash(object.instance_variable_get(var))
29
+ end
30
+ result
31
+ end
32
+
33
+ def capitalize_first_letter(string)
34
+ return nil unless string.is_a?(String)
35
+ string[0].chr.capitalize + string[1, string.size]
36
+ end
37
+
38
+
39
+ end
@@ -0,0 +1,25 @@
1
+ # http://dev.ctor.org/soap4r/ticket/449
2
+
3
+ require 'soap/rpc/driver'
4
+ require 'soap/header/handler'
5
+
6
+ # ignore the warning.
7
+ #::SOAP::EnvelopeNamespace = 'http://www.w3.org/2003/05/soap-envelope'
8
+
9
+ # replaces 'env:' with 'soap12:'
10
+ class G4sNamespaceFilter < SOAP::Filter::Handler
11
+ def on_outbound(envelope, opt)
12
+ opt[:default_ns] = @default_ns
13
+ envelope
14
+ end
15
+
16
+ def initialize
17
+ @default_ns = SOAP::NS.new
18
+ @default_ns.assign(SOAP::EnvelopeNamespace,"soap12")
19
+ #@default_ns.assign('http://www.w3.org/2003/05/soap-envelope',"soap12") # adding this in breaks soap12, makes it become env again.
20
+ #@default_ns.assign('http://wstest._2organize.nl','tms')
21
+ #@default_ns.assign('http://schemas.xmlsoap.org/soap/encoding/','soapenc')
22
+ @default_ns.assign('http://www.w3.org/2001/XMLSchema','xsd')
23
+ @default_ns.assign('http://www.w3.org/2001/XMLSchema-instance','xsi')
24
+ end
25
+ end
@@ -4,9 +4,9 @@
4
4
 
5
5
  require 'soap/header/simplehandler'
6
6
 
7
- class G4SIAuthHeader < SOAP::Header::SimpleHandler
7
+ class G4SIAuthHeader < CustomHeader
8
8
 
9
- NAMESPACE = 'http://tempuri.org'
9
+ NAMESPACE = 'http://WS.G4SI.COM/'
10
10
 
11
11
  def initialize(username, password, accessKey)
12
12
  @username, @password, @accessKey = username, password, accessKey
@@ -0,0 +1,20 @@
1
+ require 'soap/header/simplehandler'
2
+
3
+ class ShipmentRequestHeader < CustomHeader
4
+
5
+ NAMESPACE = 'http://tempuri.org'
6
+
7
+ def initialize(shipment_request)
8
+ @shipment_request = shipment_request
9
+ super(XSD::QName.new(NAMESPACE, 'ShipmentRequest'))
10
+ end
11
+
12
+ def on_simple_outbound
13
+ to_hash(@shipment_request)
14
+
15
+ #{"Username" => @username, "Password" => @password, "AccessKey"=>@accessKey}
16
+ end
17
+
18
+
19
+
20
+ end
@@ -0,0 +1,26 @@
1
+
2
+
3
+ class InsuredShip
4
+
5
+ def initialize
6
+ end
7
+
8
+ def calculateEstimatedPrice(shipment_request = ShipmentRequest.new)
9
+ reset_service_instance
10
+ @service.headerhandler << ShipmentRequestHeader.new(shipment_request) # add new headers.
11
+ @service.calculateEstimatedPrice(CalculateEstimatedPrice.new())
12
+
13
+ puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #{@service.filterchain }"
14
+ end
15
+
16
+ protected
17
+
18
+ def reset_service_instance
19
+ @service = G4s.instance.shipping.service # must make a new instance each time.
20
+ @service.wiredump_dev=STDERR
21
+ @service.options['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE
22
+ @service.filterchain << G4sNamespaceFilter.new
23
+ puts "gogogo"
24
+ end
25
+
26
+ end
@@ -220,6 +220,9 @@ require 'xsd/qname'
220
220
  end
221
221
  end
222
222
 
223
+
224
+ # Namespacing to avoid collision.
225
+ module G4sShipping
223
226
  # {http://WS.G4SI.COM/}Address
224
227
  # name - SOAP::SOAPString
225
228
  # company - SOAP::SOAPString
@@ -256,6 +259,8 @@ require 'xsd/qname'
256
259
  @email = email
257
260
  end
258
261
  end
262
+ end
263
+
259
264
 
260
265
  # {http://WS.G4SI.COM/}SchedulePickup
261
266
  # contactName - SOAP::SOAPString
@@ -52,9 +52,9 @@ module DefaultMappingRegistry
52
52
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "ThermalPrinter")]],
53
53
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "SEDNumber")], [0, 1]],
54
54
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "DutiesPayorType")], [0, 1]],
55
- ["recipientAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
55
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
56
56
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SaveNewRecipientAddress")]],
57
- ["shipperAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
57
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
58
58
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsWSG4SICOM, "CODAmount")]],
59
59
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "HoldAtLocation")]],
60
60
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SchedulePickup")]],
@@ -106,7 +106,7 @@ module DefaultMappingRegistry
106
106
 
107
107
  EncodedRegistry.register(
108
108
  :class => Address,
109
- :schema_type => XSD::QName.new(NsWSG4SICOM, "Address"),
109
+ :schema_type => XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address"),
110
110
  :schema_element => [
111
111
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
112
112
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
@@ -153,7 +153,7 @@ module DefaultMappingRegistry
153
153
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
154
154
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
155
155
  ["country", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Country")], [0, 1]],
156
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Address")], [0, 1]],
156
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address")], [0, 1]],
157
157
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "City")], [0, 1]],
158
158
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "State")], [0, 1]],
159
159
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "CountryCode")], [0, 1]],
@@ -168,7 +168,7 @@ module DefaultMappingRegistry
168
168
  :schema_element => [
169
169
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
170
170
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
171
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Address")], [0, 1]],
171
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address")], [0, 1]],
172
172
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "City")], [0, 1]],
173
173
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "State")], [0, 1]],
174
174
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "CountryCode")], [0, 1]],
@@ -276,9 +276,9 @@ module DefaultMappingRegistry
276
276
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "ThermalPrinter")]],
277
277
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "SEDNumber")], [0, 1]],
278
278
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "DutiesPayorType")], [0, 1]],
279
- ["recipientAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
279
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
280
280
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SaveNewRecipientAddress")]],
281
- ["shipperAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
281
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
282
282
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsWSG4SICOM, "CODAmount")]],
283
283
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "HoldAtLocation")]],
284
284
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SchedulePickup")]],
@@ -330,7 +330,7 @@ module DefaultMappingRegistry
330
330
 
331
331
  LiteralRegistry.register(
332
332
  :class => Address,
333
- :schema_type => XSD::QName.new(NsWSG4SICOM, "Address"),
333
+ :schema_type => XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address"),
334
334
  :schema_element => [
335
335
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
336
336
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
@@ -377,7 +377,7 @@ module DefaultMappingRegistry
377
377
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
378
378
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
379
379
  ["country", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Country")], [0, 1]],
380
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Address")], [0, 1]],
380
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address")], [0, 1]],
381
381
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "City")], [0, 1]],
382
382
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "State")], [0, 1]],
383
383
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "CountryCode")], [0, 1]],
@@ -392,7 +392,7 @@ module DefaultMappingRegistry
392
392
  :schema_element => [
393
393
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Name")], [0, 1]],
394
394
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Company")], [0, 1]],
395
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "Address")], [0, 1]],
395
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "G4sTracking::Address")], [0, 1]],
396
396
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "City")], [0, 1]],
397
397
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "State")], [0, 1]],
398
398
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "CountryCode")], [0, 1]],
@@ -497,9 +497,9 @@ module DefaultMappingRegistry
497
497
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "ThermalPrinter")]],
498
498
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "SEDNumber")], [0, 1]],
499
499
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsWSG4SICOM, "DutiesPayorType")], [0, 1]],
500
- ["recipientAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
500
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "RecipientAddress")], [0, 1]],
501
501
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SaveNewRecipientAddress")]],
502
- ["shipperAddress", ["Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
502
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsWSG4SICOM, "ShipperAddress")], [0, 1]],
503
503
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsWSG4SICOM, "CODAmount")]],
504
504
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "HoldAtLocation")]],
505
505
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsWSG4SICOM, "SchedulePickup")]],
@@ -3,7 +3,7 @@
3
3
  require 'xsd/qname'
4
4
 
5
5
 
6
- #module DefaultMappingRegistry
6
+
7
7
  # {http://tempuri.org/}ShipmentTrackingResponse
8
8
  # trackingResponse - TrackingResponse
9
9
  # trackingResponseErrorCode - SOAP::SOAPString
@@ -315,6 +315,8 @@ require 'xsd/qname'
315
315
  end
316
316
  end
317
317
 
318
+ # Namespacing to avoid collision.
319
+ module G4sTracking
318
320
  # {http://tempuri.org/}Address
319
321
  # name - SOAP::SOAPString
320
322
  # company - SOAP::SOAPString
@@ -351,6 +353,8 @@ require 'xsd/qname'
351
353
  @email = email
352
354
  end
353
355
  end
356
+ end
357
+
354
358
 
355
359
  # {http://tempuri.org/}SchedulePickup
356
360
  # contactName - SOAP::SOAPString
@@ -833,4 +837,3 @@ require 'xsd/qname'
833
837
  @getShipmentStatusResult = getShipmentStatusResult
834
838
  end
835
839
  end
836
- #end
@@ -39,9 +39,9 @@ module DefaultMappingRegistry
39
39
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "ThermalPrinter")]],
40
40
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "SEDNumber")], [0, 1]],
41
41
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "DutiesPayorType")], [0, 1]],
42
- ["recipientAddress", ["Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
42
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
43
43
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SaveNewRecipientAddress")]],
44
- ["shipperAddress", ["Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
44
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
45
45
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsTempuriOrg, "CODAmount")]],
46
46
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "HoldAtLocation")]],
47
47
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SchedulePickup")]],
@@ -87,9 +87,9 @@ module DefaultMappingRegistry
87
87
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "ThermalPrinter")]],
88
88
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "SEDNumber")], [0, 1]],
89
89
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "DutiesPayorType")], [0, 1]],
90
- ["recipientAddress", ["Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
90
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
91
91
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SaveNewRecipientAddress")]],
92
- ["shipperAddress", ["Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
92
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
93
93
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsTempuriOrg, "CODAmount")]],
94
94
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "HoldAtLocation")]],
95
95
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SchedulePickup")]],
@@ -141,7 +141,7 @@ module DefaultMappingRegistry
141
141
 
142
142
  EncodedRegistry.register(
143
143
  :class => Address,
144
- :schema_type => XSD::QName.new(NsTempuriOrg, "Address"),
144
+ :schema_type => XSD::QName.new(NsTempuriOrg, "G4sTracking::Address"),
145
145
  :schema_element => [
146
146
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
147
147
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
@@ -188,7 +188,7 @@ module DefaultMappingRegistry
188
188
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
189
189
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
190
190
  ["country", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Country")], [0, 1]],
191
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Address")], [0, 1]],
191
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "G4sTracking::Address")], [0, 1]],
192
192
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "City")], [0, 1]],
193
193
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "State")], [0, 1]],
194
194
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "CountryCode")], [0, 1]],
@@ -203,7 +203,7 @@ module DefaultMappingRegistry
203
203
  :schema_element => [
204
204
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
205
205
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
206
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Address")], [0, 1]],
206
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "G4sTracking::Address")], [0, 1]],
207
207
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "City")], [0, 1]],
208
208
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "State")], [0, 1]],
209
209
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "CountryCode")], [0, 1]],
@@ -410,9 +410,9 @@ module DefaultMappingRegistry
410
410
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "ThermalPrinter")]],
411
411
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "SEDNumber")], [0, 1]],
412
412
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "DutiesPayorType")], [0, 1]],
413
- ["recipientAddress", ["Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
413
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
414
414
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SaveNewRecipientAddress")]],
415
- ["shipperAddress", ["Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
415
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
416
416
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsTempuriOrg, "CODAmount")]],
417
417
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "HoldAtLocation")]],
418
418
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SchedulePickup")]],
@@ -458,9 +458,9 @@ module DefaultMappingRegistry
458
458
  ["thermalPrinter", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "ThermalPrinter")]],
459
459
  ["sEDNumber", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "SEDNumber")], [0, 1]],
460
460
  ["dutiesPayorType", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "DutiesPayorType")], [0, 1]],
461
- ["recipientAddress", ["Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
461
+ ["recipientAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "RecipientAddress")], [0, 1]],
462
462
  ["saveNewRecipientAddress", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SaveNewRecipientAddress")]],
463
- ["shipperAddress", ["Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
463
+ ["shipperAddress", ["G4sTracking::Address", XSD::QName.new(NsTempuriOrg, "ShipperAddress")], [0, 1]],
464
464
  ["cODAmount", ["SOAP::SOAPDouble", XSD::QName.new(NsTempuriOrg, "CODAmount")]],
465
465
  ["holdAtLocation", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "HoldAtLocation")]],
466
466
  ["schedulePickup", ["SOAP::SOAPBoolean", XSD::QName.new(NsTempuriOrg, "SchedulePickup")]],
@@ -512,7 +512,7 @@ module DefaultMappingRegistry
512
512
 
513
513
  LiteralRegistry.register(
514
514
  :class => Address,
515
- :schema_type => XSD::QName.new(NsTempuriOrg, "Address"),
515
+ :schema_type => XSD::QName.new(NsTempuriOrg, "G4sTracking::Address"),
516
516
  :schema_element => [
517
517
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
518
518
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
@@ -559,7 +559,7 @@ module DefaultMappingRegistry
559
559
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
560
560
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
561
561
  ["country", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Country")], [0, 1]],
562
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Address")], [0, 1]],
562
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "G4sTracking::Address")], [0, 1]],
563
563
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "City")], [0, 1]],
564
564
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "State")], [0, 1]],
565
565
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "CountryCode")], [0, 1]],
@@ -574,7 +574,7 @@ module DefaultMappingRegistry
574
574
  :schema_element => [
575
575
  ["name", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Name")], [0, 1]],
576
576
  ["company", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Company")], [0, 1]],
577
- ["address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "Address")], [0, 1]],
577
+ ["G4sTracking::Address", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "G4sTracking::Address")], [0, 1]],
578
578
  ["city", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "City")], [0, 1]],
579
579
  ["state", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "State")], [0, 1]],
580
580
  ["countryCode", ["SOAP::SOAPString", XSD::QName.new(NsTempuriOrg, "CountryCode")], [0, 1]],
data/lib/g4s_client.rb CHANGED
@@ -1,20 +1,23 @@
1
+ # soap headers are put on the driver, and not changed per request in soap4r. this page offers a workaround:
2
+ # http://emphaticsolutions.com/2008/05/06/soap-headers-per-request-in-ruby.html
1
3
 
2
4
  #puts "REQUIRING: #{Dir[__FILE__]}"
3
5
 
4
6
  [ "g4s/shipping/default",
5
7
  "g4s/shipping/defaultDriver",
6
8
  "g4s/shipping/defaultMappingRegistry",
7
- #"g4s/shipping/IPSShippingClient",
8
9
  "g4s/tracking/default",
9
10
  "g4s/tracking/defaultDriver",
10
- #"g4s/tracking/IPSTrackingClient",
11
11
  "g4s/tracking/defaultMappingRegistry",
12
12
  "g4s/utilities/default",
13
13
  "g4s/utilities/defaultDriver",
14
- #"g4s/utilities/IPSUtilitiesClient",
15
14
  "g4s/utilities/defaultMappingRegistry",
16
15
  "g4s/g4s",
17
- "g4s/g4si_auth_header",
16
+ "g4s/insured_ship",
17
+ "g4s/headers/custom_header",
18
+ "g4s/headers/g4si_auth_header",
19
+ "g4s/headers/shipment_request_header",
20
+ "g4s/headers/g4s_namespace_filter",
18
21
  "version"].each{|f| require f}
19
22
 
20
23
  module G4sClient
@@ -31,12 +34,12 @@ module G4sClient
31
34
  end
32
35
 
33
36
  class ShippingTest < G4sClient::Shipping
34
- def initialize; super("https://wsuat.g4si.com/IPSutilities.asmx"); end
37
+ def initialize; super("https://wsuat.g4si.com/IPSshipping.asmx"); end
35
38
  def auth; @authentication ||= G4SIAuthentication.new(CONFIG['test']['username'], CONFIG['test']['password'], CONFIG['test']['access_key']); end #TODO: dry
36
39
  end
37
40
 
38
41
  class ShippingLive < G4sClient::Shipping
39
- def initialize; super("https://ws.g4si.com/IPSutilities.asmx"); end
42
+ def initialize; super("https://ws.g4si.com/IPSshipping.asmx"); end
40
43
  def auth; @authentication ||= G4SIAuthentication.new(CONFIG['live']['username'], CONFIG['live']['password'], CONFIG['live']['access_key']); end
41
44
  end
42
45
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #puts "REQUIRING: #{Dir[__FILE__]}"
2
2
 
3
3
  module G4sClient
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g4s_client
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 4
9
- version: 0.1.4
9
+ - 6
10
+ version: 0.1.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - Rob Tierney
@@ -34,7 +35,11 @@ files:
34
35
  - Rakefile
35
36
  - g4s_client.gemspec
36
37
  - lib/g4s/g4s.rb
37
- - lib/g4s/g4si_auth_header.rb
38
+ - lib/g4s/headers/custom_header.rb
39
+ - lib/g4s/headers/g4s_namespace_filter.rb
40
+ - lib/g4s/headers/g4si_auth_header.rb
41
+ - lib/g4s/headers/shipment_request_header.rb
42
+ - lib/g4s/insured_ship.rb
38
43
  - lib/g4s/shipping/IPSShippingClient.rb
39
44
  - lib/g4s/shipping/default.rb
40
45
  - lib/g4s/shipping/defaultDriver.rb
@@ -64,23 +69,27 @@ require_paths:
64
69
  - lib/g4s/tracking
65
70
  - lib/g4s/utilities
66
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
67
73
  requirements:
68
74
  - - ">="
69
75
  - !ruby/object:Gem::Version
76
+ hash: 3
70
77
  segments:
71
78
  - 0
72
79
  version: "0"
73
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
74
82
  requirements:
75
83
  - - ">="
76
84
  - !ruby/object:Gem::Version
85
+ hash: 3
77
86
  segments:
78
87
  - 0
79
88
  version: "0"
80
89
  requirements: []
81
90
 
82
91
  rubyforge_project:
83
- rubygems_version: 1.3.6
92
+ rubygems_version: 1.4.2
84
93
  signing_key:
85
94
  specification_version: 3
86
95
  summary: G4S SOAP Client