usps_standardizer 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module USPSStandardizer
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 3
4
+ MINOR = 4
5
5
  PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
@@ -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
- return @mechanize.page.search('div#result-list ul li:first').to_html
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.3.1
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-02-16 00:00:00.000000000Z
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: &74582760 !ruby/object:Gem::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: *74582760
24
+ version_requirements: *75932410
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &74582510 !ruby/object:Gem::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: *74582510
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: