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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df4a4e3cfe41cda6005c04277c3fe74d8d0ebe92
4
- data.tar.gz: 35d11d25331eb27649c091185fcbc7d74929bbb4
3
+ metadata.gz: aa7977d6c19198a31b34dc25edb0f9866da8b051
4
+ data.tar.gz: 364af7ed159396db35a037286d09f358197bf530
5
5
  SHA512:
6
- metadata.gz: 78f475f464a5b764beba5c8fa7370086d31eb19f405533aba842ab6b8fbdc43a92a9e576a15498c1e5eb1694c8257434a195ad9640c8803d9328b265b8e6acd7
7
- data.tar.gz: d471a942bb9fd59eaa213c18489c9cd9b3072344542b217142ab42539f8554cbcd214173f46e1c9d7fa980d786eebceee2ad522268908f389a83e32a88231d15
6
+ metadata.gz: 547cfa35209ba8c7bdb6713fdb64880f008238f61a9df153da4f8caa91c23b1ee72365cad68c7a2b844fd806f8818a708158f922bd3876d1dc8e953a2dc8530e
7
+ data.tar.gz: d7900bce34fe3712b4ef4153d7792c1279ad9eeca25ce961ffcbf077d7154ed2b4ce9cc7c40ad99c82c5868f083e4b32da4b1c4590a476669338a2f20ec1bad6
@@ -3,9 +3,8 @@ module PolarExpress
3
3
  module DHL
4
4
  class Tracker
5
5
  attr_accessor :number
6
- def initialize(number)
7
- number.gsub!(/[^0-9]/,'')
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)
@@ -4,7 +4,7 @@ module PolarExpress
4
4
  class Tracker
5
5
  attr_accessor :number
6
6
  def initialize(number)
7
- @number = number
7
+ @number = number.dup
8
8
  end
9
9
  def track!
10
10
  info = ShippingInfo.new(@number)
@@ -4,7 +4,7 @@ module PolarExpress
4
4
  class Tracker
5
5
  attr_accessor :number
6
6
  def initialize(number)
7
- @number = number
7
+ @number = number.dup
8
8
  end
9
9
  def track!
10
10
  info = ShippingInfo.new(@number)
@@ -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
- @shipping_number = shipping_number
7
- @courier_tracker = Object.const_get("PolarExpress::#{@courier}::Tracker").new(@shipping_number)
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!
@@ -1,3 +1,3 @@
1
1
  module PolarExpress
2
- VERSION = "0.0.7.alpha"
2
+ VERSION = "0.0.8.alpha"
3
3
  end
@@ -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', '777.707971 894')
33
- tracker.shipping_number.should == '777707971894'
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.7.alpha
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-27 00:00:00.000000000 Z
11
+ date: 2013-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler