g4s_client 0.1.2 → 0.1.4
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/.gitignore +1 -0
- data/g4s_client.gemspec +4 -4
- data/lib/g4s/g4s.rb +30 -20
- data/lib/g4s/g4si_auth_header.rb +21 -0
- data/lib/g4s/shipping/IPSShippingClient.rb +3 -0
- data/lib/g4s/shipping/default.rb +507 -504
- data/lib/g4s/shipping/defaultDriver.rb +61 -50
- data/lib/g4s/tracking/IPSTrackingClient.rb +5 -1
- data/lib/g4s/tracking/default.rb +813 -808
- data/lib/g4s/tracking/defaultDriver.rb +77 -67
- data/lib/g4s/tracking/defaultMappingRegistry.rb +4 -1
- data/lib/g4s/utilities/IPSUtilitiesClient.rb +3 -1
- data/lib/g4s/utilities/default.rb +401 -397
- data/lib/g4s/utilities/defaultDriver.rb +214 -203
- data/lib/g4s/utilities/defaultMappingRegistry.rb +3 -1
- data/lib/g4s_client.rb +85 -0
- data/lib/version.rb +5 -0
- metadata +11 -10
- data/lib/g4s/version.rb +0 -3
@@ -1,215 +1,226 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#puts "REQUIRING: #{Dir[__FILE__]}"
|
2
|
+
|
3
|
+
require 'g4s/utilities/default.rb'
|
4
|
+
require 'g4s/utilities/defaultMappingRegistry.rb'
|
3
5
|
require 'soap/rpc/driver'
|
4
6
|
|
5
|
-
class
|
6
|
-
|
7
|
+
class Utilities
|
8
|
+
class IPSUtilitiesSoap < ::SOAP::RPC::Driver
|
9
|
+
DefaultEndpointUrl = "https://ws.g4si.com/IPSutilities.asmx"
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
11
|
+
Methods = [
|
12
|
+
[ "http://tempuri.org/GenerateAccessKey",
|
13
|
+
"generateAccessKey",
|
14
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GenerateAccessKey"]],
|
15
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GenerateAccessKeyResponse"]] ],
|
16
|
+
{ :request_style => :document, :request_use => :literal,
|
17
|
+
:response_style => :document, :response_use => :literal,
|
18
|
+
:faults => {} }
|
19
|
+
],
|
20
|
+
[ "http://tempuri.org/GetNewManifestNumber",
|
21
|
+
"getNewManifestNumber",
|
22
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetNewManifestNumber"]],
|
23
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetNewManifestNumberResponse"]] ],
|
24
|
+
{ :request_style => :document, :request_use => :literal,
|
25
|
+
:response_style => :document, :response_use => :literal,
|
26
|
+
:faults => {} }
|
27
|
+
],
|
28
|
+
[ "http://tempuri.org/GetReferenceNumber",
|
29
|
+
"getReferenceNumber",
|
30
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetReferenceNumber"]],
|
31
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetReferenceNumberResponse"]] ],
|
32
|
+
{ :request_style => :document, :request_use => :literal,
|
33
|
+
:response_style => :document, :response_use => :literal,
|
34
|
+
:faults => {} }
|
35
|
+
],
|
36
|
+
[ "http://tempuri.org/GetG4SIPickupLocationList",
|
37
|
+
"getG4SIPickupLocationList",
|
38
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SIPickupLocationList"]],
|
39
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SIPickupLocationListResponse"]] ],
|
40
|
+
{ :request_style => :document, :request_use => :literal,
|
41
|
+
:response_style => :document, :response_use => :literal,
|
42
|
+
:faults => {} }
|
43
|
+
],
|
44
|
+
[ "http://tempuri.org/GetG4SICODCollectTypeList",
|
45
|
+
"getG4SICODCollectTypeList",
|
46
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SICODCollectTypeList"]],
|
47
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SICODCollectTypeListResponse"]] ],
|
48
|
+
{ :request_style => :document, :request_use => :literal,
|
49
|
+
:response_style => :document, :response_use => :literal,
|
50
|
+
:faults => {} }
|
51
|
+
],
|
52
|
+
[ "http://tempuri.org/GetG4SICurrencies",
|
53
|
+
"getG4SICurrencies",
|
54
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SICurrencies"]],
|
55
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetG4SICurrenciesResponse"]] ],
|
56
|
+
{ :request_style => :document, :request_use => :literal,
|
57
|
+
:response_style => :document, :response_use => :literal,
|
58
|
+
:faults => {} }
|
59
|
+
],
|
60
|
+
[ "http://tempuri.org/CompressedBytesToString",
|
61
|
+
"compressedBytesToString",
|
62
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "CompressedBytesToString"]],
|
63
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "CompressedBytesToStringResponse"]] ],
|
64
|
+
{ :request_style => :document, :request_use => :literal,
|
65
|
+
:response_style => :document, :response_use => :literal,
|
66
|
+
:faults => {} }
|
67
|
+
],
|
68
|
+
[ "http://tempuri.org/StringToCompressedBytes",
|
69
|
+
"stringToCompressedBytes",
|
70
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "StringToCompressedBytes"]],
|
71
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "StringToCompressedBytesResponse"]] ],
|
72
|
+
{ :request_style => :document, :request_use => :literal,
|
73
|
+
:response_style => :document, :response_use => :literal,
|
74
|
+
:faults => {} }
|
75
|
+
],
|
76
|
+
[ "http://tempuri.org/Login",
|
77
|
+
"login",
|
78
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "Login"]],
|
79
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "LoginResponse"]] ],
|
80
|
+
{ :request_style => :document, :request_use => :literal,
|
81
|
+
:response_style => :document, :response_use => :literal,
|
82
|
+
:faults => {} }
|
83
|
+
],
|
84
|
+
[ "http://tempuri.org/GetAllCountries",
|
85
|
+
"getAllCountries",
|
86
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetAllCountries"]],
|
87
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetAllCountriesResponse"]] ],
|
88
|
+
{ :request_style => :document, :request_use => :literal,
|
89
|
+
:response_style => :document, :response_use => :literal,
|
90
|
+
:faults => {} }
|
91
|
+
],
|
92
|
+
[ "http://tempuri.org/GetServiceLevelsByZip",
|
93
|
+
"getServiceLevelsByZip",
|
94
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetServiceLevelsByZip"]],
|
95
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetServiceLevelsByZipResponse"]] ],
|
96
|
+
{ :request_style => :document, :request_use => :literal,
|
97
|
+
:response_style => :document, :response_use => :literal,
|
98
|
+
:faults => {} }
|
99
|
+
],
|
100
|
+
[ "http://tempuri.org/GetSrvcLvls",
|
101
|
+
"getSrvcLvls",
|
102
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetSrvcLvls"]],
|
103
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetSrvcLvlsResponse"]] ],
|
104
|
+
{ :request_style => :document, :request_use => :literal,
|
105
|
+
:response_style => :document, :response_use => :literal,
|
106
|
+
:faults => {} }
|
107
|
+
],
|
108
|
+
[ "http://tempuri.org/GetSrvcLvlByShipersCountryAndZip",
|
109
|
+
"getSrvcLvlByShipersCountryAndZip",
|
110
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetSrvcLvlByShipersCountryAndZip"]],
|
111
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetSrvcLvlByShipersCountryAndZipResponse"]] ],
|
112
|
+
{ :request_style => :document, :request_use => :literal,
|
113
|
+
:response_style => :document, :response_use => :literal,
|
114
|
+
:faults => {} }
|
115
|
+
],
|
116
|
+
[ "http://tempuri.org/GetCarriersList",
|
117
|
+
"getCarriersList",
|
118
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCarriersList"]],
|
119
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCarriersListResponse"]] ],
|
120
|
+
{ :request_style => :document, :request_use => :literal,
|
121
|
+
:response_style => :document, :response_use => :literal,
|
122
|
+
:faults => {} }
|
123
|
+
],
|
124
|
+
[ "http://tempuri.org/GetPackageTypes",
|
125
|
+
"getPackageTypes",
|
126
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetPackageTypes"]],
|
127
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetPackageTypesResponse"]] ],
|
128
|
+
{ :request_style => :document, :request_use => :literal,
|
129
|
+
:response_style => :document, :response_use => :literal,
|
130
|
+
:faults => {} }
|
131
|
+
],
|
132
|
+
[ "http://tempuri.org/GetStatesByCountry",
|
133
|
+
"getStatesByCountry",
|
134
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetStatesByCountry"]],
|
135
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetStatesByCountryResponse"]] ],
|
136
|
+
{ :request_style => :document, :request_use => :literal,
|
137
|
+
:response_style => :document, :response_use => :literal,
|
138
|
+
:faults => {} }
|
139
|
+
],
|
140
|
+
[ "http://tempuri.org/GetDimensions",
|
141
|
+
"getDimensions",
|
142
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetDimensions"]],
|
143
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetDimensionsResponse"]] ],
|
144
|
+
{ :request_style => :document, :request_use => :literal,
|
145
|
+
:response_style => :document, :response_use => :literal,
|
146
|
+
:faults => {} }
|
147
|
+
],
|
148
|
+
[ "http://tempuri.org/GetHarmonizedCodes_CountryFrom",
|
149
|
+
"getHarmonizedCodes_CountryFrom",
|
150
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetHarmonizedCodes_CountryFrom"]],
|
151
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetHarmonizedCodes_CountryFromResponse"]] ],
|
152
|
+
{ :request_style => :document, :request_use => :literal,
|
153
|
+
:response_style => :document, :response_use => :literal,
|
154
|
+
:faults => {} }
|
155
|
+
],
|
156
|
+
[ "http://tempuri.org/GetHarmonizedCodes_CountryFrom_CountryTo",
|
157
|
+
"getHarmonizedCodes_CountryFrom_CountryTo",
|
158
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetHarmonizedCodes_CountryFrom_CountryTo"]],
|
159
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetHarmonizedCodes_CountryFrom_CountryToResponse"]] ],
|
160
|
+
{ :request_style => :document, :request_use => :literal,
|
161
|
+
:response_style => :document, :response_use => :literal,
|
162
|
+
:faults => {} }
|
163
|
+
],
|
164
|
+
[ "http://tempuri.org/GetCommodityMeasurmentsPerCarrier",
|
165
|
+
"getCommodityMeasurmentsPerCarrier",
|
166
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCommodityMeasurmentsPerCarrier"]],
|
167
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCommodityMeasurmentsPerCarrierResponse"]] ],
|
168
|
+
{ :request_style => :document, :request_use => :literal,
|
169
|
+
:response_style => :document, :response_use => :literal,
|
170
|
+
:faults => {} }
|
171
|
+
],
|
172
|
+
[ "http://tempuri.org/GetCarrierAcctInfo",
|
173
|
+
"getCarrierAcctInfo",
|
174
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCarrierAcctInfo"]],
|
175
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetCarrierAcctInfoResponse"]] ],
|
176
|
+
{ :request_style => :document, :request_use => :literal,
|
177
|
+
:response_style => :document, :response_use => :literal,
|
178
|
+
:faults => {} }
|
179
|
+
],
|
180
|
+
[ "http://tempuri.org/GetUserInfo",
|
181
|
+
"getUserInfo",
|
182
|
+
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetUserInfo"]],
|
183
|
+
["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "GetUserInfoResponse"]] ],
|
184
|
+
{ :request_style => :document, :request_use => :literal,
|
185
|
+
:response_style => :document, :response_use => :literal,
|
186
|
+
:faults => {} }
|
187
|
+
]
|
184
188
|
]
|
185
|
-
]
|
186
189
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
190
|
+
def initialize(endpoint_url = nil)
|
191
|
+
endpoint_url ||= DefaultEndpointUrl
|
192
|
+
super(endpoint_url, nil)
|
193
|
+
self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
|
194
|
+
self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
|
195
|
+
init_methods
|
196
|
+
end
|
197
|
+
|
198
|
+
private
|
194
199
|
|
195
|
-
|
200
|
+
def init_methods
|
201
|
+
Methods.each do |definitions|
|
202
|
+
opt = definitions.last
|
196
203
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
204
|
+
# TURNS OFF n1 NAMESPACE:
|
205
|
+
opt.merge!({
|
206
|
+
:elementformdefault => true,
|
207
|
+
:attributeformdefault => true
|
208
|
+
})
|
209
|
+
|
210
|
+
|
211
|
+
if opt[:request_style] == :document
|
212
|
+
add_document_operation(*definitions)
|
213
|
+
else
|
214
|
+
add_rpc_operation(*definitions)
|
215
|
+
qname = definitions[0]
|
216
|
+
name = definitions[2]
|
217
|
+
if qname.name != name and qname.name.capitalize == name.capitalize
|
218
|
+
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
219
|
+
__send__(name, *arg)
|
220
|
+
end
|
209
221
|
end
|
210
222
|
end
|
211
223
|
end
|
212
224
|
end
|
213
225
|
end
|
214
|
-
end
|
215
|
-
|
226
|
+
end
|
data/lib/g4s_client.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
|
2
|
+
#puts "REQUIRING: #{Dir[__FILE__]}"
|
3
|
+
|
4
|
+
[ "g4s/shipping/default",
|
5
|
+
"g4s/shipping/defaultDriver",
|
6
|
+
"g4s/shipping/defaultMappingRegistry",
|
7
|
+
#"g4s/shipping/IPSShippingClient",
|
8
|
+
"g4s/tracking/default",
|
9
|
+
"g4s/tracking/defaultDriver",
|
10
|
+
#"g4s/tracking/IPSTrackingClient",
|
11
|
+
"g4s/tracking/defaultMappingRegistry",
|
12
|
+
"g4s/utilities/default",
|
13
|
+
"g4s/utilities/defaultDriver",
|
14
|
+
#"g4s/utilities/IPSUtilitiesClient",
|
15
|
+
"g4s/utilities/defaultMappingRegistry",
|
16
|
+
"g4s/g4s",
|
17
|
+
"g4s/g4si_auth_header",
|
18
|
+
"version"].each{|f| require f}
|
19
|
+
|
20
|
+
module G4sClient
|
21
|
+
|
22
|
+
CONFIG = YAML.load( ENV['G4S_CONFIG'] || File.read(Rails.root + 'config' + 'g4s.yml') )
|
23
|
+
|
24
|
+
class Shipping
|
25
|
+
attr_reader :service
|
26
|
+
def initialize(endpoint=nil)
|
27
|
+
@endpoint = endpoint || ENV['G4S_SHIPPING_ENDPOINT_URL']
|
28
|
+
@service = ::Shipping::IPSShippingSoap.new(@endpoint)
|
29
|
+
@service.headerhandler << G4SIAuthHeader.new(auth.username, auth.password, auth.accessKey) # Add the Authentication to the handler
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class ShippingTest < G4sClient::Shipping
|
34
|
+
def initialize; super("https://wsuat.g4si.com/IPSutilities.asmx"); end
|
35
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['test']['username'], CONFIG['test']['password'], CONFIG['test']['access_key']); end #TODO: dry
|
36
|
+
end
|
37
|
+
|
38
|
+
class ShippingLive < G4sClient::Shipping
|
39
|
+
def initialize; super("https://ws.g4si.com/IPSutilities.asmx"); end
|
40
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['live']['username'], CONFIG['live']['password'], CONFIG['live']['access_key']); end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
class Tracking
|
46
|
+
attr_reader :service
|
47
|
+
def initialize(endpoint=nil)
|
48
|
+
@endpoint = endpoint || ENV['G4S_TRACKING_ENDPOINT_URL']
|
49
|
+
@service = ::Tracking::IPSTrackingSoap.new(@endpoint)
|
50
|
+
@service.headerhandler << G4SIAuthHeader.new(auth.username, auth.password, auth.accessKey) # Add the Authentication to the handler
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class TrackingTest < G4sClient::Tracking
|
55
|
+
def initialize; super("https://wsuat.g4si.com/IPStracking.asmx"); end
|
56
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['test']['username'], CONFIG['test']['password'], CONFIG['test']['access_key']); end
|
57
|
+
end
|
58
|
+
|
59
|
+
class TrackingLive < G4sClient::Tracking
|
60
|
+
def initialize; super("https://ws.g4si.com/IPStracking.asmx"); end
|
61
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['live']['username'], CONFIG['live']['password'], CONFIG['live']['access_key']); end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
class Utilities
|
67
|
+
attr_reader :service
|
68
|
+
def initialize(endpoint=nil)
|
69
|
+
@endpoint = endpoint || ENV['G4S_UTILITIES_ENDPOINT_URL']
|
70
|
+
@service = ::Utilities::IPSUtilitiesSoap.new(@endpoint)
|
71
|
+
@service.headerhandler << G4SIAuthHeader.new(auth.username, auth.password, auth.accessKey) # Add the Authentication to the handler
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class UtilitiesTest < G4sClient::Utilities
|
76
|
+
def initialize; super("https://wsuat.g4si.com/IPSutilities.asmx"); end
|
77
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['test']['username'], CONFIG['test']['password'], CONFIG['test']['access_key']); end
|
78
|
+
end
|
79
|
+
|
80
|
+
class UtilitiesLive < G4sClient::Utilities
|
81
|
+
def initialize; super("https://ws.g4si.com/IPSutilities.asmx"); end
|
82
|
+
def auth; @authentication ||= G4SIAuthentication.new(CONFIG['live']['username'], CONFIG['live']['password'], CONFIG['live']['access_key']); end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g4s_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Rob Tierney
|
@@ -35,6 +34,7 @@ files:
|
|
35
34
|
- Rakefile
|
36
35
|
- g4s_client.gemspec
|
37
36
|
- lib/g4s/g4s.rb
|
37
|
+
- lib/g4s/g4si_auth_header.rb
|
38
38
|
- lib/g4s/shipping/IPSShippingClient.rb
|
39
39
|
- lib/g4s/shipping/default.rb
|
40
40
|
- lib/g4s/shipping/defaultDriver.rb
|
@@ -47,7 +47,8 @@ files:
|
|
47
47
|
- lib/g4s/utilities/default.rb
|
48
48
|
- lib/g4s/utilities/defaultDriver.rb
|
49
49
|
- lib/g4s/utilities/defaultMappingRegistry.rb
|
50
|
-
- lib/
|
50
|
+
- lib/g4s_client.rb
|
51
|
+
- lib/version.rb
|
51
52
|
- notes.txt
|
52
53
|
has_rdoc: true
|
53
54
|
homepage: http://github.com/robtierney/g4s_client
|
@@ -58,28 +59,28 @@ rdoc_options:
|
|
58
59
|
- --charset=UTF-8
|
59
60
|
require_paths:
|
60
61
|
- lib
|
62
|
+
- lib/g4s
|
63
|
+
- lib/g4s/shipping
|
64
|
+
- lib/g4s/tracking
|
65
|
+
- lib/g4s/utilities
|
61
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
67
|
requirements:
|
64
68
|
- - ">="
|
65
69
|
- !ruby/object:Gem::Version
|
66
|
-
hash: 3
|
67
70
|
segments:
|
68
71
|
- 0
|
69
72
|
version: "0"
|
70
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
74
|
requirements:
|
73
75
|
- - ">="
|
74
76
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
77
|
segments:
|
77
78
|
- 0
|
78
79
|
version: "0"
|
79
80
|
requirements: []
|
80
81
|
|
81
82
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
83
|
+
rubygems_version: 1.3.6
|
83
84
|
signing_key:
|
84
85
|
specification_version: 3
|
85
86
|
summary: G4S SOAP Client
|
data/lib/g4s/version.rb
DELETED