purolator_ruby 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc4eeac1e5ce71eb87107f4d662925fdedb0c99
|
4
|
+
data.tar.gz: 53a77989dbacc488ccb22f93f4336d17057e9727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5faffc68d0db22afc08f426745cb060c2b2ec4e2ac71e314cdde8d143cfd8bb36c09be1fa205efe76a741f9cfd747f6350e090d6c291fa659239bea98c96c7a
|
7
|
+
data.tar.gz: 64fb9375838b3fe135597ee30ba5dd0614b279ab4d1e175abdac46415f566998bdb4972c2c44661c125d85cda3ac3bc0545998f1eab7b0884f11afddf8ddf0a6
|
@@ -16,6 +16,7 @@ module PurolatorRuby
|
|
16
16
|
def send!
|
17
17
|
send.tap do |resp|
|
18
18
|
if resp.status == :error
|
19
|
+
puts resp
|
19
20
|
raise ArgumentError, resp.errors
|
20
21
|
end
|
21
22
|
end
|
@@ -32,7 +33,11 @@ module PurolatorRuby
|
|
32
33
|
if response[:shipment_pin]
|
33
34
|
CreateShipmentResponse.new(:ok, response[:shipment_pin][:value], payload, nil)
|
34
35
|
else
|
35
|
-
|
36
|
+
begin
|
37
|
+
errors = response[:response_information][:errors].map {|k, v| v[:description]}
|
38
|
+
rescue TypeError
|
39
|
+
errors = response[:response_information][:errors].map(&:to_s)
|
40
|
+
end
|
36
41
|
CreateShipmentResponse.new(:error, nil, payload, errors)
|
37
42
|
end
|
38
43
|
else
|
@@ -20,7 +20,7 @@ http_interactions:
|
|
20
20
|
Accept:
|
21
21
|
- "*/*"
|
22
22
|
Date:
|
23
|
-
- Wed, 22 Jul 2015
|
23
|
+
- Wed, 22 Jul 2015 11:35:14 GMT
|
24
24
|
Soapaction:
|
25
25
|
- '"http://purolator.com/pws/service/v1/CreateShipment"'
|
26
26
|
Content-Type:
|
@@ -45,14 +45,14 @@ http_interactions:
|
|
45
45
|
X-Powered-By:
|
46
46
|
- ASP.NET
|
47
47
|
Date:
|
48
|
-
- Wed, 22 Jul 2015
|
48
|
+
- Wed, 22 Jul 2015 11:35:14 GMT
|
49
49
|
body:
|
50
50
|
encoding: UTF-8
|
51
51
|
string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ResponseContext
|
52
52
|
xmlns:h="http://purolator.com/pws/datatypes/v1" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><h:ResponseReference>Rating
|
53
53
|
Example</h:ResponseReference></h:ResponseContext></s:Header><s:Body><CreateShipmentResponse
|
54
54
|
xmlns="http://purolator.com/pws/datatypes/v1" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ResponseInformation><Errors/><InformationalMessages
|
55
|
-
i:nil="true"/></ResponseInformation><ShipmentPIN><Value>
|
55
|
+
i:nil="true"/></ResponseInformation><ShipmentPIN><Value>329018601172</Value></ShipmentPIN><PiecePINs><PIN><Value>329018601172</Value></PIN></PiecePINs><ReturnShipmentPINs/><ExpressChequePIN><Value/></ExpressChequePIN></CreateShipmentResponse></s:Body></s:Envelope>
|
56
56
|
http_version:
|
57
|
-
recorded_at: Wed, 22 Jul 2015
|
57
|
+
recorded_at: Wed, 22 Jul 2015 11:35:15 GMT
|
58
58
|
recorded_with: VCR 2.9.3
|
@@ -28,7 +28,7 @@ describe PurolatorRuby::CreateShipmentRequest do
|
|
28
28
|
it "succesfully communicates with ShippingService and returns shipment pin" do
|
29
29
|
VCR.use_cassette('shipping_service_integration') do
|
30
30
|
response = subject.send!
|
31
|
-
expect(response.shipment_pin).to eq('
|
31
|
+
expect(response.shipment_pin).to eq('329018601172')
|
32
32
|
expect(response.status).to eq(:ok)
|
33
33
|
end
|
34
34
|
end
|
@@ -49,4 +49,16 @@ describe PurolatorRuby::CreateShipmentRequest do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
context "invalid but from soap side" do
|
53
|
+
subject do
|
54
|
+
described_class.new(client: client, sender_address: sender_address, receiver_address: receiver_address, shipping_date: Date.new(2014,01,01), weight: '0', pieces: 0, reference: '1')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "raises ArgumentError" do
|
58
|
+
VCR.use_cassette('shipping_service_integration_2') do
|
59
|
+
expect { subject.send!.status }.to raise_error(ArgumentError)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
52
64
|
end
|