usps_standardizer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .rvmrc
6
+ *~
7
+ docs
8
+
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color --format documentation
2
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in usps_standardizer.gemspec
4
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ = USPS Address Standardizer
2
+
3
+ == Installing
4
+
5
+ $ require 'usps_standardizer'
6
+ $ gem install usps_standardizer
7
+
8
+ == Usage
9
+
10
+ $ result = USPSStandardizer.lookup_for(:address => '6216 eddington drive', :state => 'oh', :city => 'middletown')
11
+
12
+ Or you can pass your own Mechanize object to fetch the information
13
+
14
+ $ require 'usps_standardizer'
15
+ $ require 'mechanize' $
16
+ $ browser = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }
17
+ $ result = USPSStandardizer.lookup_for({:address => '6216 eddington drive', :state => 'oh', :city => 'middletown'}, browser)
18
+
19
+ == License
20
+
21
+ (The MIT License)
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rspec/core/rake_task"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ require 'rdoc/task'
8
+ RDoc::Task.new do |t|
9
+ t.rdoc_dir = "docs"
10
+ t.title = "USPS Address Standardizer"
11
+ t.options << "-m" << "README.rdoc"
12
+ end
13
+
@@ -0,0 +1,9 @@
1
+ module USPSStandardizer
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ PATCH = 0
6
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
+ end
8
+ end
9
+
@@ -0,0 +1,76 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'sanitize'
3
+ require 'mechanize'
4
+
5
+ module USPSStandardizer
6
+
7
+ class ZipLookup
8
+
9
+ attr_accessor :address, :state, :city, :zipcode
10
+
11
+ def initialize(options = {}, mechanize = Mechanize.new)
12
+ @address, @state, @city, @zipcode, @county = '', '', '', '', ''
13
+ @mechanize = mechanize
14
+ options.each do |name, value|
15
+ send("#{name}=", value)
16
+ end
17
+ end
18
+
19
+ def std_address
20
+ return [] unless (content = get_std_address_content)
21
+
22
+ content.gsub!(/\t|\n|\r/, '')
23
+ content.squeeze!(" ").strip!
24
+
25
+ raw_matches = content.scan(%r{<td headers="\w+" height="34" valign="top" class="main" style="background:url\(images/table_gray\.gif\); padding:5px 10px;">(.*?)>Mailing Industry Information</a>}mi)
26
+
27
+ raw_matches.inject([]) do |results, raw_match|
28
+ if raw_match[0] =~ /mailingIndustryPopup2\(([^\)]*)/i
29
+ @county = $1.split(',')[1].gsub(/'/, '')
30
+ end
31
+
32
+ @address, city_state_zipcode = Sanitize.clean(raw_match[0],
33
+ :remove_contents => true,
34
+ :elements => %w[br]
35
+ ).strip.split('<br>')
36
+ if city_state_zipcode.sub_nonascii(' ').squeeze!(' ') =~ /^(.*)\s+(\w\w)\s(\d{5})(-\d{4})?/i
37
+ @city, @state, @zipcode = $1, $2, $3
38
+ end
39
+
40
+ results << {:address => @address, :city => @city, :state => @state, :county => @county}
41
+ results
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def get_std_address_content
48
+ search_form = @mechanize.get('http://zip4.usps.com/zip4/').forms.first
49
+
50
+ search_form.address2 = @address
51
+ search_form.city = @city
52
+ search_form.state = @state
53
+
54
+ @mechanize.submit(search_form, search_form.buttons.first)
55
+
56
+ return false unless @mechanize.page.search('p.mainRed').empty?
57
+ @mechanize.page.body
58
+ end
59
+ end
60
+ end
61
+
62
+ String.class_eval do
63
+ def sub_nonascii(replacement)
64
+ chars = self.split("")
65
+ self.slice!(0..self.size)
66
+ chars.each do |char|
67
+ if char.ord < 33 || char.ord > 127
68
+ self.concat(replacement)
69
+ else
70
+ self.concat(char)
71
+ end
72
+ end
73
+ self.to_s
74
+ end
75
+ end
76
+
@@ -0,0 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'mechanize'
3
+ module USPSStandardizer
4
+ autoload :Version, "usps_standardizer/version"
5
+ autoload :ZipLookup, "usps_standardizer/zip_lookup"
6
+
7
+ def self.lookup_for(options, mechanize = Mechanize.new)
8
+ z = USPSStandardizer::ZipLookup.new(options, mechanize)
9
+ z.std_address
10
+ end
11
+
12
+ end
13
+
@@ -0,0 +1,906 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
14
+
15
+ <html>
16
+ <head>
17
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
18
+ <meta name="WT.z_search" content="address"></meta>
19
+ <meta name="WT.z_value" content="match"></meta>
20
+ <title>USPS - ZIP Code Lookup - Find a ZIP + 4 Code By Address Results</title>
21
+ <link href="css/styles.css" rel="stylesheet" type="text/css" />
22
+
23
+ <SCRIPT language="javascript1.1" type="text/javascript">
24
+
25
+
26
+ function checkState(field) {
27
+ field.state.value = field.state.value.toUpperCase();
28
+ if (field.state.value == "PR") {
29
+ var firmname = 'firmname=' + field.firmname.value;
30
+ var address1 = '&address1=' + field.address1.value;
31
+ var address2 = '&address2=' + field.address2.value;
32
+ var city = '&city=' + field.city.value;
33
+ var state = '&state=' + field.state.value;
34
+ var zip5 = '&zip5=' + field.zip5.value;
35
+ var urbanization = '&urbanization=' + field.urbanization.value;
36
+ var url = 'welcome.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
37
+ top.location.replace(url);
38
+ }
39
+ return true;
40
+ }
41
+
42
+
43
+ function checkStateError(field) {
44
+ field.state.value = field.state.value.toUpperCase();
45
+ if (field.state.value == "PR") {
46
+ var firmname = 'firmname=' + field.firmname.value;
47
+ var address1 = '&address1=' + field.address1.value;
48
+ var address2 = '&address2=' + field.address2.value;
49
+ var city = '&city=' + field.city.value;
50
+ var state = '&state=' + field.state.value;
51
+ var zip5 = '&zip5=' + field.zip5.value;
52
+ var urbanization = '&urbanization=' + field.urbanization.value;
53
+ var url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
54
+ top.location.replace(url);
55
+ }
56
+ return true;
57
+ }
58
+
59
+ function checkStateSysError(field) {
60
+ field.state.value = field.state.value.toUpperCase();
61
+ if (field.state.value == "PR") {
62
+ var firmname = 'firmname=' + field.firmname.value;
63
+ var address1 = '&address1=' + field.address1.value;
64
+ var address2 = '&address2=' + field.address2.value;
65
+ var city = '&city=' + field.city.value;
66
+ var state = '&state=' + field.state.value;
67
+ var zip5 = '&zip5=' + field.zip5.value;
68
+ var urbanization = '&urbanization=' + field.urbanization.value;
69
+ var url = 'zcl_0_landing_sys_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
70
+ top.location.replace(url);
71
+ }
72
+ return true;
73
+ }
74
+
75
+
76
+ function statePopup(mylink, windowname) {
77
+ if (! window.focus) {
78
+ return true;
79
+ }
80
+ var mywin, href;
81
+ if (typeof(mylink) == 'string') {
82
+ href=mylink;
83
+ } else {
84
+ href=mylink.href;
85
+ }
86
+ mywin = window.open(href, windowname, 'width=240, height=270, left=400, top=100, resizable=1, menubar=0, toolbar=0, location=0, personalbar=0, status=0, scrollbars=0');
87
+ mywin.focus();
88
+
89
+ return false;
90
+ }
91
+
92
+
93
+ function validate_for_integers(inputfield, inputevent, zipcode) {
94
+ var key;
95
+ var keychar;
96
+
97
+ if (zipcode.value.length == 5) {
98
+ if (window.event) {
99
+ key = window.event.keyCode;
100
+ } else if (inputevent) {
101
+ key = inputevent.which;
102
+ } else {
103
+ return true;
104
+ }
105
+
106
+ keychar = String.fromCharCode(key);
107
+ // control keys
108
+ if ((key==null) || (key==0) || (key==8) ||
109
+ (key==9) || (key==13) || (key==27)) {
110
+ return true;
111
+
112
+ // numbers
113
+ } else if (("0123456789-").indexOf(keychar) > -1) {
114
+ return true;
115
+ } else {
116
+ return false;
117
+ }
118
+ } else {
119
+ if (window.event) {
120
+ key = window.event.keyCode;
121
+ } else if (inputevent) {
122
+ key = inputevent.which;
123
+ } else {
124
+ return true;
125
+ }
126
+
127
+ keychar = String.fromCharCode(key);
128
+ // control keys
129
+ if ((key==null) || (key==0) || (key==8) ||
130
+ (key==9) || (key==13) || (key==27)) {
131
+ return true;
132
+
133
+ // numbers
134
+ } else if (("0123456789").indexOf(keychar) > -1) {
135
+ return true;
136
+
137
+ } else {
138
+ return false;
139
+ }
140
+ }
141
+ } // end of validate_for_integers()
142
+
143
+
144
+ function validate_for_characters(inputfield, inputevent) {
145
+ var key;
146
+ var keychar;
147
+
148
+ if (window.event) {
149
+ key = window.event.keyCode;
150
+ } else if (inputevent) {
151
+ key = inputevent.which;
152
+ } else {
153
+ return true;
154
+ }
155
+
156
+ keychar = String.fromCharCode(key);
157
+ // control keys
158
+ if ((key==null) || (key==0) || (key==8) ||
159
+ (key==9) || (key==13) || (key==27)) {
160
+ return true;
161
+
162
+ // characters
163
+ } else if (("0123456789").indexOf(keychar) > -1) {
164
+ return false;
165
+ } else {
166
+ return true;
167
+ }
168
+ } // end of validate_for_characters()
169
+
170
+
171
+ function checkFields (field) {
172
+ var firmname = 'firmname=' + field.firmname.value;
173
+ var address1 = '&address1=' + field.address1.value;
174
+ var address2 = '&address2=' + field.address2.value;
175
+ var city = '&city=' + field.city.value;
176
+ var state = '&state=' + field.state.value;
177
+ var zip5 = '&zip5=' + field.zip5.value;
178
+ var urbanization = '&urbanization=' + field.urbanization.value;
179
+ var ok = true;
180
+
181
+ if (field.zip5.value == "0") {
182
+ if (field.address2.value.length == 0) {
183
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
184
+ ok = false;
185
+ }
186
+
187
+ if ((field.city.value.length == 0)) {
188
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
189
+ ok = false;
190
+ } else {
191
+ field.zip5.value = "";
192
+ }
193
+ } else {
194
+
195
+ if (field.address2.value.length == 0) {
196
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
197
+ ok = false;
198
+ }
199
+
200
+ if (field.zip5.value.length != 0) {
201
+ if (field.zip5.value.length < 5) {
202
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
203
+ ok = false;
204
+ }
205
+ }
206
+
207
+ if ((field.city.value.length == 0) && (field.state.value.length == 0)) {
208
+ if (field.zip5.value.length < 5) {
209
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
210
+ ok = false;
211
+ }
212
+ }
213
+
214
+ if ((field.city.value.length == 0) || (field.state.value.length == 0)) {
215
+ if (field.zip5.value.length < 5) {
216
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + state + zip5 + urbanization;
217
+ ok = false;
218
+ };
219
+ }
220
+
221
+ if (field.state.value != 'PR') {
222
+ field.urbanization.value = "";
223
+ }
224
+
225
+ if ((field.state.value != 'AL') &&
226
+ (field.state.value != 'AK') &&
227
+ (field.state.value != 'AS') &&
228
+ (field.state.value != 'AZ') &&
229
+ (field.state.value != 'AR') &&
230
+ (field.state.value != 'CA') &&
231
+ (field.state.value != 'CO') &&
232
+ (field.state.value != 'CT') &&
233
+ (field.state.value != 'DE') &&
234
+ (field.state.value != 'DC') &&
235
+ (field.state.value != 'FM') &&
236
+ (field.state.value != 'FL') &&
237
+ (field.state.value != 'GA') &&
238
+ (field.state.value != 'GU') &&
239
+ (field.state.value != 'HI') &&
240
+ (field.state.value != 'ID') &&
241
+ (field.state.value != 'IL') &&
242
+ (field.state.value != 'IN') &&
243
+ (field.state.value != 'IA') &&
244
+ (field.state.value != 'KS') &&
245
+ (field.state.value != 'KY') &&
246
+ (field.state.value != 'LA') &&
247
+ (field.state.value != 'ME') &&
248
+ (field.state.value != 'MH') &&
249
+ (field.state.value != 'MD') &&
250
+ (field.state.value != 'MA') &&
251
+ (field.state.value != 'MI') &&
252
+ (field.state.value != 'MN') &&
253
+ (field.state.value != 'MS') &&
254
+ (field.state.value != 'MO') &&
255
+ (field.state.value != 'MT') &&
256
+ (field.state.value != 'NE') &&
257
+ (field.state.value != 'NV') &&
258
+ (field.state.value != 'NH') &&
259
+ (field.state.value != 'NJ') &&
260
+ (field.state.value != 'NM') &&
261
+ (field.state.value != 'NY') &&
262
+ (field.state.value != 'NC') &&
263
+ (field.state.value != 'ND') &&
264
+ (field.state.value != 'MP') &&
265
+ (field.state.value != 'OH') &&
266
+ (field.state.value != 'OK') &&
267
+ (field.state.value != 'OR') &&
268
+ (field.state.value != 'PW') &&
269
+ (field.state.value != 'PA') &&
270
+ (field.state.value != 'PR') &&
271
+ (field.state.value != 'RI') &&
272
+ (field.state.value != 'SC') &&
273
+ (field.state.value != 'SD') &&
274
+ (field.state.value != 'TN') &&
275
+ (field.state.value != 'TX') &&
276
+ (field.state.value != 'UT') &&
277
+ (field.state.value != 'VT') &&
278
+ (field.state.value != 'VI') &&
279
+ (field.state.value != 'VA') &&
280
+ (field.state.value != 'WA') &&
281
+ (field.state.value != 'WV') &&
282
+ (field.state.value != 'WI') &&
283
+ (field.state.value != 'WY') &&
284
+ (field.state.value != 'AE') &&
285
+ (field.state.value != 'AA') &&
286
+ (field.state.value != 'AE') &&
287
+ (field.state.value != 'AP') &&
288
+ (field.state.value != '') &&
289
+ (field.state.value != ' ')) {
290
+ url = 'zcl_0_landing_error.jsp?' + firmname + address1 + address2 + city + '&state=' + zip5 + urbanization;
291
+ ok = false;
292
+ }
293
+ }
294
+
295
+ if (ok == false) return url;
296
+ else return "";
297
+ }
298
+
299
+
300
+ function validate(field) { // check if input ok
301
+ //global variable to create error message(s)
302
+ var url = "";
303
+ var formerror = false;
304
+
305
+ // remove leading spaces
306
+ field.firmname.value = removeLeadingSpaces(field.firmname.value);
307
+ field.address1.value = removeLeadingSpaces(field.address1.value);
308
+ field.address2.value = removeLeadingSpaces(field.address2.value);
309
+ field.city.value = removeLeadingSpaces(field.city.value);
310
+ field.state.value = removeLeadingSpaces(field.state.value);
311
+ field.urbanization.value = removeLeadingSpaces(field.urbanization.value);
312
+
313
+ field.firmname.value = field.firmname.value.toUpperCase();
314
+ field.address1.value = field.address1.value.toUpperCase();
315
+ field.address2.value = field.address2.value.toUpperCase();
316
+ field.city.value = field.city.value.toUpperCase();
317
+ field.state.value = field.state.value.toUpperCase();
318
+ field.urbanization.value = field.urbanization.value.toUpperCase();
319
+
320
+ action = checkFields(field);
321
+
322
+ if (action != "") formerror = true;
323
+
324
+ if (formerror){
325
+ top.location.replace(action);
326
+ return false;
327
+ } else {
328
+ return true;
329
+ }
330
+ }
331
+
332
+ function removeLeadingSpaces(value) {
333
+ var regExp = /^\s*/;
334
+ var retVal = value.replace(regExp, "");
335
+ return retVal;
336
+ }
337
+
338
+ function createRequestObject() {
339
+ FORM_DATA = new Object();
340
+ // The Object ("Array") where our data will be stored.
341
+
342
+ separator = ',';
343
+ // The token used to separate data from multi-select inputs
344
+
345
+ query = '' + this.location;
346
+ // Get the current URL so we can parse out the data.
347
+ // Adding a null-string '' forces an implicit type cast
348
+ // from property to string, for NS2 compatibility.
349
+
350
+ query = query.substring((query.indexOf('?')) + 1);
351
+ // Keep everything after the question mark '?'.
352
+
353
+ if (query.length < 1) { return false; } // Perhaps we got some bad data?
354
+
355
+ keypairs = new Object();
356
+
357
+ numKP = 1;
358
+ // Local vars used to store and keep track of name/value pairs
359
+ // as we parse them back into a usable form.
360
+
361
+ while (query.indexOf('&') > -1) {
362
+ keypairs[numKP] = query.substring(0,query.indexOf('&'));
363
+ query = query.substring((query.indexOf('&')) + 1);
364
+ numKP++;
365
+ // Split the query string at each '&', storing the left-hand side
366
+ // of the split in a new keypairs[] holder, and chopping the query
367
+ // so that it gets the value of the right-hand string.
368
+ } // end of while loop
369
+
370
+ keypairs[numKP] = query;
371
+ // Store what's left in the query string as the final keypairs[] data.
372
+
373
+ for (i in keypairs) {
374
+ keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
375
+ // Left of '=' is name.
376
+
377
+ keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
378
+ // Right of '=' is value.
379
+
380
+ while (keyValue.indexOf('+') > -1) {
381
+ keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
382
+ // Replace each '+' in data string with a space.
383
+ }
384
+
385
+ keyValue = unescape(keyValue);
386
+ // Unescape non-alphanumerics
387
+ if (keyName == 'firmname') {
388
+ document.form1.firmname.value = keyValue;
389
+ }
390
+ if (keyName == 'address1') {
391
+ document.form1.address1.value = keyValue;
392
+ }
393
+ if (keyName == 'address2') {
394
+ document.form1.address2.value = keyValue;
395
+ }
396
+ if (keyName == 'city') {
397
+ document.form1.city.value = keyValue;
398
+ }
399
+ if (keyName == 'state') {
400
+ document.form1.state.value = keyValue;
401
+ }
402
+ if (keyName == 'zip5') {
403
+ document.form1.zip5.value = keyValue;
404
+ }
405
+ if (keyName == 'urbanization') {
406
+ document.form1.urbanization.value = keyValue;
407
+ }
408
+ if (keyName == 'pagenumber') {
409
+ document.form1.pagenumber.value = keyValue;
410
+ }
411
+
412
+ if (FORM_DATA[keyName]) {
413
+ FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
414
+ // Object already exists, it is probably a multi-select input,
415
+ // and we need to generate a separator-delimited string
416
+ // by appending to what we already have stored.
417
+ } else {
418
+ FORM_DATA[keyName] = keyValue;
419
+ // Normal case: name gets value.
420
+ }
421
+ } // end of for loop
422
+
423
+ if (document.form1.state.value == 'PR') {
424
+ document.form1.urbanization.focus();
425
+ }
426
+
427
+ return FORM_DATA;
428
+ } // end of createRequestObject()
429
+
430
+
431
+ function mailingIndustryPopup(carrierroute, countyname, deliverypoint, checkdigit, lac, elot, elotindicator, recordtype, pmbdesignator, pmbnumber, defaultflag, ewsflag) {
432
+ var popupWin = window.open('','mailingIndustry','width=500,height=300,left=250,top=100,resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1');
433
+ popupWin.focus();
434
+
435
+ popupWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
436
+ popupWin.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
437
+ popupWin.document.write('<head>');
438
+ popupWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />');
439
+ popupWin.document.write('<title>USPS - Mailing Industry Information</title>');
440
+ popupWin.document.write('<link href="css/styles.css" rel="stylesheet" type="text/css" />');
441
+ popupWin.document.write('</head>');
442
+ popupWin.document.write('');
443
+ popupWin.document.write('<body>');
444
+ popupWin.document.write('');
445
+ popupWin.document.write('<div style="width:100%; height:12px; background:url(images/top_tile.gif) repeat-x;"></div>');
446
+ popupWin.document.write('<div class="popupHeader" style="width:338px; height:16px; padding:10px 8px;">');
447
+ popupWin.document.write(' <h1>Mailing Industry Information</h1>');
448
+ popupWin.document.write('</div>');
449
+ popupWin.document.write('<div style="width:338px; height:16px; padding:2px 8px;" class="main"><a href="pu_mailing_industry_def.htm">Mail Industry Information Definitions</a></div>');
450
+ popupWin.document.write('<table cellspacing="0" cellpadding="6" width="480" border="0">');
451
+ popupWin.document.write(' <tbody>');
452
+ popupWin.document.write(' <tr>');
453
+ popupWin.document.write(' <td width="464" align="right" valign="top"><a href="javascript:window.close()"><img src="images/button_close_window.gif" alt="Close Window" border="0" /></a></td>');
454
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
455
+ popupWin.document.write(' </tr>');
456
+ popupWin.document.write(' </tbody>');
457
+ popupWin.document.write('</table>');
458
+ popupWin.document.write('<table width="480" border="0" cellpadding="6" cellspacing="0" summary="This table is used to format the header of the page.">');
459
+ popupWin.document.write(' <tbody>');
460
+ popupWin.document.write(' <tr>');
461
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
462
+ popupWin.document.write(' <td width="298" class="main" valign="top" bgcolor="#f3f3f3">Carrier Route</td>');
463
+ popupWin.document.write(' <td width="150" align="right" valign="top" bgcolor="#f3f3f3" class="main">' + carrierroute + '</td>');
464
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
465
+ popupWin.document.write(' </tr>');
466
+ popupWin.document.write(' <tr>');
467
+ popupWin.document.write(' <td>&nbsp;</td>');
468
+ popupWin.document.write(' <td class="main" valign="top">County</td>');
469
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + countyname + '</td>');
470
+ popupWin.document.write(' <td>&nbsp;</td>');
471
+ popupWin.document.write(' </tr>');
472
+ popupWin.document.write(' <tr>');
473
+ popupWin.document.write(' <td>&nbsp;</td>');
474
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">Delivery Point Code</td>');
475
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + deliverypoint + '</td>');
476
+ popupWin.document.write(' <td>&nbsp;</td>');
477
+ popupWin.document.write(' </tr>');
478
+ popupWin.document.write(' <tr>');
479
+ popupWin.document.write(' <td>&nbsp;</td>');
480
+ popupWin.document.write(' <td class="main" valign="top">Check Digit</td>');
481
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + checkdigit + '</td>');
482
+ popupWin.document.write(' <td>&nbsp;</td>');
483
+ popupWin.document.write(' </tr>');
484
+ popupWin.document.write(' <tr>');
485
+ popupWin.document.write(' <td>&nbsp;</td>');
486
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">LAC&#8482;</td>');
487
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + lac + '</td>');
488
+ popupWin.document.write(' <td>&nbsp;</td>');
489
+ popupWin.document.write(' </tr>');
490
+ popupWin.document.write(' <tr>');
491
+ popupWin.document.write(' <td>&nbsp;</td>');
492
+ popupWin.document.write(' <td class="main" valign="top">eLOT&#8482;</td>');
493
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + elot + '</td>');
494
+ popupWin.document.write(' <td>&nbsp;</td>');
495
+ popupWin.document.write(' </tr>');
496
+ popupWin.document.write(' <tr>');
497
+ popupWin.document.write(' <td>&nbsp;</td>');
498
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">eLOT Ascending/Descending Indicator</td>');
499
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + elotindicator + '</td>');
500
+ popupWin.document.write(' <td>&nbsp;</td>');
501
+ popupWin.document.write(' </tr>');
502
+ popupWin.document.write(' <tr>');
503
+ popupWin.document.write(' <td>&nbsp;</td>');
504
+ popupWin.document.write(' <td class="main" valign="top">Record Type Code</td>');
505
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + recordtype + '</td>');
506
+ popupWin.document.write(' <td>&nbsp;</td>');
507
+ popupWin.document.write(' </tr>');
508
+ popupWin.document.write(' <tr>');
509
+ popupWin.document.write(' <td>&nbsp;</td>');
510
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">PMB Designator</td>');
511
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + pmbdesignator + '</td>');
512
+ popupWin.document.write(' <td>&nbsp;</td>');
513
+ popupWin.document.write(' </tr>');
514
+ popupWin.document.write(' <tr>');
515
+ popupWin.document.write(' <td>&nbsp;</td>');
516
+ popupWin.document.write(' <td class="main" valign="top">PMB Number</td>');
517
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + pmbnumber + '</td>');
518
+ popupWin.document.write(' <td>&nbsp;</td>');
519
+ popupWin.document.write(' </tr>');
520
+ popupWin.document.write(' <tr>');
521
+ popupWin.document.write(' <td>&nbsp;</td>');
522
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">Default Flag</td>');
523
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + defaultflag + '</td>');
524
+ popupWin.document.write(' <td>&nbsp;</td>');
525
+ popupWin.document.write(' </tr>');
526
+ popupWin.document.write(' <tr>');
527
+ popupWin.document.write(' <td>&nbsp;</td>');
528
+ popupWin.document.write(' <td class="main" valign="top">EWS Flag</td>');
529
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + ewsflag + '</td>');
530
+ popupWin.document.write(' <td>&nbsp;</td>');
531
+ popupWin.document.write(' </tr>');
532
+ popupWin.document.write(' </tbody>');
533
+ popupWin.document.write('</table>');
534
+ popupWin.document.write('<table cellspacing="0" cellpadding="6" width="480" border="0">');
535
+ popupWin.document.write(' <tbody>');
536
+ popupWin.document.write(' <tr>');
537
+ popupWin.document.write(' <td width="464" align="right" valign="top"><a href="javascript:window.close()"><img src="images/button_close_window.gif" alt="Close Window" border="0" /></a></td>');
538
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
539
+ popupWin.document.write(' </tr>');
540
+ popupWin.document.write(' </tbody>');
541
+ popupWin.document.write('</table>');
542
+ popupWin.document.write('<div align="right" style="width:100%; background: url(images/footer_bottom_tile.gif) bottom repeat-x">&nbsp;</div>');
543
+ popupWin.document.write('</body>');
544
+ popupWin.document.write('</html>');
545
+
546
+ popupWin.document.close();
547
+ } // end of mailingIndustryPopup()
548
+
549
+
550
+ function mailingIndustryPopup2(carrierroute, countyname, deliverypoint, checkdigit, lac, elot, elotindicator, recordtype, pmbdesignator, pmbnumber, defaultflag, ewsflag, dpvconfirmation) {
551
+ var popupWin = window.open('','mailingIndustry','width=500,height=300,left=250,top=100,resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1');
552
+ popupWin.focus();
553
+
554
+ popupWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
555
+ popupWin.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
556
+ popupWin.document.write('<head>');
557
+ popupWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />');
558
+ popupWin.document.write('<title>USPS - Mailing Industry Information</title>');
559
+ popupWin.document.write('<link href="css/styles.css" rel="stylesheet" type="text/css" />');
560
+ popupWin.document.write('</head>');
561
+ popupWin.document.write('');
562
+ popupWin.document.write('<body>');
563
+ popupWin.document.write('');
564
+ popupWin.document.write('<div style="width:100%; height:12px; background:url(images/top_tile.gif) repeat-x;"></div>');
565
+ popupWin.document.write('<div class="popupHeader" style="width:338px; height:16px; padding:10px 8px;">');
566
+ popupWin.document.write(' <h1>Mailing Industry Information</h1>');
567
+ popupWin.document.write('</div>');
568
+ popupWin.document.write('<div style="width:338px; height:16px; padding:2px 8px;" class="main"><a href="pu_mailing_industry_def.htm">Mail Industry Information Definitions</a></div>');
569
+ popupWin.document.write('<table cellspacing="0" cellpadding="6" width="480" border="0">');
570
+ popupWin.document.write(' <tbody>');
571
+ popupWin.document.write(' <tr>');
572
+ popupWin.document.write(' <td width="464" align="right" valign="top"><a href="javascript:window.close()"><img src="images/button_close_window.gif" alt="Close Window" border="0" /></a></td>');
573
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
574
+ popupWin.document.write(' </tr>');
575
+ popupWin.document.write(' </tbody>');
576
+ popupWin.document.write('</table>');
577
+ popupWin.document.write('<table width="480" border="0" cellpadding="6" cellspacing="0" summary="This table is used to format the header of the page.">');
578
+ popupWin.document.write(' <tbody>');
579
+ popupWin.document.write(' <tr>');
580
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
581
+ popupWin.document.write(' <td width="298" class="main" valign="top" bgcolor="#f3f3f3">Carrier Route</td>');
582
+ popupWin.document.write(' <td width="150" align="right" valign="top" bgcolor="#f3f3f3" class="main">' + carrierroute + '</td>');
583
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
584
+ popupWin.document.write(' </tr>');
585
+ popupWin.document.write(' <tr>');
586
+ popupWin.document.write(' <td>&nbsp;</td>');
587
+ popupWin.document.write(' <td class="main" valign="top">County</td>');
588
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + countyname + '</td>');
589
+ popupWin.document.write(' <td>&nbsp;</td>');
590
+ popupWin.document.write(' </tr>');
591
+ popupWin.document.write(' <tr>');
592
+ popupWin.document.write(' <td>&nbsp;</td>');
593
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">Delivery Point Code</td>');
594
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + deliverypoint + '</td>');
595
+ popupWin.document.write(' <td>&nbsp;</td>');
596
+ popupWin.document.write(' </tr>');
597
+ popupWin.document.write(' <tr>');
598
+ popupWin.document.write(' <td>&nbsp;</td>');
599
+ popupWin.document.write(' <td class="main" valign="top">Check Digit</td>');
600
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + checkdigit + '</td>');
601
+ popupWin.document.write(' <td>&nbsp;</td>');
602
+ popupWin.document.write(' </tr>');
603
+ popupWin.document.write(' <tr>');
604
+ popupWin.document.write(' <td>&nbsp;</td>');
605
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">LAC&#8482;</td>');
606
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + lac + '</td>');
607
+ popupWin.document.write(' <td>&nbsp;</td>');
608
+ popupWin.document.write(' </tr>');
609
+ popupWin.document.write(' <tr>');
610
+ popupWin.document.write(' <td>&nbsp;</td>');
611
+ popupWin.document.write(' <td class="main" valign="top">eLOT&#8482;</td>');
612
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + elot + '</td>');
613
+ popupWin.document.write(' <td>&nbsp;</td>');
614
+ popupWin.document.write(' </tr>');
615
+ popupWin.document.write(' <tr>');
616
+ popupWin.document.write(' <td>&nbsp;</td>');
617
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">eLOT Ascending/Descending Indicator</td>');
618
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + elotindicator + '</td>');
619
+ popupWin.document.write(' <td>&nbsp;</td>');
620
+ popupWin.document.write(' </tr>');
621
+ popupWin.document.write(' <tr>');
622
+ popupWin.document.write(' <td>&nbsp;</td>');
623
+ popupWin.document.write(' <td class="main" valign="top">Record Type Code</td>');
624
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + recordtype + '</td>');
625
+ popupWin.document.write(' <td>&nbsp;</td>');
626
+ popupWin.document.write(' </tr>');
627
+ popupWin.document.write(' <tr>');
628
+ popupWin.document.write(' <td>&nbsp;</td>');
629
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">PMB Designator</td>');
630
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + pmbdesignator + '</td>');
631
+ popupWin.document.write(' <td>&nbsp;</td>');
632
+ popupWin.document.write(' </tr>');
633
+ popupWin.document.write(' <tr>');
634
+ popupWin.document.write(' <td>&nbsp;</td>');
635
+ popupWin.document.write(' <td class="main" valign="top">PMB Number</td>');
636
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + pmbnumber + '</td>');
637
+ popupWin.document.write(' <td>&nbsp;</td>');
638
+ popupWin.document.write(' </tr>');
639
+ popupWin.document.write(' <tr>');
640
+ popupWin.document.write(' <td>&nbsp;</td>');
641
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">Default Flag</td>');
642
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + defaultflag + '</td>');
643
+ popupWin.document.write(' <td>&nbsp;</td>');
644
+ popupWin.document.write(' </tr>');
645
+ popupWin.document.write(' <tr>');
646
+ popupWin.document.write(' <td>&nbsp;</td>');
647
+ popupWin.document.write(' <td class="main" valign="top">EWS Flag</td>');
648
+ popupWin.document.write(' <td align="right" valign="top" class="main">' + ewsflag + '</td>');
649
+ popupWin.document.write(' <td>&nbsp;</td>');
650
+ popupWin.document.write(' </tr>');
651
+ popupWin.document.write(' <tr>');
652
+ popupWin.document.write(' <td>&nbsp;</td>');
653
+ popupWin.document.write(' <td class="main" valign="top" bgcolor="#f3f3f3">DPV Confirmation Indicator</td>');
654
+ popupWin.document.write(' <td align="right" valign="top" bgcolor="#f3f3f3" class="main">' + dpvconfirmation + '</td>');
655
+ popupWin.document.write(' <td>&nbsp;</td>');
656
+ popupWin.document.write(' </tr>');
657
+ popupWin.document.write(' </tbody>');
658
+ popupWin.document.write('</table>');
659
+ popupWin.document.write('<table cellspacing="0" cellpadding="6" width="480" border="0">');
660
+ popupWin.document.write(' <tbody>');
661
+ popupWin.document.write(' <tr>');
662
+ popupWin.document.write(' <td width="464" align="right" valign="top"><a href="javascript:window.close()"><img src="images/button_close_window.gif" alt="Close Window" border="0" /></a></td>');
663
+ popupWin.document.write(' <td width="16">&nbsp;</td>');
664
+ popupWin.document.write(' </tr>');
665
+ popupWin.document.write(' </tbody>');
666
+ popupWin.document.write('</table>');
667
+ popupWin.document.write('<div align="right" style="width:100%; background: url(images/footer_bottom_tile.gif) bottom repeat-x">&nbsp;</div>');
668
+ popupWin.document.write('</body>');
669
+ popupWin.document.write('</html>');
670
+
671
+ popupWin.document.close();
672
+ } // end of mailingIndustryPopup2()
673
+
674
+ </SCRIPT>
675
+
676
+
677
+ <script language="JavaScript" type="text/JavaScript">
678
+ <!--
679
+ function swapImgRestore() {
680
+ document.getElementById('popup_layer').style.visibility='hidden';
681
+ var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
682
+ }
683
+
684
+ function preloadImages() {
685
+ var d=document; if(d.images){ if(!d.p) d.p=new Array();
686
+ var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
687
+ if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
688
+ }
689
+
690
+ function findObj(n, d) {
691
+ var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
692
+ d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
693
+ if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
694
+ for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
695
+ if(!x && d.getElementById) x=d.getElementById(n); return x;
696
+ }
697
+
698
+ function swapImage() {
699
+ document.getElementById('popup_layer').style.visibility='visible';
700
+ var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
701
+ if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
702
+
703
+ }
704
+ //-->
705
+ </script>
706
+
707
+ </head>
708
+ <body onload="preloadImages('images/question_trans_over.gif');" >
709
+ <script language="javascript1.1" type="text/javascript" src="includes/windows.js"></script>
710
+
711
+ <div id="popup_layer" class="popuplayer" style=" margin:40px 0px 0px 250px; padding:7px 7px 7px 7px; position:absolute; visibility:hidden;width:190px;"><div style="padding:0px 0px 10px 0px;">Standard Format</div>Your delivery address and ZIP Code&trade; are checked for proper Postal Service format and standardized if necessary.
712
+ <div style="padding:0px 0px 8px 0px;">For example:</div>
713
+
714
+ Entered:<br/ >
715
+ ABC Movers<br/ >
716
+ 1500 East Main Avenue, Suite 201<br/ >
717
+ <div style="padding:0px 0px 8px 0px;">Springfield, VA 22162</div>
718
+
719
+ Standardized:<br/ >
720
+ ABC MOVERS<br/ >
721
+ 1500 E MAIN AVE STE 201<br/ >
722
+ SPRINGFIELD VA 22162-1010 </div>
723
+ <form action="" method="get">
724
+
725
+ <div style="height:44px; width:720px;">
726
+ <a href="http://www.usps.com">
727
+ <img src="images/usps_logo.gif" title="USPS Homepage" width="165" height="44" border="0" align="left" />
728
+ </a>
729
+ <a href="#content">
730
+ <img align="left" src="images/spacer.gif" width="1" height="1" alt="Skip Navigation" border="0" />
731
+ </a>
732
+ <div class="topnav" align="right" style="float:right; width:200px; padding:25px 0px 0px 0px;">
733
+ <a href="http://www.usps.com">
734
+ USPS Home
735
+ </a>
736
+ &nbsp;&nbsp;|&nbsp;&nbsp;
737
+ <a tabindex="9" href="http://www.usps.com/faqs/ziplookup-faqs.htm?WT.z_zip4link=FAQ" target='faq' onclick='void openWindow ("http://www.usps.com/faqs/ziplookup-faqs.htm?WT.z_zip4link=FAQ", "faq", "width=750,height=400", 25, 25, window, "resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1");'>
738
+ FAQs
739
+ </a>
740
+ </div>
741
+ </div>
742
+ <div id="header" align="right" class="bluebarbold">
743
+ <a href="welcome.jsp">
744
+ ZIP Code Lookup
745
+ </a>
746
+ <img src="images/spacer.gif" width="10" height="16" alt="" border="0"/>
747
+ </div>
748
+
749
+ <a name="content"></a>
750
+
751
+
752
+ <div style="width:685px; margin-left:35px; padding:12px 0px 14px;">
753
+ <h1>Find a ZIP + 4&reg; Code By Address Results </h1>
754
+ </div>
755
+ <div style="width:375px; float:left; padding-left:35px;">
756
+ <h2>You Gave Us</h2>
757
+ <span class="main">
758
+
759
+ 6216 eddington drive<br />
760
+
761
+ middletown&nbsp;oh&nbsp;&nbsp;<br /><br />
762
+
763
+ <a title="Lookup Another ZIP Code" href="welcome.jsp">Lookup Another ZIP Code&#8482;</a></span>
764
+ </div>
765
+
766
+
767
+ <!-- div below used for spacing only -->
768
+ <div style="clear:both; width:635px; height:15px;"></div>
769
+ <div style="clear:both; width:600px; margin-left:35px; height:17px; background:url(images/pagination_tile.gif) repeat-x;"></div>
770
+ <div style="width:600px; margin-left:35px;">
771
+
772
+ <table width="600" border="0" cellspacing="0" cellpadding="0" summary="This table contains an exact match address and ZIP code.">
773
+ <tr>
774
+ <th width="300" align="left" id="full" style="padding:5px 10px;">
775
+ <h2>Full Address in Standard Format <a href="pu_standard_format.htm" target='someName31' onclick='void openWindow ("pu_standard_format.htm", "someName31", "width=250,height=250", 225, 200, window, "resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1");'onmouseout="swapImgRestore()" onmouseover="swapImage('Image40','','images/question_trans_over.gif',1)"><img src="images/question_trans.gif" alt="What is Standard Format?" width="18" height="22" border="0" align="absmiddle" id="Image40" /></a></h2></th>
776
+ <th width="120"></th>
777
+ <td width="180">&nbsp;</td>
778
+ </tr>
779
+ <tr>
780
+ <td headers="full" height="34" valign="top" class="main" style="background:url(images/table_gray.gif); padding:5px 10px;">
781
+
782
+ 6216 EDDINGTON ST<br />
783
+
784
+ LIBERTY TOWNSHIP&nbsp;OH&nbsp;&nbsp;45044-9761
785
+ <br />
786
+ </td>
787
+ <td style="background:url(images/table_gray.gif);">&nbsp;</td>
788
+ <td height="34" align="right" valign="top" class="main" style="background:url(images/table_gray.gif); padding:5px 10px;">
789
+ <a title="Mailing Industry Information" href="#" onClick="mailingIndustryPopup2('R007',
790
+ 'BUTLER',
791
+ '16',
792
+ '3',
793
+ '',
794
+ '0182',
795
+ 'A',
796
+ 'S',
797
+ '',
798
+ '',
799
+ '',
800
+ '',
801
+ 'Y');" >Mailing Industry Information</a>
802
+ </tr>
803
+ <tr>
804
+ <td colspan="3"><img src="images/spacer.gif" width="1" height="4" alt="" border="0" /></td>
805
+ </tr>
806
+ <tr>
807
+ <td colspan="3"><img src="images/spacer.gif" width="1" height="10" alt="" border="0" /></td>
808
+ </tr>
809
+ </table>
810
+ </div>
811
+
812
+ <div style="clear:both; width:600px; margin-left:35px; height:17px; background:url(images/pagination_bottom_tile.gif) repeat-x;"></div>
813
+
814
+ <div style="width:635px; clear:both;">
815
+ <table width="635" border="0" cellspacing="0" cellpadding="0" summary="This table is used to format page content.">
816
+ <tr>
817
+ <td width="35"><img src="images/spacer.gif" height="23" width="35" alt="" border="0" /></td>
818
+ <td width="197"><img src="images/spacer.gif" height="23" width="197" alt="" border="0" /></td>
819
+ <td width="7"><img src="images/spacer.gif" height="23" width="7" alt="" border="0" /></td>
820
+ <td width="197"><img src="images/spacer.gif" height="23" width="197" alt="" border="0" /></td>
821
+ <td width="7"><img src="images/spacer.gif" height="23" width="7" alt="" border="0" /></td>
822
+ <td width="192"><img src="images/spacer.gif" height="23" width="192" alt="" border="0" /></td>
823
+ </tr><tr>
824
+ <td></td>
825
+ <td valign="top" style="background:url(images/lt_gray_background.gif);"><div style="margin:5px 15px 0px 20px;"><span class="mainBold">Related Links</span><br/>
826
+ <br/>
827
+ <span class="main"><strong>Calculate Postage</strong><br />
828
+ Calculate postage for your letter or package online!<br />
829
+ <a href="http://www.usps.com/tools/domesticratecalc/welcome.htm?from=zclresults&amp;page=ratecalc" target='rate' onclick='void openWindow ("http://www.usps.com/tools/domesticratecalc/welcome.htm?from=zclresults&amp;page=ratecalc", "rate", "width=750,height=400", 50, 50, window, "resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1");'> Rate Calculator</a></span></div></td>
830
+ <td style="background:url(images/lt_gray_background.gif);"></td>
831
+ <td valign="top" style="background:url(images/lt_gray_background.gif);"><div style="margin:20px 20px 0px 20px;">&nbsp;<br/>
832
+ <span class="main"><strong>Print Shipping Labels</strong> <br />
833
+ Print shipping labels from your desktop and pay online.<br />
834
+ <a href="http://www.usps.com/shipping/label.htm?from=zclresults&amp;page=cns" target='click' onclick='void openWindow ("http://www.usps.com/shipping/label.htm?from=zclresults&amp;page=cns", "click", "width=750,height=400", 50, 50, window, "resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1");'> Click-N-Ship&reg;</a><br />
835
+ <a href="http://www.usps.com/onlinepostage/welcome.htm?from=zclresults&amp;page=otherpostage" target='other' onclick='void openWindow ("http://www.usps.com/onlinepostage/welcome.htm?from=zclresults&amp;page=otherpostage", "other", "width=750,height=400", 50, 50, window, "resizable=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,scrollbars=1");'> Other Postage</a></span></div></td>
836
+ <td></td>
837
+ <td valign="top">
838
+ <div style="border-top:1px solid #CCC; border-bottom:1px solid #CCC; background:url(images/lt_gray_background.gif);">
839
+ <div style="margin:5px 15px;"><span class="mainBold">Residential and<br/>
840
+ Business Lookup</span><br/>
841
+ <br/>
842
+ <span class="main">Find an address with WhitePages<br>
843
+ <a href="http://usps2.whitepages.com/person?WT.z_zip4link=wp_people_search" target="_blank">People Search</a> and<br>
844
+ <a href="http://usps2.whitepages.com/business?WT.z_zip4link=wp_business_search" target="_blank">Business Search</a>.</span></div>
845
+ <div align="right"><a href="http://www.whitepages.com/?WT.z_zip4link=wp_com" target="_blank"><img src="images/WP_serviceOF_logo_110x30.gif" alt="A service of WhitePages" border="0"></a></div>
846
+ </div>
847
+ </td>
848
+ </tr>
849
+ <tr>
850
+ <td colspan="6"><img src="images/spacer.gif" alt="" width="1" height="18" border="0" /></td>
851
+ </tr>
852
+ </table><!-- Ensure JSP Page reload. -->
853
+ </div>
854
+
855
+ <style type="text/css">
856
+ @import url("http://www.usps.com/common/stylesheets/07/footer.css");
857
+
858
+ </style>
859
+
860
+ <div id="footer">
861
+ <div class="footNavImgFirst" id="footNavImg1"><a href="http://www.usps.com/homearea/sitemap.htm?from=global_footer&page=sitemap" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','SiteMap')">Site Map</a></div>
862
+ <div class="footNavImg" id="footNavImg2"><a href="http://www.usps.com/customerservice/welcome.htm?from=global_footer&page=customerservice" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','CustomerService')">Customer Service</a></div>
863
+ <div class="footNavImg" id="footNavImg3"><a href="http://www.usps.com/forms/welcome.htm?from=global_footer&page=forms" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','Forms')">Forms</a></div>
864
+ <div class="footNavImg" id="footNavImg4"><a href="http://www.usps.com/homearea/category/govtlinks.htm?from=global_footer&page=govtservices" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','GovtServices')">Gov't Services</a></div>
865
+ <div class="footNavImg" id="footNavImg5"><a href="http://www.usps.com/employment/welcome.htm?from=global_footer&page=careers" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','Careers')">Careers</a></div>
866
+ <div class="footNavImg" id="footNavImg6"><a href="http://www.usps.com/homearea/docs/privpol.htm?from=global_footer&page=privacypolicy" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','PrivacyPolicy')">Privacy Policy</a></div>
867
+ <div class="footNavImg" id="footNavImg7"><a href="http://www.usps.com/homearea/docs/termsofuse.htm?from=global_footer&page=termsofuse" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','TermsOfUse')">Terms of Use</a></div>
868
+ <div class="footNavImgLast" id="footNavImg9"><a href="http://www.usps.com/nationalpremieraccounts/welcome.htm?from=global_footer&page=natlandpremiereaccts" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','NationalAndPremierAccounts')">Business Customer Gateway</a></div>
869
+ <br />
870
+ <div id="copyright">Copyright&copy; 2010 USPS. All Rights Reserved.</div>
871
+ <div id="noFear"><a href="http://www.usps.com/nofearact/welcome.htm?from=global_footer&page=nofearacteeo" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','NoFearAct')">No FEAR Act EEO Data</a></div>
872
+ <div id="FOIA"><a title="Freedom of Information Act" href="http://www.usps.com/foia/welcome.htm?from=global_footer&page=foia" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','FOIA')">FOIA</a></div><a href="http://www.usps.com/postalinspectors?from=global_footer&page=postalinspectors" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','PostalInspectors')"><img style="MARGIN: 10px 0px 0px 42px" height="19" alt="Postal Inspectors Preserving the Trust" hspace="0" src="http://www.usps.com/common/images/07/usps_hm_ftr_bt_pstins.gif" width="108" align="top" border="0" /></a><a href="http://www.usps.com/all/oig/welcome.htm?from=global_footer&page=inspectorgeneral" onClick="dcsMultiTrack('DCS.dcsuri','/ed','WT.z_section','Global_Footer','WT.z_link','InspectorGeneral')"><img style="MARGIN: 10px 0px 0px 20px" height="22" alt="Inspector General Promoting Integrity" hspace="0" src="http://www.usps.com/common/images/07/usps_hm_ftr_bt_insgen.gif" width="101" align="top" border="0" /></a></div>
873
+
874
+ <!-- START OF SmartSource Data Collector TAG for ZIP Code Lookup Footer -->
875
+ <!-- Copyright (c) 1996-2009 WebTrends Inc. All rights reserved. -->
876
+ <!-- Version: 8.6.2 -->
877
+ <!-- Tag Builder Version: 3.0 -->
878
+ <!-- Created: 12/17/2009 8:47:13 PM -->
879
+ <script src="includes/webtrends.js" type="text/javascript"></script>
880
+ <!-- ----------------------------------------------------------------------------------- -->
881
+ <!-- Warning: The two script blocks below must remain inline. Moving them to an external -->
882
+ <!-- JavaScript include file can cause serious problems with cross-domain tracking. -->
883
+ <!-- ----------------------------------------------------------------------------------- -->
884
+ <script type="text/javascript">
885
+ //<![CDATA[
886
+ var _tag=new WebTrends();
887
+ _tag.dcsGetId();
888
+ //]]>>
889
+ </script>
890
+ <script type="text/javascript">
891
+ //<![CDATA[
892
+ // Add custom parameters here.
893
+ //_tag.DCSext.param_name=param_value;
894
+ _tag.dcsCollect();
895
+ //]]>>
896
+ </script>
897
+ <noscript>
898
+ <div><img alt="DCSIMG" id="DCSIMG" width="1" height="1" src="http://sdc.usps.com/dcsq8lc5w10000sxojnpk5m85_1i5u/njs.gif?dcsuri=/nojavascript&amp;WT.js=No&amp;WT.tv=8.6.2"/></div>
899
+ </noscript>
900
+ <!-- END OF SmartSource Data Collector TAG -->
901
+
902
+
903
+ </form>
904
+ </body>
905
+ </html>
906
+
@@ -0,0 +1,8 @@
1
+ ENV["BUNDLE_GEMFILE"] = File.dirname(__FILE__) + "/../Gemfile"
2
+
3
+
4
+ require "bundler/setup"
5
+ Bundler.setup
6
+
7
+ require "usps_standardizer"
8
+
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+
3
+ describe USPSStandardizer::ZipLookup do
4
+ let(:content) { File.read(File.dirname(__FILE__) + "/../fixtures/content.html") }
5
+
6
+ describe "std_address" do
7
+ it "return [] if invalid address" do
8
+ subject.stub(:get_std_address_content).and_return(false)
9
+ subject.std_address.should be_empty
10
+ end
11
+ it "return a standardized address" do
12
+ subject.stub(:get_std_address_content).and_return(content)
13
+ a = subject.std_address
14
+ a.should be_instance_of(Array)
15
+ a.should_not be_empty
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe USPSStandardizer do
4
+
5
+ it "has a version" do
6
+ USPSStandardizer::Version::STRING.should match(/^\d+\.\d+\.\d+$/)
7
+ end
8
+
9
+ it "standards an address on usps website" do
10
+ result = USPSStandardizer.lookup_for(:address => '6216 eddington drive', :state => 'oh', :city => 'middletown')
11
+ result[0][:address].should == '6216 EDDINGTON ST'
12
+ result[0][:state].should == 'OH'
13
+ result[0][:city].should == 'LIBERTY TOWNSHIP'
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "usps_standardizer/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "usps_standardizer"
7
+ s.version = USPSStandardizer::Version::STRING
8
+ s.authors = ["Rafael Macedo"]
9
+ s.email = ["macedo.rafaelfernandes@gmail.com"]
10
+ s.homepage = "http://github.com/rafaelmacedo/usps_standardizer"
11
+ s.summary = "Ruby class to standardize U.S. postal addresses by referencing the U.S. Postal Service's web site"
12
+ s.description = s.summary
13
+
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency "mechanize", "~> 2.0.1"
21
+ s.add_dependency "sanitize", "~> 2.0.3"
22
+ s.add_development_dependency "rspec", "~> 2.6.0"
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: usps_standardizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rafael Macedo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-07 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mechanize
16
+ requirement: &77616020 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *77616020
25
+ - !ruby/object:Gem::Dependency
26
+ name: sanitize
27
+ requirement: &77615760 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.3
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *77615760
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &77615520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.6.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *77615520
47
+ description: Ruby class to standardize U.S. postal addresses by referencing the U.S.
48
+ Postal Service's web site
49
+ email:
50
+ - macedo.rafaelfernandes@gmail.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - .rspec
57
+ - Gemfile
58
+ - README.rdoc
59
+ - Rakefile
60
+ - lib/usps_standardizer.rb
61
+ - lib/usps_standardizer/version.rb
62
+ - lib/usps_standardizer/zip_lookup.rb
63
+ - spec/fixtures/content.html
64
+ - spec/spec_helper.rb
65
+ - spec/usps_standardizer/zip_lookup_spec.rb
66
+ - spec/usps_standardizer_spec.rb
67
+ - usps_standardizer.gemspec
68
+ homepage: http://github.com/rafaelmacedo/usps_standardizer
69
+ licenses: []
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.10
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Ruby class to standardize U.S. postal addresses by referencing the U.S. Postal
92
+ Service's web site
93
+ test_files: []