polar_express 0.0.7.alpha → 0.0.8.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/polar_express/dhl.rb +2 -3
- data/lib/polar_express/gls.rb +1 -1
- data/lib/polar_express/hermes.rb +1 -1
- data/lib/polar_express/tracker.rb +3 -3
- data/lib/polar_express/version.rb +1 -1
- data/spec/polar_express/dhl_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa7977d6c19198a31b34dc25edb0f9866da8b051
|
4
|
+
data.tar.gz: 364af7ed159396db35a037286d09f358197bf530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 547cfa35209ba8c7bdb6713fdb64880f008238f61a9df153da4f8caa91c23b1ee72365cad68c7a2b844fd806f8818a708158f922bd3876d1dc8e953a2dc8530e
|
7
|
+
data.tar.gz: d7900bce34fe3712b4ef4153d7792c1279ad9eeca25ce961ffcbf077d7154ed2b4ce9cc7c40ad99c82c5868f083e4b32da4b1c4590a476669338a2f20ec1bad6
|
data/lib/polar_express/dhl.rb
CHANGED
@@ -3,9 +3,8 @@ module PolarExpress
|
|
3
3
|
module DHL
|
4
4
|
class Tracker
|
5
5
|
attr_accessor :number
|
6
|
-
def initialize(
|
7
|
-
number.gsub
|
8
|
-
@number = number
|
6
|
+
def initialize(shipment_number)
|
7
|
+
@number = shipment_number.dup.gsub(/[^A-Za-z0-9]/,'')
|
9
8
|
end
|
10
9
|
def track!
|
11
10
|
info = ShippingInfo.new(@number)
|
data/lib/polar_express/gls.rb
CHANGED
data/lib/polar_express/hermes.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
module PolarExpress
|
1
|
+
module PolarExpress
|
2
2
|
class Tracker
|
3
3
|
attr_reader :courier, :shipping_number
|
4
4
|
def initialize(courier, shipping_number)
|
5
5
|
@courier = PolarExpress::identify_courier(courier)
|
6
|
-
@
|
7
|
-
@
|
6
|
+
@courier_tracker = Object.const_get("PolarExpress::#{@courier}::Tracker").new(shipping_number)
|
7
|
+
@shipping_number = @courier_tracker.number
|
8
8
|
end
|
9
9
|
def track!
|
10
10
|
@track ||= @courier_tracker.track!
|
@@ -28,9 +28,9 @@ describe PolarExpress do
|
|
28
28
|
pp unrecognized_statuses unless unrecognized_statuses.empty?
|
29
29
|
unrecognized_statuses.should be_empty
|
30
30
|
end
|
31
|
-
it "only considers numbers from tracking number" do
|
32
|
-
tracker = PolarExpress.new('DHL', '
|
33
|
-
tracker.shipping_number.should == '
|
31
|
+
it "only considers numbers and letters from tracking number" do
|
32
|
+
tracker = PolarExpress.new('DHL', '77A7.707971 894')
|
33
|
+
tracker.shipping_number.should == '77A7707971894'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polar_express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Tomás Albornoz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|