StreetAddress 1.0.5 → 2.0.0

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.
metadata CHANGED
@@ -1,70 +1,120 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: StreetAddress
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 5
9
- version: 1.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Derrek Long
13
- - Nicholas Schleuter
14
- autorequire:
15
8
  bindir: bin
16
9
  cert_chain: []
17
-
18
- date: 2013-06-16 00:00:00 -07:00
19
- default_executable:
20
- dependencies: []
21
-
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bundler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '13.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '13.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: minitest
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '5.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: irb
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.14'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.14'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rdoc
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '6.0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '6.0'
22
82
  description: |
23
- StreetAddress::US allows you to send any string to parse and if the string is a US address returns an object of the address broken into it's substituent parts.
24
-
25
- A port of Geo::StreetAddress::US by Schuyler D. Erle and Tim Bunce.
83
+ StreetAddress::US allows you to send any string to parse and if the string
84
+ is a US address returns an object of the address broken into its constituent parts.
26
85
 
86
+ A port of Geo::StreetAddress::US by Schuyler D. Erle and Tim Bunce.
27
87
  email: derreklong@gmail.com
28
88
  executables: []
29
-
30
89
  extensions: []
31
-
32
90
  extra_rdoc_files: []
33
-
34
- files:
35
- - README.rdoc
36
- - Rakefile
37
- - LICENSE
91
+ files:
92
+ - CHANGELOG.md
93
+ - LICENCE
94
+ - README.md
38
95
  - lib/street_address.rb
39
- has_rdoc: true
40
- homepage: https://github.com/derrek/street-address
41
- licenses: []
42
-
43
- post_install_message:
96
+ homepage: https://github.com/street-address-rb/street-address
97
+ licenses:
98
+ - MIT
99
+ metadata:
100
+ source_code_uri: https://github.com/street-address-rb/street-address
101
+ changelog_uri: https://github.com/street-address-rb/street-address/blob/master/CHANGELOG.md
102
+ bug_tracker_uri: https://github.com/street-address-rb/street-address/issues
44
103
  rdoc_options: []
45
-
46
- require_paths:
104
+ require_paths:
47
105
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
49
- requirements:
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
50
108
  - - ">="
51
- - !ruby/object:Gem::Version
52
- segments:
53
- - 0
54
- version: "0"
55
- required_rubygems_version: !ruby/object:Gem::Requirement
56
- requirements:
109
+ - !ruby/object:Gem::Version
110
+ version: '3.3'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
57
113
  - - ">="
58
- - !ruby/object:Gem::Version
59
- segments:
60
- - 0
61
- version: "0"
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
62
116
  requirements: []
63
-
64
- rubyforge_project:
65
- rubygems_version: 1.3.6
66
- signing_key:
67
- specification_version: 3
68
- summary: Parse Addresses into substituent parts. This gem includes US only.
69
- test_files:
70
- - test/test_street_address.rb
117
+ rubygems_version: 3.6.7
118
+ specification_version: 4
119
+ summary: Parse US street addresses into constituent parts.
120
+ test_files: []
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2011 Derrek Long
2
-
3
- The MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,45 +0,0 @@
1
- == DESCRIPTION:
2
-
3
- Parses one line street addresses and returns a normalized address object.
4
-
5
- This is a near direct port of the of the perl module
6
- Geo::StreetAddress::US originally written by Schuyler D. Erle.
7
- For more information see
8
- http://search.cpan.org/~sderle/Geo-StreetAddress-US-0.99/
9
-
10
- == SYNOPSIS:
11
-
12
- Parse United States addresses.
13
-
14
- === Basic Usage:
15
- require 'street_address'
16
- address = StreetAddress::US.parse("1600 Pennsylvania Ave, Washington, DC, 20500")
17
- address.street # Pennsylvania
18
- address.number # 1600
19
- address.postal_code # 20500
20
- address.city # Washington
21
- address.state # DC
22
- address.state_name # District of columbia
23
- address.street_type # Ave
24
- address.intersection? # false
25
- address.to_s # "1600 Pennsylvania Ave, Washington, DC 20500"
26
- address.to_s(:line1) # 1600 Pennsylvania Ave
27
- StreetAddress::US.parse("1600 Pennsylvania Ave") # nil not a full address
28
-
29
- === Informal/Loose Parsing
30
- address = StreetAddress::US.parse("1600 Pennsylvania Avenue", :informal => true)
31
- address.number # 1600
32
- address.street # Pennsylvania
33
- address.street_type # Ave
34
- address.to_s # 1600 Pennsylvania Ave
35
-
36
- === Zip+4
37
- address = StreetAddress::US.parse("5904 Richmond Hwy Ste 340 Alexandria VA 22303-1864")
38
- address.postal_code_ext # 1846
39
-
40
- address = StreetAddress::US.parse("5904 Richmond Hwy Ste 340 Alexandria VA 223031864")
41
- address.postal_code_ext # 1846
42
-
43
- === Gemfile:
44
- To use from your Gemfile:
45
- gem 'StreetAddress', '1.0.3', :require => "street_address"
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require 'rake/testtask'
2
-
3
- Rake::TestTask.new do |t|
4
- t.libs << 'test'
5
- end
6
-
7
- desc "Run tests"
8
- task :default => :test
@@ -1,175 +0,0 @@
1
- require 'test/unit'
2
- require 'street_address'
3
-
4
-
5
- class StreetAddressUsTest < Test::Unit::TestCase
6
- def setup
7
- @addr1 = "2730 S Veitch St Apt 207, Arlington, VA 22206"
8
- @addr2 = "44 Canal Center Plaza Suite 500, Alexandria, VA 22314"
9
- @addr3 = "1600 Pennsylvania Ave Washington DC"
10
- @addr4 = "1005 Gravenstein Hwy N, Sebastopol CA 95472"
11
- @addr5 = "PO BOX 450, Chicago IL 60657"
12
- @addr6 = "2730 S Veitch St #207, Arlington, VA 22206"
13
-
14
- @int1 = "Hollywood & Vine, Los Angeles, CA"
15
- @int2 = "Hollywood Blvd and Vine St, Los Angeles, CA"
16
- @int3 = "Mission Street at Valencia Street, San Francisco, CA"
17
-
18
- end
19
-
20
- def test_zip_plus_4_with_dash
21
- addr = StreetAddress::US.parse("2730 S Veitch St, Arlington, VA 22206-3333")
22
- assert_equal "3333", addr.postal_code_ext
23
- end
24
-
25
- def test_zip_plus_4_without_dash
26
- addr = StreetAddress::US.parse("2730 S Veitch St, Arlington, VA 222064444")
27
- assert_equal "4444", addr.postal_code_ext
28
- end
29
-
30
- def test_informal_parse_normal_address
31
- a = StreetAddress::US.parse("2730 S Veitch St, Arlington, VA 222064444", :informal => true)
32
- assert_equal "2730", a.number
33
- assert_equal "S", a.prefix
34
- assert_equal "Veitch", a.street
35
- assert_equal "St", a.street_type
36
- assert_equal "Arlington", a.city
37
- assert_equal "VA", a.state
38
- assert_equal "22206", a.postal_code
39
- assert_equal "4444", a.postal_code_ext
40
- end
41
-
42
- def test_informal_parse_informal_address
43
- a = StreetAddress::US.parse("2730 S Veitch St", :informal => true)
44
- assert_equal "2730", a.number
45
- assert_equal "S", a.prefix
46
- assert_equal "Veitch", a.street
47
- assert_equal "St", a.street_type
48
- end
49
-
50
- def test_informal_parse_informal_address_trailing_words
51
- a = StreetAddress::US.parse("2730 S Veitch St in the south of arlington", :informal => true)
52
- assert_equal "2730", a.number
53
- assert_equal "S", a.prefix
54
- assert_equal "Veitch", a.street
55
- assert_equal "St", a.street_type
56
- end
57
-
58
- def test_parse
59
- assert_equal StreetAddress::US.parse("&"), nil
60
- assert_equal StreetAddress::US.parse(" and "), nil
61
-
62
- addr = StreetAddress::US.parse(@addr1)
63
- assert_equal addr.number, "2730"
64
- assert_equal addr.postal_code, "22206"
65
- assert_equal addr.prefix, "S"
66
- assert_equal addr.state, "VA"
67
- assert_equal addr.street, "Veitch"
68
- assert_equal addr.street_type, "St"
69
- assert_equal addr.unit, "207"
70
- assert_equal addr.unit_prefix, "Apt"
71
- assert_equal addr.city, "Arlington"
72
- assert_equal addr.prefix2, nil
73
- assert_equal addr.postal_code_ext, nil
74
-
75
- addr = StreetAddress::US.parse(@addr2)
76
- assert_equal addr.number, "44"
77
- assert_equal addr.postal_code, "22314"
78
- assert_equal addr.prefix, nil
79
- assert_equal addr.state, "VA"
80
- assert_equal addr.street, "Canal Center"
81
- assert_equal addr.street_type, "Plz"
82
- assert_equal addr.unit, "500"
83
- assert_equal addr.unit_prefix, "Suite"
84
- assert_equal addr.city, "Alexandria"
85
- assert_equal addr.street2, nil
86
-
87
- addr = StreetAddress::US.parse(@addr3)
88
- assert_equal addr.number, "1600"
89
- assert_equal addr.postal_code, nil
90
- assert_equal addr.prefix, nil
91
- assert_equal addr.state, "DC"
92
- assert_equal addr.street, "Pennsylvania"
93
- assert_equal addr.street_type, "Ave"
94
- assert_equal addr.unit, nil
95
- assert_equal addr.unit_prefix, nil
96
- assert_equal addr.city, "Washington"
97
- assert_equal addr.street2, nil
98
-
99
-
100
-
101
- addr = StreetAddress::US.parse(@addr4)
102
- assert_equal addr.number, "1005"
103
- assert_equal addr.postal_code, "95472"
104
- assert_equal addr.prefix, nil
105
- assert_equal addr.state, "CA"
106
- assert_equal addr.street, "Gravenstein"
107
- assert_equal addr.street_type, "Hwy"
108
- assert_equal addr.unit, nil
109
- assert_equal addr.unit_prefix, nil
110
- assert_equal addr.city, "Sebastopol"
111
- assert_equal addr.street2, nil
112
- assert_equal addr.suffix, "N"
113
-
114
-
115
- addr = StreetAddress::US.parse(@addr5)
116
- assert_equal addr, nil
117
-
118
-
119
- addr = StreetAddress::US.parse(@addr6)
120
- assert_equal("207", addr.unit)
121
-
122
- addr = StreetAddress::US.parse(@int1)
123
- assert_equal addr.city, "Los Angeles"
124
- assert_equal addr.state, "CA"
125
- assert_equal addr.street, "Hollywood"
126
- assert_equal addr.street2, "Vine"
127
- assert_equal addr.number, nil
128
- assert_equal addr.postal_code, nil
129
- assert_equal addr.intersection?, true
130
-
131
- addr = StreetAddress::US.parse(@int2)
132
- assert_equal addr.city, "Los Angeles"
133
- assert_equal addr.state, "CA"
134
- assert_equal addr.street, "Hollywood"
135
- assert_equal addr.street2, "Vine"
136
- assert_equal addr.number, nil
137
- assert_equal addr.postal_code, nil
138
- assert_equal addr.intersection?, true
139
- assert_equal addr.street_type, "Blvd"
140
- assert_equal addr.street_type2, "St"
141
- assert_equal addr.line1, nil
142
-
143
- addr = StreetAddress::US.parse(@int3)
144
- assert_equal addr.city, "San Francisco"
145
- assert_equal addr.state, "CA"
146
- assert_equal addr.street, "Mission"
147
- assert_equal addr.street2, "Valencia"
148
- assert_equal addr.number, nil
149
- assert_equal addr.postal_code, nil
150
- assert_equal addr.intersection?, true
151
- assert_equal addr.street_type, "St"
152
- assert_equal addr.street_type2, "St"
153
-
154
- parseable = ["1600 Pennsylvania Ave Washington DC 20006",
155
- "1600 Pennsylvania Ave #400, Washington, DC, 20006",
156
- "1600 Pennsylvania Ave Washington, DC",
157
- "1600 Pennsylvania Ave #400 Washington DC",
158
- "1600 Pennsylvania Ave, 20006",
159
- "1600 Pennsylvania Ave #400, 20006",
160
- "1600 Pennsylvania Ave 20006",
161
- "1600 Pennsylvania Ave #400 20006",
162
- "Hollywood & Vine, Los Angeles, CA",
163
- "Hollywood Blvd and Vine St, Los Angeles, CA",
164
- "Mission Street at Valencia Street, San Francisco, CA",
165
- "Hollywood & Vine, Los Angeles, CA, 90028",
166
- "Hollywood Blvd and Vine St, Los Angeles, CA, 90028",
167
- "Mission Street at Valencia Street, San Francisco, CA, 90028"]
168
-
169
- parseable.each do |location|
170
- assert_not_nil(StreetAddress::US.parse(location), location + " was not parse able")
171
- end
172
-
173
- end
174
-
175
- end