postal_address 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/address_formats.yml +42 -40
- data/lib/postal_address/address.rb +1 -1
- data/lib/postal_address/formatters/html.rb +1 -1
- data/lib/postal_address/formatters/text.rb +6 -2
- data/lib/postal_address/version.rb +2 -2
- data/postal_address.gemspec +1 -1
- data/spec/postal_address_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 422cdf82f6d4e54433fab6605774d91be87b3b4c
|
4
|
+
data.tar.gz: c42be9ee3b3922263c53a1d8a15fed692578bd74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29a813c8fd37b87a96782874d2a199e6ba75f6166d2d6a33bda8c5835f9d48d3d061bc1606bb94c98f8b51ebd2bca728c4d0f2c6ee0d2d9b74e03f8beee979e3
|
7
|
+
data.tar.gz: cda37c73bf10d4813414e12bc180ab8926c39eb916ad8eaf01f9ba6955f32679fe1007725ed57fec99bbd619f7dfea6180418f63f0ad4a45f5ce27e929a3f1b4
|
data/data/address_formats.yml
CHANGED
@@ -1,69 +1,71 @@
|
|
1
1
|
# http://www.addressdoctor.com/en/countries-data/address-formats.html
|
2
2
|
|
3
|
-
|
4
3
|
---
|
5
|
-
|
4
|
+
de: &default "%{recipient}\n%{street}\n%{zip} %{city}\n%{country}"
|
5
|
+
us: &default_with_state "%{recipient}\n%{street}\n%{city} %{state} %{zip}\n%{country}"
|
6
|
+
|
7
|
+
ae: *default
|
6
8
|
ar: "%{recipient}\n%{street}\n%{zip} %{city}\n%{state}\n%{country}"
|
7
|
-
at:
|
8
|
-
au:
|
9
|
-
ba:
|
10
|
-
be:
|
11
|
-
bg:
|
12
|
-
bh:
|
9
|
+
at: *default
|
10
|
+
au: *default_with_state
|
11
|
+
ba: *default
|
12
|
+
be: *default
|
13
|
+
bg: *default
|
14
|
+
bh: *default
|
13
15
|
br: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
14
|
-
ca:
|
15
|
-
ch:
|
16
|
+
ca: *default_with_state
|
17
|
+
ch: *default
|
16
18
|
cn: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
17
|
-
cz:
|
18
|
-
de:
|
19
|
+
cz: *default
|
20
|
+
#de: *default
|
19
21
|
dk: "%{recipient}\n%{street}\n%{zip} %{city}\n%{state}\n%{country}"
|
20
|
-
eg:
|
22
|
+
eg: *default
|
21
23
|
es: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
22
|
-
fi:
|
23
|
-
fr:
|
24
|
+
fi: *default
|
25
|
+
fr: *default
|
24
26
|
gb: "%{recipient}\n%{street}\n%{city}\n%{state}\n%{zip}\n%{country}"
|
25
|
-
gl:
|
26
|
-
gr:
|
27
|
+
gl: *default
|
28
|
+
gr: *default
|
27
29
|
hk: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
28
|
-
hr:
|
30
|
+
hr: *default
|
29
31
|
hu: "%{recipient}\n%{city}\n%{street}\n%{zip}\n%{country}"
|
30
32
|
id: "%{recipient}\n%{street}\n%{city}\n%{state} %{zip}\n%{country}"
|
31
|
-
ie:
|
32
|
-
il:
|
33
|
+
ie: *default_with_state
|
34
|
+
il: *default
|
33
35
|
in: "%{recipient}\n%{street}\n%{state}\n%{city} %{zip}\n%{country}"
|
34
|
-
is:
|
36
|
+
is: *default
|
35
37
|
it: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
36
|
-
jo:
|
38
|
+
jo: *default
|
37
39
|
jp: "〒%{zip}\n%{state}%{city}%{street}\n%{recipient}\n%{country}"
|
38
40
|
kr: "%{recipient}\n%{street}\n%{city} %{state}\n%{zip}\n%{country}"
|
39
41
|
kw: "%{recipient}\n%{street}\n%{zip} %{city}\n%{state}\n%{country}"
|
40
|
-
lb:
|
41
|
-
li:
|
42
|
-
lu:
|
42
|
+
lb: *default
|
43
|
+
li: *default
|
44
|
+
lu: *default
|
43
45
|
mk: "%{recipient}\n%{street}\n%{city} %{zip}\n%{country}"
|
44
46
|
mx: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
45
|
-
nc:
|
46
|
-
nl:
|
47
|
-
"no":
|
47
|
+
nc: *default
|
48
|
+
nl: *default
|
49
|
+
"no": *default
|
48
50
|
nz: "%{recipient}\n%{street}\n%{state}\n%{city} %{zip}\n%{country}"
|
49
51
|
om: "%{recipient}\n%{street}\n%{zip} %{city}\n%{state}\n%{country}"
|
50
52
|
ph: "%{recipient}\n%{street} %{state}\n%{zip} %{city}\n%{country}"
|
51
53
|
pl: "%{recipient}\n%{street}\n%{zip} %{city}\n%{state}\n%{country}"
|
52
54
|
pt: "%{recipient}\n%{street}\n%{zip} %{city} %{state}\n%{country}"
|
53
|
-
qa:
|
54
|
-
ro:
|
55
|
+
qa: *default
|
56
|
+
ro: *default
|
55
57
|
ru: "%{recipient}\n%{zip} %{city}\n%{street}\n%{country}"
|
56
|
-
sa:
|
57
|
-
se:
|
58
|
+
sa: *default
|
59
|
+
se: *default
|
58
60
|
sg: "%{recipient}\n%{street}\n%{city} %{zip}\n%{country}"
|
59
|
-
si:
|
60
|
-
sk:
|
61
|
-
sy:
|
62
|
-
th:
|
63
|
-
tr:
|
64
|
-
tw:
|
61
|
+
si: *default
|
62
|
+
sk: *default
|
63
|
+
sy: *default
|
64
|
+
th: *default_with_state
|
65
|
+
tr: *default
|
66
|
+
tw: *default_with_state
|
65
67
|
ua: "%{recipient}\n%{street}\n%{city} %{state}\n%{zip}\n%{country}"
|
66
|
-
us:
|
67
|
-
ye:
|
68
|
+
#us: *default_with_state
|
69
|
+
ye: *default
|
68
70
|
yu: "%{recipient}\n%{street}\n%{zip} %{city}\n\n%{state}\n%{country}"
|
69
71
|
za: "%{recipient}\n%{street}\n%{city}\n%{state}\n%{zip}\n%{country}"
|
@@ -13,12 +13,16 @@ module Postal
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def address_data
|
16
|
-
@address[:country] = nil if Postal.home_country?
|
16
|
+
@address[:country] = nil if Postal.home_country? @address[:country_code]
|
17
17
|
@address
|
18
18
|
end
|
19
19
|
|
20
20
|
def address_format
|
21
|
-
Postal.address_formats[@address[:country_code]] ||
|
21
|
+
Postal.address_formats[@address[:country_code]] || default_address_format
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_address_format
|
25
|
+
Postal.address_formats[@address[:state] ? 'us' : 'de']
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.1.
|
1
|
+
module Postal
|
2
|
+
VERSION = "0.1.2"
|
3
3
|
end
|
data/postal_address.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'postal_address/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "postal_address"
|
8
|
-
spec.version =
|
8
|
+
spec.version = Postal::VERSION
|
9
9
|
spec.authors = ["Kevin Melchert"]
|
10
10
|
spec.email = ["kevin.melchert@gmail.com"]
|
11
11
|
spec.description = %q{International postal address formatting}
|
data/spec/postal_address_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postal_address
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Melchert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|