tracking_number 0.8.0 → 0.8.5

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: a7a9c5677ad09e2aedac157290e596a26bff2fb7
4
- data.tar.gz: a922ec482d27dc5fa2740bca7ef9971a7ce2f5cd
3
+ metadata.gz: 7a1676f2d893d95708b47cd37c7458b822458ea0
4
+ data.tar.gz: 63f9151dd0ba5e99c598414479196002e8cc55b5
5
5
  SHA512:
6
- metadata.gz: 6e80c241e53d78c3227f4303733c423aff038f4fee9c7116d734c7e3bd92b06a07ffd86021a017db755626d34b0e214fd86e3f51ee78ce1888c269ae083bfe41
7
- data.tar.gz: 313f59b1e537cbe5ff0ab0916266ec63828f97b0a9bd1e4fc8194a47dda2276946b59d31cad36f4e268e017a1ff550a972dae4191dfa14933f004f2af8634f5c
6
+ metadata.gz: 851d1e6a199f751c90f56c0460cfbcf6a158c78d4de2ba265d3d981cd2580e90bde2b4f792631d0b72df7135cc6c7a4edb53547a3797fa26719e1841d7bc0760
7
+ data.tar.gz: 5ec61555863d9eb6df8df98375a0657d0c8a7b892f1f053c989211d5152c0175b2f9f4e78407d3a77dafcd73a7cece76223405b360b63c31c0608ef43859f76a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.8.5
@@ -6,13 +6,13 @@ module TrackingNumber
6
6
  end
7
7
 
8
8
  class USPS91 < USPS
9
- SEARCH_PATTERN = [/(\b9\s*[14]\s*(([0-9]\s*){20,20}\b))/, /(\b([0-9]\s*){20,20}\b)/]
10
- VERIFY_PATTERN = /^(9[14][0-9]{19,19})([0-9])$/
9
+ SEARCH_PATTERN = [/(\b9\s*[145]\s*(([0-9]\s*){20,20}\b))/, /(\b([0-9]\s*){20,20}\b)/]
10
+ VERIFY_PATTERN = /^(9[145][0-9]{19,19})([0-9])$/
11
11
 
12
12
  # Sometimes these numbers will appear without the leading 91 or 94, though, so we need to account for that case
13
13
 
14
14
  def decode
15
- # Application ID: 91 or 94
15
+ # Application ID: 91 or 94 or 95
16
16
  # Service Code: 2 Digits
17
17
  # Mailer Id: 8 Digits
18
18
  # Package Id: 9 Digits
@@ -27,7 +27,7 @@ module TrackingNumber
27
27
  end
28
28
 
29
29
  def matches
30
- if self.tracking_number =~ /^9[14]/
30
+ if self.tracking_number =~ /^9[145]/
31
31
  self.tracking_number.scan(VERIFY_PATTERN).flatten
32
32
  else
33
33
  "91#{self.tracking_number}".scan(VERIFY_PATTERN).flatten
@@ -35,7 +35,7 @@ module TrackingNumber
35
35
  end
36
36
 
37
37
  def valid_checksum?
38
- if self.tracking_number =~ /^9[14]/
38
+ if self.tracking_number =~ /^9[145]/
39
39
  return true if weighted_usps_checksum_valid?(tracking_number)
40
40
  else
41
41
  if weighted_usps_checksum_valid?("91#{self.tracking_number}")
@@ -146,4 +146,4 @@ module TrackingNumber
146
146
  return check == check_digit
147
147
  end
148
148
  end
149
- end
149
+ end
@@ -1,3 +1,3 @@
1
1
  module TrackingNumber
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.5"
3
3
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class USPSTrackingNumberTest < Minitest::Test
4
4
  context "a USPS tracking number" do
5
- ["9101 1234 5678 9000 0000 13", "7196 9010 7560 0307 7385", "9400 1112 0108 0805 4830 16"].each do |valid_number|
5
+ ["9101 1234 5678 9000 0000 13", "7196 9010 7560 0307 7385", "9400 1112 0108 0805 4830 16", "9505 5110 6960 5048 6006 24"].each do |valid_number|
6
6
  should "return usps with valid 22 digit number: #{valid_number}" do
7
7
  should_be_valid_number(valid_number, TrackingNumber::USPS91, :usps)
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracking_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Keen