purolator_ruby 0.0.5 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8050c49b95ac96e1b0e9e17214d989cb559649c
4
- data.tar.gz: 858fd25b68c2c9fc9e63cb345a3ec453be0b4557
3
+ metadata.gz: 8fc4eeac1e5ce71eb87107f4d662925fdedb0c99
4
+ data.tar.gz: 53a77989dbacc488ccb22f93f4336d17057e9727
5
5
  SHA512:
6
- metadata.gz: d3d2ce23fd8c99f2f56966da09661dfb0fa93e96183041fbcb2849564ca292e4aaada0184884dcc1ad6b0a76d8cfbd23bdab21f9d5d08c5b8cb5690eaef1d1cc
7
- data.tar.gz: 1de879eab2f59e2d1869d5dd98cfd0303ebcc80fb66238ef75144028aae88142015440b41803b6f92ba353b44bd816bac2c03af46939689ed86e55ff65bf4e35
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
- errors = response[:response_information][:errors].map {|k, v| v[:description]}
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
@@ -1,3 +1,3 @@
1
1
  module PurolatorRuby
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -20,7 +20,7 @@ http_interactions:
20
20
  Accept:
21
21
  - "*/*"
22
22
  Date:
23
- - Wed, 22 Jul 2015 07:54:43 GMT
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 07:54:44 GMT
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>329018601149</Value></ShipmentPIN><PiecePINs><PIN><Value>329018601149</Value></PIN></PiecePINs><ReturnShipmentPINs/><ExpressChequePIN><Value/></ExpressChequePIN></CreateShipmentResponse></s:Body></s:Envelope>
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 07:54:44 GMT
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('329018601149')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purolator_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Filipov