address_composer 0.1.7.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -23
- data/address-formatting/README.md +2 -2
- data/address-formatting/conf/countries/worldwide.yaml +11 -2
- data/address-formatting/testcases/countries/as.yaml +7 -8
- data/address-formatting/testcases/countries/gu.yaml +2 -2
- data/address-formatting/testcases/countries/sg.yaml +18 -1
- data/address-formatting/testcases/countries/us.yaml +31 -0
- data/address_composer.gemspec +4 -4
- data/lib/address_composer.rb +3 -3
- data/lib/address_composer/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e870bd8e39f5cf689942c7b4343f2d885f4de4ebdcb01878f8627c1b685039
|
4
|
+
data.tar.gz: '07117792510f3dd522c3443fabf1844f8039fbca6f08e94e550a59a86198244d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2063f714d1f0100f71274808375364677430d213794b63e4d1eb4cfc95e8ac2e6eb56e7dd8464699da03a7614a6d3d7ac5578fa4106ea1bbcae1a605390dda
|
7
|
+
data.tar.gz: 385f17417dc4884f44ced76e8a5d48b631395a53213554e840ef87072315df43caddd5fde7515d3f5da75824c64f4de3bc8d288783e0419d2c9e6b29c9c7e9a0
|
data/Gemfile.lock
CHANGED
@@ -1,48 +1,49 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
address_composer (
|
4
|
+
address_composer (1.0.0)
|
5
5
|
mustache (~> 1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
byebug (11.1.3)
|
11
|
-
coderay (1.1.
|
12
|
-
diff-lcs (1.
|
11
|
+
coderay (1.1.3)
|
12
|
+
diff-lcs (1.4.4)
|
13
13
|
method_source (1.0.0)
|
14
14
|
mustache (1.1.1)
|
15
|
-
pry (0.
|
15
|
+
pry (0.14.1)
|
16
16
|
coderay (~> 1.1)
|
17
17
|
method_source (~> 1.0)
|
18
|
-
pry-byebug (3.
|
18
|
+
pry-byebug (3.8.0)
|
19
19
|
byebug (~> 11.0)
|
20
|
-
pry (~> 0.
|
21
|
-
rake (13.0.
|
22
|
-
rspec (3.
|
23
|
-
rspec-core (~> 3.
|
24
|
-
rspec-expectations (~> 3.
|
25
|
-
rspec-mocks (~> 3.
|
26
|
-
rspec-core (3.
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-expectations (3.
|
20
|
+
pry (~> 0.10)
|
21
|
+
rake (13.0.6)
|
22
|
+
rspec (3.10.0)
|
23
|
+
rspec-core (~> 3.10.0)
|
24
|
+
rspec-expectations (~> 3.10.0)
|
25
|
+
rspec-mocks (~> 3.10.0)
|
26
|
+
rspec-core (3.10.1)
|
27
|
+
rspec-support (~> 3.10.0)
|
28
|
+
rspec-expectations (3.10.1)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-mocks (3.
|
30
|
+
rspec-support (~> 3.10.0)
|
31
|
+
rspec-mocks (3.10.2)
|
32
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.
|
34
|
-
rspec-support (3.
|
33
|
+
rspec-support (~> 3.10.0)
|
34
|
+
rspec-support (3.10.2)
|
35
35
|
|
36
36
|
PLATFORMS
|
37
37
|
ruby
|
38
|
+
x86_64-darwin-20
|
38
39
|
|
39
40
|
DEPENDENCIES
|
40
41
|
address_composer!
|
41
|
-
bundler (~>
|
42
|
-
pry (~> 0.
|
43
|
-
pry-byebug (~> 3.
|
42
|
+
bundler (~> 2.2)
|
43
|
+
pry (~> 0.14)
|
44
|
+
pry-byebug (~> 3.8)
|
44
45
|
rake (~> 13.0)
|
45
|
-
rspec (~> 3.
|
46
|
+
rspec (~> 3.10)
|
46
47
|
|
47
48
|
BUNDLED WITH
|
48
|
-
|
49
|
+
2.2.22
|
@@ -6,7 +6,7 @@ This project contains templates and test cases for address formats used in terri
|
|
6
6
|
|
7
7
|
### Build Status
|
8
8
|
|
9
|
-
[![Build Status](https://travis-ci.
|
9
|
+
[![Build Status](https://travis-ci.com/OpenCageData/address-formatting.svg?branch=master)](https://travis-ci.com/OpenCageData/address-formatting)
|
10
10
|
[![Twitter Follow](https://img.shields.io/twitter/follow/OpenCage?label=Follow%20OpenCage&style=social)](https://twitter.com/opencage)
|
11
11
|
|
12
12
|
### An example:
|
@@ -52,7 +52,7 @@ Unlike [physical post (office) mail](http://www.bitboost.com/ref/international-a
|
|
52
52
|
Our goal with this repository is a series of (programming) language independent templates. Those templates can then be processed by whatever software you like.
|
53
53
|
|
54
54
|
There are open-source implementations in
|
55
|
-
|
55
|
+
* [Elixir](https://github.com/dkuku/ex_address_formatting)
|
56
56
|
* [Java](https://github.com/placemarkt/address-formatter-java)
|
57
57
|
* [Javascript](https://github.com/fragaria/address-formatter)
|
58
58
|
* [Perl](https://metacpan.org/release/Geo-Address-Formatter)
|
@@ -31,7 +31,8 @@ generic4: &generic4 |
|
|
31
31
|
{{{attention}}}
|
32
32
|
{{{house}}}
|
33
33
|
{{{house_number}}} {{{road}}}
|
34
|
-
{{#first}} {{{
|
34
|
+
{{#first}} {{{village}}} || {{{hamlet}}} {{/first}}
|
35
|
+
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} || {{{suburb}}} || {{{municipality}}} || {{{county}}} {{/first}}, {{#first}} {{{state_code}}} || {{{state}}} {{/first}} {{{postcode}}}
|
35
36
|
{{{country}}}
|
36
37
|
|
37
38
|
# no postcode
|
@@ -588,7 +589,10 @@ CO:
|
|
588
589
|
{{{postcode}}} {{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} || {{{village}}} || {{{hamlet}}} {{/first}}, {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
|
589
590
|
{{{country}}}
|
590
591
|
postformat_replace:
|
592
|
+
- ["Localidad "," "]
|
591
593
|
- ["Bogota, Bogota","Bogota"]
|
594
|
+
- ["Bogota, Bogotá Distrito Capital","Bogota"]
|
595
|
+
- ["Bogotá, Bogotá Distrito Capital","Bogotá"]
|
592
596
|
|
593
597
|
# Costa Rica
|
594
598
|
CR:
|
@@ -1697,7 +1701,12 @@ SE:
|
|
1697
1701
|
|
1698
1702
|
# Singapore
|
1699
1703
|
SG:
|
1700
|
-
address_template:
|
1704
|
+
address_template: |
|
1705
|
+
{{{attention}}}
|
1706
|
+
{{#first}} {{{house}}}, {{{quarter}}} || {{{house}}} {{/first}}
|
1707
|
+
{{{house_number}}} {{{road}}}, {{{residential}}}
|
1708
|
+
{{#first}} {{{village}}} || {{{town}}} || {{{city}}} || {{{municipality}}} || {{{hamlet}}} || {{{country}}} || {{{county}}} {{/first}} {{{postcode}}}
|
1709
|
+
{{#first}} {{{country}}} || {{{state}}} {{/first}}
|
1701
1710
|
|
1702
1711
|
# Saint Helena, Ascension and Tristan da Cunha - same as UK
|
1703
1712
|
SH:
|
@@ -7,15 +7,14 @@ components:
|
|
7
7
|
building: Executive Office Building (American Samoa Government)
|
8
8
|
country: American Samoa
|
9
9
|
country_code: as
|
10
|
-
county:
|
10
|
+
county: Eastern District
|
11
|
+
municipality: Maʻopūtasi County
|
11
12
|
postcode: 96799
|
12
|
-
road: Route
|
13
|
-
village:
|
13
|
+
road: Route 118
|
14
|
+
village: Utulei
|
14
15
|
expected: |
|
15
16
|
Executive Office Building (American Samoa Government)
|
16
|
-
Route
|
17
|
-
|
17
|
+
Route 118
|
18
|
+
Utulei
|
19
|
+
Maʻopūtasi County, AS 96799
|
18
20
|
United States of America
|
19
|
-
|
20
|
-
|
21
|
-
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# Guam, unincorporated territory of the US
|
2
2
|
---
|
3
|
-
description: House in Tamuning
|
3
|
+
description: House in Tamuning, 13.50294,144.77693
|
4
4
|
components:
|
5
5
|
country: Guam
|
6
6
|
country_code: gu
|
7
7
|
county: Guam
|
8
8
|
house_number: 258
|
9
|
-
locality: Tamuning
|
10
9
|
postcode: 96913
|
11
10
|
road: Father San Vitores Street
|
12
11
|
state: Guam
|
12
|
+
town: Tamuning
|
13
13
|
expected: |
|
14
14
|
258 Father San Vitores Street
|
15
15
|
Tamuning, GU 96913
|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
description:
|
2
|
+
description: SG no postcode
|
3
3
|
components:
|
4
4
|
country: Singapore
|
5
5
|
country_code: SG
|
@@ -24,3 +24,20 @@ expected: |
|
|
24
24
|
16 Sandilands Road
|
25
25
|
Singapore 546080
|
26
26
|
Singapore
|
27
|
+
---
|
28
|
+
description: no city, 1.30585,103.78158
|
29
|
+
components:
|
30
|
+
country: Singapore
|
31
|
+
country_code: sg
|
32
|
+
county: Southwest
|
33
|
+
house_number: 26
|
34
|
+
postcode: 130026
|
35
|
+
residential: Dover Gardens
|
36
|
+
road: Dover Crescent
|
37
|
+
suburb: Queenstown
|
38
|
+
expected: |
|
39
|
+
26 Dover Crescent, Dover Gardens
|
40
|
+
Singapore 130026
|
41
|
+
Singapore
|
42
|
+
|
43
|
+
|
@@ -219,3 +219,34 @@ expected: |
|
|
219
219
|
Burt
|
220
220
|
Taymouth Township, Michigan
|
221
221
|
United States of America
|
222
|
+
#
|
223
|
+
# village
|
224
|
+
---
|
225
|
+
description: village
|
226
|
+
components:
|
227
|
+
country: United States of America
|
228
|
+
country_code: us
|
229
|
+
county: Costilla County
|
230
|
+
postcode: "08113"
|
231
|
+
state: Colorado
|
232
|
+
village: Fort Garland
|
233
|
+
expected: |
|
234
|
+
Fort Garland
|
235
|
+
Costilla County, CO 08113
|
236
|
+
United States of America
|
237
|
+
#
|
238
|
+
# hamlet
|
239
|
+
---
|
240
|
+
description: hamlet
|
241
|
+
components:
|
242
|
+
city: Homestead
|
243
|
+
country: United States of America
|
244
|
+
country_code: us
|
245
|
+
county: Miami-Dade County
|
246
|
+
hamlet: Homestead Trailer Park
|
247
|
+
postcode: 33030
|
248
|
+
state: Florida
|
249
|
+
expected: |
|
250
|
+
Homestead Trailer Park
|
251
|
+
Homestead, FL 33030
|
252
|
+
United States of America
|
data/address_composer.gemspec
CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |gem|
|
|
28
28
|
|
29
29
|
gem.add_runtime_dependency "mustache", "~> 1.1"
|
30
30
|
|
31
|
-
gem.add_development_dependency "bundler", "~>
|
32
|
-
gem.add_development_dependency "pry", "~> 0.
|
33
|
-
gem.add_development_dependency "pry-byebug", "~> 3.
|
31
|
+
gem.add_development_dependency "bundler", "~> 2.2"
|
32
|
+
gem.add_development_dependency "pry", "~> 0.14"
|
33
|
+
gem.add_development_dependency "pry-byebug", "~> 3.8"
|
34
34
|
gem.add_development_dependency "rake", "~> 13.0"
|
35
|
-
gem.add_development_dependency "rspec", "~> 3.
|
35
|
+
gem.add_development_dependency "rspec", "~> 3.10"
|
36
36
|
end
|
data/lib/address_composer.rb
CHANGED
@@ -25,12 +25,12 @@ class AddressComposer
|
|
25
25
|
attr_accessor :components
|
26
26
|
|
27
27
|
def initialize(components)
|
28
|
-
self.components = components
|
29
|
-
end
|
28
|
+
self.components = components.dup
|
30
29
|
|
31
|
-
def compose
|
32
30
|
normalize_components
|
31
|
+
end
|
33
32
|
|
33
|
+
def compose
|
34
34
|
if components["country_code"]
|
35
35
|
result = Template.render(template, components).squeeze("\n").lstrip.gsub(/\s*\n\s*/, "\n")
|
36
36
|
result = post_format_replace(result)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: address_composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Arrufat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mustache
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry-byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.10'
|
97
97
|
description: Address Composer formats address components using worldwide regions formatting
|
98
98
|
templates
|
99
99
|
email:
|
@@ -424,11 +424,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
424
424
|
version: '2.4'
|
425
425
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
426
426
|
requirements:
|
427
|
-
- - "
|
427
|
+
- - ">="
|
428
428
|
- !ruby/object:Gem::Version
|
429
|
-
version:
|
429
|
+
version: '0'
|
430
430
|
requirements: []
|
431
|
-
rubygems_version: 3.
|
431
|
+
rubygems_version: 3.2.22
|
432
432
|
signing_key:
|
433
433
|
specification_version: 4
|
434
434
|
summary: Universal international address composer in Ruby
|