address_standardization 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{address_standardization}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Elliot Winkler"]
12
- s.date = %q{2010-02-01}
12
+ s.date = %q{2010-05-04}
13
13
  s.description = %q{A tiny Ruby library to quickly standardize a postal address}
14
14
  s.email = %q{elliot.winkler@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  s.homepage = %q{http://github.com/mcmire/address_standardization}
38
38
  s.rdoc_options = ["--charset=UTF-8"]
39
39
  s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.3.5}
40
+ s.rubygems_version = %q{1.3.6}
41
41
  s.summary = %q{A tiny Ruby library to quickly standardize a postal address}
42
42
  s.test_files = [
43
43
  "test/google_maps_test.rb",
@@ -16,7 +16,7 @@ module AddressStandardization
16
16
  address_info["city"],
17
17
  (address_info["state"] || address_info["province"]),
18
18
  address_info["zip"]
19
- ].join(" ")
19
+ ].compact.join(" ")
20
20
  url = "http://maps.google.com/maps/geo?q=#{address_str.url_escape}&output=xml&key=#{GoogleMaps.api_key}&oe=utf-8"
21
21
  AddressStandardization.debug "[GoogleMaps] Hitting URL: #{url}"
22
22
  uri = URI.parse(url)
@@ -22,7 +22,7 @@ module AddressStandardization
22
22
  #puts "URL: <#{url}>"
23
23
 
24
24
  attrs = {:country => (is_canada ? "CANADA" : "USA")}
25
- WWW::Mechanize.new do |ua|
25
+ Mechanize.new do |ua|
26
26
  AddressStandardization.debug "[MelissaData] Hitting URL: #{url}"
27
27
  results_page = ua.get(url)
28
28
  AddressStandardization.debug "[MelissaData] Response body:"
@@ -1,3 +1,3 @@
1
1
  module AddressStandardization
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -23,17 +23,17 @@ class GoogleMapsTest < Test::Unit::TestCase
23
23
 
24
24
  test "A valid Canadian address" do
25
25
  addr = AddressStandardization::GoogleMaps.standardize_address(
26
- :street => "1770 Stenson Boulevard",
27
- :city => "Peterborough",
28
- "province" => "ON"
26
+ :street => "55 East Cordova St. Apt 415",
27
+ :city => "Vancouver",
28
+ "province" => "BC"
29
29
  )
30
30
  addr.should == AddressStandardization::Address.new(
31
- "street" => "1770 STENSON BLVD",
32
- "city" => "PETERBOROUGH",
33
- "state" => "ON",
34
- "province" => "ON",
35
- "postalcode" => "K9K",
36
- "zip" => "K9K",
31
+ "street" => "55 CORDOVA ST E #415",
32
+ "city" => "VANCOUVER",
33
+ "state" => "BC",
34
+ "province" => "BC",
35
+ "postalcode" => "V6A",
36
+ "zip" => "V6A",
37
37
  "country" => "CANADA"
38
38
  )
39
39
  end
@@ -48,18 +48,20 @@ class MelissaDataTest < Test::Unit::TestCase
48
48
 
49
49
  test "Valid Canadian address" do
50
50
  addr = AddressStandardization::MelissaData.standardize_address(
51
- "street" => "3025 Clayhill Rd",
52
- :city => "Mississauga",
53
- "province" => "ON",
51
+ "street" => "55 Cordova St E #415",
52
+ :city => "Vancouver",
53
+ "province" => "BC",
54
+ # FIXME: This must be postalcode, it doesn't work with zip...
55
+ :postalcode => "V6A0A5",
54
56
  :country => "CANADA"
55
57
  )
56
58
  addr.should == AddressStandardization::Address.new(
57
- "street" => "3025 CLAYHILL RD",
58
- "state" => "ON",
59
- "province" => "ON",
60
- "city" => "MISSISSAUGA",
61
- "zip" => "L5B 4L2",
62
- "postalcode" => "L5B 4L2",
59
+ "street" => "415-55 CORDOVA ST E",
60
+ "city" => "VANCOUVER",
61
+ "state" => "BC",
62
+ "province" => "BC",
63
+ "postalcode" => "V6A 0A5",
64
+ "zip" => "V6A 0A5",
63
65
  "country" => "CANADA"
64
66
  )
65
67
  end
@@ -4,8 +4,6 @@ require 'context'
4
4
  gem 'mcmire-matchy'
5
5
  require 'matchy'
6
6
 
7
- require 'address_standardization'
8
-
9
7
  module Context
10
8
  class SharedBehavior < Module
11
9
  # Fix this so that sharing a module twice within two sub-contexts
@@ -45,4 +43,7 @@ class << Test::Unit::TestCase
45
43
  end
46
44
  end
47
45
  %w(uses it_should_behave_like behaves_like uses_examples_from).each {|m| alias_method m, :use}
48
- end
46
+ end
47
+
48
+ require 'address_standardization'
49
+ AddressStandardization.debug_mode = true
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: address_standardization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 1
9
+ version: 0.4.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Elliot Winkler
@@ -9,39 +14,45 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-01 00:00:00 -06:00
17
+ date: 2010-05-04 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: mechanize
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: mcmire-context
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
33
41
  version: "0"
34
- version:
42
+ type: :development
43
+ version_requirements: *id002
35
44
  - !ruby/object:Gem::Dependency
36
45
  name: mcmire-matchy
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
40
48
  requirements:
41
49
  - - ">="
42
50
  - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
43
53
  version: "0"
44
- version:
54
+ type: :development
55
+ version_requirements: *id003
45
56
  description: A tiny Ruby library to quickly standardize a postal address
46
57
  email: elliot.winkler@gmail.com
47
58
  executables: []
@@ -81,18 +92,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
92
  requirements:
82
93
  - - ">="
83
94
  - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
84
97
  version: "0"
85
- version:
86
98
  required_rubygems_version: !ruby/object:Gem::Requirement
87
99
  requirements:
88
100
  - - ">="
89
101
  - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
90
104
  version: "0"
91
- version:
92
105
  requirements: []
93
106
 
94
107
  rubyforge_project:
95
- rubygems_version: 1.3.5
108
+ rubygems_version: 1.3.6
96
109
  signing_key:
97
110
  specification_version: 3
98
111
  summary: A tiny Ruby library to quickly standardize a postal address