usps_standardizer 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,11 +55,11 @@ module USPSStandardizer
|
|
55
55
|
private
|
56
56
|
|
57
57
|
def get_std_address_content
|
58
|
-
url = "https://tools.usps.com/go/ZipLookupResultsAction!input.action?resultMode=0&companyName=&address1=#{@address}&address2=&city=#{@city}&state=#{@state}&urbanCode=&postalCode=&zip
|
58
|
+
url = "https://tools.usps.com/go/ZipLookupResultsAction!input.action?resultMode=0&companyName=&address1=#{@address}&address2=&city=#{@city}&state=#{@state}&urbanCode=&postalCode=&zip=#{@zipcode}"
|
59
59
|
@mechanize.get url
|
60
60
|
|
61
|
-
return false unless @mechanize.page.search('div#error-box').empty?
|
62
|
-
|
61
|
+
return false unless @mechanize.page.search('div#error-box').empty? || @mechanize.page.search('div#result-list ul li').count != 1
|
62
|
+
@mechanize.page.search('div#result-list ul li:first').to_html
|
63
63
|
end
|
64
64
|
|
65
65
|
def cache
|
@@ -25,7 +25,7 @@ describe USPSStandardizer do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "standards an address on usps website" do
|
28
|
-
result = USPSStandardizer.lookup_for(:address => '6216 eddington drive', :state => 'oh', :city => 'middletown')
|
28
|
+
result = USPSStandardizer.lookup_for(:address => '6216 eddington drive', :state => 'oh', :city => 'middletown', :zipcode => '45044')
|
29
29
|
result[:address].should == '6216 EDDINGTON ST'
|
30
30
|
result[:state].should == 'OH'
|
31
31
|
result[:city].should == 'LIBERTY TOWNSHIP'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps_standardizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
16
|
-
requirement: &
|
16
|
+
requirement: &75932410 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *75932410
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &75932150 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *75932150
|
36
36
|
description: Ruby class to standardize U.S. postal addresses by referencing the U.S.
|
37
37
|
Postal Service's web site
|
38
38
|
email:
|