tracking_number 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +12 -3
- data/.github/workflows/ruby.yml +4 -2
- data/CHANGELOG.md +15 -0
- data/README.md +48 -0
- data/bin/console +14 -0
- data/lib/data/couriers/amazon.json +45 -0
- data/lib/data/couriers/canadapost.json +31 -0
- data/lib/data/couriers/dhl.json +51 -0
- data/lib/data/couriers/dpd.json +341 -0
- data/lib/data/couriers/fedex.json +303 -0
- data/lib/data/couriers/landmark.json +26 -0
- data/lib/data/couriers/lasership.json +84 -0
- data/lib/data/couriers/ontrac.json +70 -0
- data/lib/data/couriers/s10.json +1435 -0
- data/lib/data/couriers/ups.json +193 -0
- data/lib/data/couriers/usps.json +175 -0
- data/lib/tracking_number/base.rb +166 -85
- data/lib/tracking_number/loader.rb +23 -22
- data/lib/tracking_number/partnership.rb +7 -0
- data/lib/tracking_number/version.rb +1 -1
- data/lib/tracking_number.rb +32 -9
- data/test/test_helper.rb +0 -2
- data/test/tracking_number_meta_test.rb +1 -1
- data/test/tracking_number_test.rb +68 -0
- data/tracking_number.gemspec +15 -6
- data/yarn.lock +448 -448
- metadata +18 -5
@@ -0,0 +1,193 @@
|
|
1
|
+
{
|
2
|
+
"name": "UPS",
|
3
|
+
"courier_code": "ups",
|
4
|
+
"tracking_numbers": [
|
5
|
+
{
|
6
|
+
"name": "UPS",
|
7
|
+
"id": "ups",
|
8
|
+
"regex": [
|
9
|
+
"\\s*1\\s*Z\\s*(?<SerialNumber>",
|
10
|
+
"(?<ShipperId>(?:[A-Z0-9]\\s*){6,6})",
|
11
|
+
"(?<ServiceType>(?:[A-Z0-9]\\s*){2,2})",
|
12
|
+
"(?<PackageId>(?:[A-Z0-9]\\s*){7,7}))",
|
13
|
+
"(?<CheckDigit>[0-9]\\s*)"
|
14
|
+
],
|
15
|
+
"validation": {
|
16
|
+
"checksum": {
|
17
|
+
"name": "mod10",
|
18
|
+
"evens_multiplier": 1,
|
19
|
+
"odds_multiplier": 2
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"tracking_url": "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%s",
|
23
|
+
"additional": [
|
24
|
+
{
|
25
|
+
"name": "Service Type",
|
26
|
+
"regex_group_name": "ServiceType",
|
27
|
+
"lookup": [
|
28
|
+
{
|
29
|
+
"matches": "01",
|
30
|
+
"name": "UPS United States Next Day Air (Red)"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"matches": "02",
|
34
|
+
"name": "UPS United States Second Day Air (Blue)"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"matches": "03",
|
38
|
+
"name": "UPS United States Ground"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"matches": "12",
|
42
|
+
"name": "UPS United States Third Day Select"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"matches": "13",
|
46
|
+
"name": "UPS United States Next Day Air Saver (Red Saver)"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"matches": "15",
|
50
|
+
"name": "UPS United States Next Day Air Early A.M."
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"matches": "22",
|
54
|
+
"name": "UPS United States Ground - Returns Plus - Three Pickup Attempts"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"matches": "32",
|
58
|
+
"name": "UPS United States Next Day Air Early A.M. - COD"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"matches": "33",
|
62
|
+
"name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, COD"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"matches": "41",
|
66
|
+
"name": "UPS United States Next Day Air Early A.M. - Saturday Delivery"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"matches": "42",
|
70
|
+
"name": "UPS United States Ground - Signature Required"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"matches": "44",
|
74
|
+
"name": "UPS United States Next Day Air - Saturday Delivery"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"matches": "66",
|
78
|
+
"name": "UPS United States Worldwide Express"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"matches": "72",
|
82
|
+
"name": "UPS United States Ground - Collect on Delivery"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"matches": "78",
|
86
|
+
"name": "UPS United States Ground - Returns Plus - One Pickup Attempt"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"matches": "90",
|
90
|
+
"name": "UPS United States Ground - Returns - UPS Prints and Mails Label"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"matches": "A0",
|
94
|
+
"name": "UPS United States Next Day Air Early A.M. - Adult Signature Required"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"matches": "A1",
|
98
|
+
"name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, Adult Signature Required"
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"matches": "A2",
|
102
|
+
"name": "UPS United States Next Day Air - Adult Signature Required"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"matches": "A8",
|
106
|
+
"name": "UPS United States Ground - Adult Signature Required"
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"matches": "A9",
|
110
|
+
"name": "UPS United States Next Day Air Early A.M. - Adult Signature Required, COD"
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"matches": "AA",
|
114
|
+
"name": "UPS United States Next Day Air Early A.M. - Saturday Delivery, Adult Signature Required, COD"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"matches": "YW",
|
118
|
+
"name": "UPS SurePost - Delivered by the USPS"
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
],
|
123
|
+
"test_numbers": {
|
124
|
+
"valid": [
|
125
|
+
"1Z5R89390357567127",
|
126
|
+
"1Z879E930346834440",
|
127
|
+
"1Z410E7W0392751591",
|
128
|
+
"1Z8V92A70367203024",
|
129
|
+
" 1 Z 8 V 9 2 A 7 0 3 6 7 2 0 3 0 2 4 ",
|
130
|
+
"1ZXX3150YW44070023"
|
131
|
+
],
|
132
|
+
"invalid": [
|
133
|
+
"2Z5R89390357567127",
|
134
|
+
"1A5R89390357567127",
|
135
|
+
"1Z1111111111111111"
|
136
|
+
]
|
137
|
+
}
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"name": "UPS Waybill",
|
141
|
+
"regex": [
|
142
|
+
"\\s*(?<ServiceType>([AHJKTV]\\s*){1})",
|
143
|
+
"(?<SerialNumber>(?:[0-9]\\s*){9})",
|
144
|
+
"(?<CheckDigit>[0-9]\\s*){1}"
|
145
|
+
],
|
146
|
+
"validation": {
|
147
|
+
"checksum": {
|
148
|
+
"name": "mod10",
|
149
|
+
"evens_multiplier": 1,
|
150
|
+
"odds_multiplier": 2
|
151
|
+
}
|
152
|
+
},
|
153
|
+
"additional": [
|
154
|
+
{
|
155
|
+
"name": "Service Type",
|
156
|
+
"regex_group_name": "ServiceType",
|
157
|
+
"lookup": [
|
158
|
+
{
|
159
|
+
"matches": "J",
|
160
|
+
"name": "UPS Next Day Express"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"matches": "K",
|
164
|
+
"name": "UPS Ground"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"matches": "V",
|
168
|
+
"name": "UPS WorldWide Express Saver"
|
169
|
+
}
|
170
|
+
]
|
171
|
+
}
|
172
|
+
],
|
173
|
+
"tracking_url": "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%s",
|
174
|
+
"test_numbers": {
|
175
|
+
"valid": [
|
176
|
+
"K1506235620",
|
177
|
+
"K 150 623 562 0",
|
178
|
+
"K2479825491",
|
179
|
+
"J4603636537",
|
180
|
+
"V0490119172",
|
181
|
+
"V0431105627"
|
182
|
+
],
|
183
|
+
"invalid": [
|
184
|
+
"K1506235622",
|
185
|
+
"K2479825492",
|
186
|
+
"J4603636538",
|
187
|
+
"V0411335627",
|
188
|
+
"V0423305841"
|
189
|
+
]
|
190
|
+
}
|
191
|
+
}
|
192
|
+
]
|
193
|
+
}
|
@@ -0,0 +1,175 @@
|
|
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
|
+
"id": "usps_20",
|
9
|
+
"description": "20 digit USPS numbers",
|
10
|
+
"regex": [
|
11
|
+
"\\s*(?<SerialNumber>",
|
12
|
+
"(?<ServiceType>([0-9]\\s*){2})",
|
13
|
+
"(?<ShipperId>([0-9]\\s*){9})",
|
14
|
+
"(?<PackageId>([0-9]\\s*){8})",
|
15
|
+
")",
|
16
|
+
"(?<CheckDigit>[0-9]\\s*)"
|
17
|
+
],
|
18
|
+
"validation": {
|
19
|
+
"checksum": {
|
20
|
+
"name": "mod10",
|
21
|
+
"evens_multiplier": 3,
|
22
|
+
"odds_multiplier": 1
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"test_numbers": {
|
26
|
+
"valid": [
|
27
|
+
"0307 1790 0005 2348 3741",
|
28
|
+
" 0 3 0 7 1 7 9 0 0 0 0 5 2 3 4 8 3 7 4 1 ",
|
29
|
+
"7112 3456 7891 2345 6787"
|
30
|
+
],
|
31
|
+
"invalid": [
|
32
|
+
"0307 1790 0005 2348 3742"
|
33
|
+
]
|
34
|
+
},
|
35
|
+
"additional": [
|
36
|
+
{
|
37
|
+
"name": "Service Type",
|
38
|
+
"regex_group_name": "ServiceType",
|
39
|
+
"lookup": [
|
40
|
+
{
|
41
|
+
"matches": "71",
|
42
|
+
"name": "Certified Mail"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"matches": "73",
|
46
|
+
"name": "Insured Mail"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"matches": "77",
|
50
|
+
"name": "Registered Mail"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"matches": "81",
|
54
|
+
"name": "Return Receipt For Merchanise"
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"name": "USPS 34v2",
|
62
|
+
"id": "usps_32V2",
|
63
|
+
"description": "variation on 34 digit USPS IMpd numbers",
|
64
|
+
"regex": [
|
65
|
+
"\\s*(?<RoutingApplicationId>4\\s*2\\s*0\\s*)(?<DestinationZip>([0-9]\\s*){5})",
|
66
|
+
"(?<RoutingNumber>([0-9]\\s*){4})",
|
67
|
+
"(?<SerialNumber>",
|
68
|
+
"(?<ApplicationIdentifier>9\\s*[2345]\\s*)?",
|
69
|
+
"(?<ShipperId>([0-9]\\s*){8})",
|
70
|
+
"(?<PackageId>([0-9]\\s*){11})",
|
71
|
+
")",
|
72
|
+
"(?<CheckDigit>[0-9]\\s*)"
|
73
|
+
],
|
74
|
+
"validation": {
|
75
|
+
"checksum": {
|
76
|
+
"name": "mod10",
|
77
|
+
"evens_multiplier": 3,
|
78
|
+
"odds_multiplier": 1
|
79
|
+
}
|
80
|
+
},
|
81
|
+
"tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s",
|
82
|
+
"test_numbers": {
|
83
|
+
"valid": [
|
84
|
+
"4201002334249200190132607600833457",
|
85
|
+
"4201028200009261290113185417468510",
|
86
|
+
" 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 "
|
87
|
+
],
|
88
|
+
"invalid": [
|
89
|
+
"4201028200009261290113185417468511"
|
90
|
+
]
|
91
|
+
}
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"name": "USPS 91",
|
95
|
+
"id": "usps_91",
|
96
|
+
"description": "USPS now calls this the IMpd barcode format",
|
97
|
+
"regex": [
|
98
|
+
"\\s*(?:(?<RoutingApplicationId>4\\s*2\\s*0\\s*)(?<DestinationZip>([0-9]\\s*){5}))?",
|
99
|
+
"(?<SerialNumber>",
|
100
|
+
"(?<ApplicationIdentifier>9\\s*[12345]\\s*)?",
|
101
|
+
"(?<SCNC>([0-9]\\s*){2})",
|
102
|
+
"(?<ServiceType>([0-9]\\s*){2})",
|
103
|
+
"(?<ShipperId>([0-9]\\s*){8})",
|
104
|
+
"(?<PackageId>([0-9]\\s*){11}|([0-9]\\s*){7})",
|
105
|
+
")",
|
106
|
+
"(?<CheckDigit>[0-9]\\s*)"
|
107
|
+
],
|
108
|
+
"validation": {
|
109
|
+
"checksum": {
|
110
|
+
"name": "mod10",
|
111
|
+
"evens_multiplier": 3,
|
112
|
+
"odds_multiplier": 1
|
113
|
+
},
|
114
|
+
"serial_number_format": {
|
115
|
+
"prepend_if": {
|
116
|
+
"matches_regex": "^(?!9[1-5]).+",
|
117
|
+
"content": "91"
|
118
|
+
}
|
119
|
+
}
|
120
|
+
},
|
121
|
+
"partners": [{
|
122
|
+
"description": "FedEx SmartPost uses USPS for last mile delivery, but not all USPS91 numbers are SmartPosts",
|
123
|
+
"partner_type": "shipper",
|
124
|
+
"partner_id": "fedex_smartpost",
|
125
|
+
"validation": {
|
126
|
+
"matches_all": [
|
127
|
+
{
|
128
|
+
"regex_group_name": "ServiceType",
|
129
|
+
"matches": "29"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"matches": "61",
|
133
|
+
"regex_group_name": "SCNC"
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
137
|
+
}],
|
138
|
+
"tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s",
|
139
|
+
"test_numbers": {
|
140
|
+
"valid": [
|
141
|
+
"420 22153 9101026837331000039521",
|
142
|
+
"7196 9010 7560 0307 7385",
|
143
|
+
"9505 5110 6960 5048 6006 24",
|
144
|
+
"9101 1234 5678 9000 0000 13",
|
145
|
+
"92748931507708513018050063",
|
146
|
+
"9400 1112 0108 0805 4830 16",
|
147
|
+
"9361 2898 7870 0317 6337 95",
|
148
|
+
"9405803699300124287899"
|
149
|
+
],
|
150
|
+
"invalid": [
|
151
|
+
"61299998820821171811",
|
152
|
+
"9200000000000000000000",
|
153
|
+
"420000000000000000000000000000",
|
154
|
+
"420000009200000000000000000000"
|
155
|
+
]
|
156
|
+
},
|
157
|
+
"additional": [
|
158
|
+
{
|
159
|
+
"name": "Service Type",
|
160
|
+
"regex_group_name": "ServiceType",
|
161
|
+
"lookup": [
|
162
|
+
{
|
163
|
+
"matches": "11",
|
164
|
+
"name": "First Class (R)"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"matches": "29",
|
168
|
+
"name": "Fedex Smart Post"
|
169
|
+
}
|
170
|
+
]
|
171
|
+
}
|
172
|
+
]
|
173
|
+
}
|
174
|
+
]
|
175
|
+
}
|