tracking_number 1.3.2 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,191 @@
1
+ {
2
+ "name": "UPS",
3
+ "courier_code": "ups",
4
+ "tracking_numbers": [
5
+ {
6
+ "name": "UPS",
7
+ "regex": [
8
+ "\\s*1\\s*Z\\s*(?<SerialNumber>",
9
+ "(?<ShipperId>(?:[A-Z0-9]\\s*){6,6})",
10
+ "(?<ServiceType>(?:[A-Z0-9]\\s*){2,2})",
11
+ "(?<PackageId>(?:[A-Z0-9]\\s*){7,7}))",
12
+ "(?<CheckDigit>[0-9]\\s*)"
13
+ ],
14
+ "validation": {
15
+ "checksum": {
16
+ "name": "mod10",
17
+ "evens_multiplier": 1,
18
+ "odds_multiplier": 2
19
+ }
20
+ },
21
+ "tracking_url": "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%s",
22
+ "additional": [
23
+ {
24
+ "name": "Service Type",
25
+ "regex_group_name": "ServiceType",
26
+ "lookup": [
27
+ {
28
+ "matches": "01",
29
+ "name": "UPS United States Next Day Air (Red)"
30
+ },
31
+ {
32
+ "matches": "02",
33
+ "name": "UPS United States Second Day Air (Blue)"
34
+ },
35
+ {
36
+ "matches": "03",
37
+ "name": "UPS United States Ground"
38
+ },
39
+ {
40
+ "matches": "12",
41
+ "name": "UPS United States Third Day Select"
42
+ },
43
+ {
44
+ "matches": "13",
45
+ "name": "UPS United States Next Day Air Saver (Red Saver)"
46
+ },
47
+ {
48
+ "matches": "15",
49
+ "name": "UPS United States Next Day Air Early A.M."
50
+ },
51
+ {
52
+ "matches": "22",
53
+ "name": "UPS United States Ground - Returns Plus - Three Pickup Attempts"
54
+ },
55
+ {
56
+ "matches": "32",
57
+ "name": "UPS United States Next Day Air Early A.M. - COD"
58
+ },
59
+ {
60
+ "matches": "33",
61
+ "name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, COD"
62
+ },
63
+ {
64
+ "matches": "41",
65
+ "name": "UPS United States Next Day Air Early A.M. - Saturday Delivery"
66
+ },
67
+ {
68
+ "matches": "42",
69
+ "name": "UPS United States Ground - Signature Required"
70
+ },
71
+ {
72
+ "matches": "44",
73
+ "name": "UPS United States Next Day Air - Saturday Delivery"
74
+ },
75
+ {
76
+ "matches": "66",
77
+ "name": "UPS United States Worldwide Express"
78
+ },
79
+ {
80
+ "matches": "72",
81
+ "name": "UPS United States Ground - Collect on Delivery"
82
+ },
83
+ {
84
+ "matches": "78",
85
+ "name": "UPS United States Ground - Returns Plus - One Pickup Attempt"
86
+ },
87
+ {
88
+ "matches": "90",
89
+ "name": "UPS United States Ground - Returns - UPS Prints and Mails Label"
90
+ },
91
+ {
92
+ "matches": "A0",
93
+ "name": "UPS United States Next Day Air Early A.M. - Adult Signature Required"
94
+ },
95
+ {
96
+ "matches": "A1",
97
+ "name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, Adult Signature Required"
98
+ },
99
+ {
100
+ "matches": "A2",
101
+ "name": "UPS United States Next Day Air - Adult Signature Required"
102
+ },
103
+ {
104
+ "matches": "A8",
105
+ "name": "UPS United States Ground - Adult Signature Required"
106
+ },
107
+ {
108
+ "matches": "A9",
109
+ "name": "UPS United States Next Day Air Early A.M. - Adult Signature Required, COD"
110
+ },
111
+ {
112
+ "matches": "AA",
113
+ "name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, Adult Signature Required, COD"
114
+ },
115
+ {
116
+ "matches": "YW",
117
+ "name": "UPS SurePost - Delivered by the USPS"
118
+ }
119
+ ]
120
+ }
121
+ ],
122
+ "test_numbers": {
123
+ "valid": [
124
+ "1Z5R89390357567127",
125
+ "1Z879E930346834440",
126
+ "1Z410E7W0392751591",
127
+ "1Z8V92A70367203024",
128
+ " 1 Z 8 V 9 2 A 7 0 3 6 7 2 0 3 0 2 4 ",
129
+ "1ZXX3150YW44070023"
130
+ ],
131
+ "invalid": [
132
+ "2Z5R89390357567127",
133
+ "1A5R89390357567127",
134
+ "1Z1111111111111111"
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ "name": "UPS Waybill",
140
+ "regex": [
141
+ "\\s*(?<ServiceType>([A-Z]\\s*){1})",
142
+ "(?<SerialNumber>(?:[0-9]\\s*){9})",
143
+ "(?<CheckDigit>[0-9]\\s*){1}"
144
+ ],
145
+ "validation": {
146
+ "checksum": {
147
+ "name": "mod10",
148
+ "evens_multiplier": 1,
149
+ "odds_multiplier": 2
150
+ }
151
+ },
152
+ "additional": [
153
+ {
154
+ "name": "Service Type",
155
+ "regex_group_name": "ServiceType",
156
+ "lookup": [
157
+ {
158
+ "matches": "J",
159
+ "name": "UPS Next Day Express"
160
+ },
161
+ {
162
+ "matches": "K",
163
+ "name": "UPS Ground"
164
+ },
165
+ {
166
+ "matches": "V",
167
+ "name": "UPS WorldWide Express Saver"
168
+ }
169
+ ]
170
+ }
171
+ ],
172
+ "tracking_url": "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%s",
173
+ "test_numbers": {
174
+ "valid": [
175
+ "K1506235620",
176
+ "K2479825491",
177
+ "J4603636537",
178
+ "V0490119172",
179
+ "V0431105627"
180
+ ],
181
+ "invalid": [
182
+ "K1506235622",
183
+ "K2479825492",
184
+ "J4603636538",
185
+ "V0411335627",
186
+ "V0423305841"
187
+ ]
188
+ }
189
+ }
190
+ ]
191
+ }
@@ -0,0 +1,140 @@
1
+ {
2
+ "name": "United States Postal Service",
3
+ "courier_code": "usps",
4
+ "tracking_numbers": [
5
+ {
6
+ "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s",
7
+ "name": "USPS 20",
8
+ "description": "20 digit USPS numbers",
9
+ "regex": [
10
+ "\\s*(?<SerialNumber>",
11
+ "(?<ServiceType>([0-9]\\s*){2})",
12
+ "(?<ShipperId>([0-9]\\s*){9})",
13
+ "(?<PackageId>([0-9]\\s*){8})",
14
+ ")",
15
+ "(?<CheckDigit>[0-9]\\s*)"
16
+ ],
17
+ "validation": {
18
+ "checksum": {
19
+ "name": "mod10",
20
+ "evens_multiplier": 3,
21
+ "odds_multiplier": 1
22
+ }
23
+ },
24
+ "test_numbers": {
25
+ "valid": [
26
+ "0307 1790 0005 2348 3741",
27
+ " 0 3 0 7 1 7 9 0 0 0 0 5 2 3 4 8 3 7 4 1 ",
28
+ "7112 3456 7891 2345 6787"
29
+ ],
30
+ "invalid": [
31
+ "0307 1790 0005 2348 3742"
32
+ ]
33
+ },
34
+ "additional": [
35
+ {
36
+ "name": "Service Type",
37
+ "regex_group_name": "ServiceType",
38
+ "lookup": [
39
+ {
40
+ "matches": "71",
41
+ "name": "Certified Mail"
42
+ },
43
+ {
44
+ "matches": "73",
45
+ "name": "Insured Mail"
46
+ },
47
+ {
48
+ "matches": "77",
49
+ "name": "Registered Mail"
50
+ },
51
+ {
52
+ "matches": "81",
53
+ "name": "Return Receipt For Merchanise"
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "name": "USPS 34v2",
61
+ "description": "variation on 34 digit USPS IMpd numbers",
62
+ "regex": [
63
+ "\\s*(?<RoutingApplicationId>4\\s*2\\s*0\\s*)(?<DestinationZip>([0-9]\\s*){5})",
64
+ "(?<RoutingNumber>([0-9]\\s*){4})",
65
+ "(?<SerialNumber>",
66
+ "(?<ApplicationIdentifier>9\\s*[2345]\\s*)?",
67
+ "(?<ShipperId>([0-9]\\s*){8})",
68
+ "(?<PackageId>([0-9]\\s*){11})",
69
+ ")",
70
+ "(?<CheckDigit>[0-9]\\s*)"
71
+ ],
72
+ "validation": {
73
+ "checksum": {
74
+ "name": "mod10",
75
+ "evens_multiplier": 3,
76
+ "odds_multiplier": 1
77
+ }
78
+ },
79
+ "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s",
80
+ "test_numbers": {
81
+ "valid": [
82
+ "4201002334249200190132607600833457",
83
+ "4201028200009261290113185417468510",
84
+ " 4 2 0 1 0 2 8 2 0 0 0 0 9 2 6 1 2 9 0 1 1 3 1 8 5 4 1 7 4 6 8 5 1 0 "
85
+ ],
86
+ "invalid": [
87
+ "4201028200009261290113185417468511"
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "name": "USPS 91",
93
+ "description": "USPS now calls this the IMpd barcode format",
94
+ "regex": [
95
+ "\\s*(?:(?<RoutingApplicationId>4\\s*2\\s*0\\s*)(?<DestinationZip>([0-9]\\s*){5}))?",
96
+ "(?<SerialNumber>",
97
+ "(?<ApplicationIdentifier>9\\s*[12345]\\s*)?",
98
+ "(?<SCNC>([0-9]\\s*){2})",
99
+ "(?<ServiceType>([0-9]\\s*){2})",
100
+ "(?<ShipperId>([0-9]\\s*){8})",
101
+ "(?<PackageId>([0-9]\\s*){11}|([0-9]\\s*){7})",
102
+ ")",
103
+ "(?<CheckDigit>[0-9]\\s*)"
104
+ ],
105
+ "validation": {
106
+ "checksum": {
107
+ "name": "mod10",
108
+ "evens_multiplier": 3,
109
+ "odds_multiplier": 1
110
+ },
111
+ "serial_number_format": {
112
+ "prepend_if": {
113
+ "matches_regex": "^(?!9[1-5]).+",
114
+ "content": "91"
115
+ }
116
+ }
117
+ },
118
+ "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s",
119
+ "test_numbers": {
120
+ "valid": [
121
+ "420 22153 9101026837331000039521",
122
+ "7196 9010 7560 0307 7385",
123
+ "9505 5110 6960 5048 6006 24",
124
+ "9101 1234 5678 9000 0000 13",
125
+ "92748931507708513018050063",
126
+ "9400 1112 0108 0805 4830 16",
127
+ "9361 2898 7870 0317 6337 95",
128
+ " 9 3 6 1 2 8 9 8 7 8 7 0 0 3 1 7 6 3 3 7 9 5 ",
129
+ "9405803699300124287899"
130
+ ],
131
+ "invalid": [
132
+ "61299998820821171811",
133
+ "9200000000000000000000",
134
+ "420000000000000000000000000000",
135
+ "420000009200000000000000000000"
136
+ ]
137
+ }
138
+ }
139
+ ]
140
+ }
@@ -1,3 +1,3 @@
1
1
  module TrackingNumber
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.5"
3
3
  end
@@ -17,19 +17,28 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
- gem_dir = "#{File.expand_path(File.join(__FILE__, '..'))}/"
21
20
 
21
+ gem_dir = "#{File.expand_path(File.join(__FILE__, '..'))}/"
22
22
  `git submodule --quiet foreach pwd`.split($OUTPUT_RECORD_SEPARATOR).each do |submodule_path|
23
23
  Dir.chdir(submodule_path.chomp) do
24
24
  submodule_relative_path = submodule_path.sub gem_dir, ''
25
- # issue git ls-files in submodule's directory and
25
+
26
+ # issue git ls-files in submodule's directory
27
+ submodule_files = `git ls-files -- couriers/*`.split($OUTPUT_RECORD_SEPARATOR)
28
+
26
29
  # prepend the submodule path to create absolute file paths
30
+ submodule_files_fullpaths = submodule_files.map do |filename|
31
+ "#{submodule_path}/#{filename}"
32
+ end
27
33
 
28
- `git ls-files -- couriers/*`.split($OUTPUT_RECORD_SEPARATOR).each do |filename|
29
- file_path = "#{submodule_relative_path}/#{filename}"
30
- puts "adding file #{file_path}"
31
- s.files << file_path
34
+ # remove leading path parts to get paths relative to the gem's root dir
35
+ # (this assumes, that the gemspec resides in the gem's root dir)
36
+ submodule_files_paths = submodule_files_fullpaths.map do |filename|
37
+ filename.gsub gem_dir, ''
32
38
  end
39
+
40
+ # add relative paths to gem.files
41
+ s.files += submodule_files_paths
33
42
  end
34
43
  end
35
44