validate_zipcode 1.2.0 → 1.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13cbd851f081d14f9fb4ced90abb90bfa56b2eef
4
- data.tar.gz: 24e53119158d5e4bfae5c87250f490668c326149
3
+ metadata.gz: 3c94cda9adfbe24fc0c216fc68cc852f2b6be877
4
+ data.tar.gz: 1d5ebbcf5270f22a190749a578154b4f4e37ac19
5
5
  SHA512:
6
- metadata.gz: 56e3ba8ac95c55dd27e1032583f4de37a2f6f32d4d670fc3f908e6748d8ef02a778bbd55adc456dc927c4815474afcf23dabf4eb6448d9e997ff3a3fb09fc33e
7
- data.tar.gz: 7cab0a790ac834e11e007a12f5e84983800ecd68840d46cd12101c40b913d41cf99f22068ba7492599c68657cce8b8aef6c492d94f5bf3e27fa28564aac9d6be
6
+ metadata.gz: 0650a7cc18aa9553eb982eac436fe63e7e1808f839e9af2c795c4a4f30a1fea8a6e87fb0266f3d1867eaa95ff808e953667be0e90553ef1514424f547e52489f
7
+ data.tar.gz: ab9c60ef8282c11242984751702c760459ccb2b3d64c7ee68f078dcca156aa8471b18ca734a9085f45d298d2691d44df5c9d3752c53a0c8f68134a7462ac7b51
data/.gitignore CHANGED
@@ -7,3 +7,22 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
11
+ *.rbc
12
+ .bundle
13
+ .config
14
+ .yardoc
15
+ .coveralls.yml
16
+ *.swp
17
+ Gemfile.lock
18
+ InstalledFiles
19
+ _yardoc
20
+ coverage
21
+ doc/
22
+ lib/bundler/man
23
+ pkg
24
+ rdoc
25
+ spec/reports
26
+ tmp
27
+ .*~
28
+ *~
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
4
- before_install: gem install bundler -v 1.11.2
3
+ - 2.2.3
4
+ - 2.3.1
5
+
6
+ before_install:
7
+ - gem update bundler
data/LIST.md CHANGED
@@ -2,25 +2,37 @@
2
2
 
3
3
  | Country | Identification | Format | Link |
4
4
  |:-------:|:------------:|:-----------:|:-----------:|
5
+ | Afghanistan | AF | 1001 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/afgEn.pdf) |
6
+ | Albania | AL | 1001 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/albEn.pdf) |
5
7
  | Algeria | DZ | 16027 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/dzaEn.pdf) |
6
8
  | Australia | AU | 3171 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/ausEn.pdf) |
7
9
  | Austria | AT | 1220 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/autEn.pdf) |
10
+ | Bangladesh | BD | 1340 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/bgdEn.pdf) |
11
+ | Belarus | BY | 220050 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/blrEn.pdf) |
12
+ | Belgium | BE | 2610 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/belEn.pdf) |
8
13
  | Bolivia | BO | 1716 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/bolEn.pdf) |
9
14
  | Brazil | BR | 35001-345 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/braEn.pdf) |
10
15
  | Bulgaria | BG | 4000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/bgrEn.pdf) |
16
+ | Cabo Verde | CV | 7600 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/cpvEn.pdf) |
11
17
  | Canada | CA | H3Z 2Y7 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/canEn.pdf) |
12
18
  | Chile | CL | 872-0019 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/chlEn.pdf) |
13
19
  | China | CN | 200082 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/chnEn.pdf) |
14
20
  | Colombia | CO | 110221 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/colEn.pdf) |
21
+ | Costa Rica | CR | 40501 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/criEn.pdf) |
15
22
  | Croatia | HR | 1000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/hrvEn.pdf) |
16
23
  | Cuba | CU | 10600 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/cubEn.pdf) |
24
+ | Cyprus | CY | 2008 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/cypEn.pdf) |
17
25
  | Denmark | DK | 8660 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/dnkEn.pdf) |
18
26
  | Deutsch or Germany | DE | 81545 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/deuEn.pdf) |
19
27
  | Estonia | EE | 69501 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/estEn.pdf) |
20
28
  | Ethiopia | ET | 1000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/ethEn.pdf) |
21
29
  | Finland | FI | 50100 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/finEn.pdf) |
22
30
  | France | FR | 75007 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/fraEn.pdf) |
31
+ | Georgia | GE | 0100 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/geoEn.pdf) |
23
32
  | Greece | GR | 151 24 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/grcEn.pdf) |
33
+ | Guinea-Bissau | GW | 1000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/gnbEn.pdf) |
34
+ | Heard Island and McDonald Islands | HM | 3177 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/hmdEn.pdf) |
35
+ | Hungary | HU | 1037 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/hunEn.pdf) |
24
36
  | India | IN | 110034 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/indEn.pdf) |
25
37
  | Indonesia | ID | 40198 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/idnEn.pdf) |
26
38
  | Iraq | IQ | 61002 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/irqEn.pdf) |
@@ -28,10 +40,23 @@
28
40
  | Italy | IT | 20090 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/itaEn.pdf) |
29
41
  | Japan | JP | 208–0032 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/jpnEn.pdf) |
30
42
  | Kazakhstan | KZ | 040900 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/kazEn.pdf) |
43
+ | Kyrgyzstan | KG | 720001 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/kgzEn.pdf) |
44
+ | Liberia | LR | 1000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/lbrEn.pdf) |
45
+ | Liechtenstein | LI | 2544 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/lieEn.pdf) |
46
+ | Macedonia | MK | 1020 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mkdEn.pdf) |
47
+ | Marshall Islands | MH | 96970 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mhlEn.pdf) |
31
48
  | Mexico | MX | 02860 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mexEn.pdf) |
32
49
  | Monaco | MC | 98000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mcoEn.pdf) |
50
+ | Mongolia | MN | 15141 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mngEn.pdf) |
51
+ | Mozambique | MZ | 1100 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/mozEn.pdf) |
52
+ | Namibia | NA | 26890 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/namEn.pdf) |
53
+ | Nepal | NP | 44601 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/nplEn.pdf) |
54
+ | Niger | NE | 8001 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/nerEn.pdf) |
55
+ | New Zealand (including the Ross dependency) | NZ | 6011 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/nzlEn.pdf) |
56
+ | Norway | NO | 0025 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/norEn.pdf) |
33
57
  | Paraguay | PY | 1536 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/pryEn.pdf) |
34
58
  | Peru | PE | 15074 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/perEn.pdf) |
59
+ | Philippines | PH | 1008 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/phlEn.pdf) |
35
60
  | Portugal | PT | 2725-079 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/prtEn.pdf) |
36
61
  | Romania | RO | 060274 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/rouEn.pdf) |
37
62
  | Russian | RU | 125075 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/rusEn.pdf) |
@@ -42,8 +67,12 @@
42
67
  | South Africa | ZA | 0083 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/zafEn.pdf) |
43
68
  | Spain | ES | 28001 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/espEn.pdf) |
44
69
  | Sri Lanka | LK | 20000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/lkaEn.pdf) |
70
+ | Sudan | SD | 11111 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/sdnEn.pdf) |
71
+ | Svalbard and Jan Mayen Island | SJ | 0025 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/sjmEn.pdf) |
72
+ | Switzerland | CH | 2544 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/cheEn.pdf) |
45
73
  | Tajikistan | TJ | 735450 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/tjkEn.pdf) |
46
74
  | Thailand | TH | 10150 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/thaEn.pdf) |
75
+ | Trinidad and Tobago | TT | 500234 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/ttoEn.pdf) |
47
76
  | Tunisia | TN | 1002 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/tunEn.pdf) |
48
77
  | Turkey | TR | 06101 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/turEn.pdf) |
49
78
  | Turkmenistan | TM | 744000 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/tkmEn.pdf) |
@@ -51,4 +80,6 @@
51
80
  | United States | US | 90410 or 10118-0229 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/usaEn.pdf) |
52
81
  | Uzbekistan | UZ | 140101 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/uzbEn.pdf) |
53
82
  | Venezuela | VE | 1010 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/venEn.pdf) |
83
+ | Viet Nam | VN | 123456 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/vnmEn.pdf) |
84
+ | Virgin Islands of the United States of America | VI | 00801 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/virEn.pdf) |
54
85
  | Zambia | ZM | 50100 | [documentation](http://www.upu.int/fileadmin/documentsFiles/activities/addressingUnit/zmbEn.pdf) |
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ValidateZipcode
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/validate_zipcode.png)](http://badge.fury.io/rb/validate_zipcode)
4
+ [![Build Status](https://secure.travis-ci.org/RamonHossein/validate_zipcode.png?branch=master)](http://travis-ci.org/RamonHossein/validate_cpf)
5
+ [![Coverage Status](https://coveralls.io/repos/RamonHossein/validate_zipcode/badge.png?branch=master)](https://coveralls.io/r/RamonHossein/validate_zipcode)
6
+
3
7
  Adds ZipCode / PostalCode validation support to Rails (ActiveModel) and test it in a simple way.
4
8
 
5
9
  Any other country's postal code that not on the [list of country identification](https://github.com/RamonHossein/validate_zipcode/blob/master/LIST.md) will validate without errors.
@@ -1,5 +1,15 @@
1
1
  module ValidateZipcode
2
2
  module Regex
3
+ # Afghanistan
4
+ def self.AF(zipcode)
5
+ match = zipcode =~ /^([0-9]{4})$/
6
+ match == 0 ? true : false
7
+ end
8
+ # Albania
9
+ def self.AL(zipcode)
10
+ match = zipcode =~ /^([0-9]{4})$/
11
+ match == 0 ? true : false
12
+ end
3
13
  # Algeria
4
14
  def self.DZ(zipcode)
5
15
  match = zipcode =~ /^([0-9]{5})$/
@@ -15,6 +25,21 @@ module ValidateZipcode
15
25
  match = zipcode =~ /^([0-9]{4})$/
16
26
  match == 0 ? true : false
17
27
  end
28
+ # Bangladesh
29
+ def self.BD(zipcode)
30
+ match = zipcode =~ /^([0-9]{4})$/
31
+ match == 0 ? true : false
32
+ end
33
+ # Belarus
34
+ def self.BY(zipcode)
35
+ match = zipcode =~ /^([0-9]{6})$/
36
+ match == 0 ? true : false
37
+ end
38
+ # Belgium
39
+ def self.BE(zipcode)
40
+ match = zipcode =~ /^([0-9]{4})$/
41
+ match == 0 ? true : false
42
+ end
18
43
  # Bolivia
19
44
  def self.BO(zipcode)
20
45
  match = zipcode =~ /^([0-9]{4})$/
@@ -30,6 +55,11 @@ module ValidateZipcode
30
55
  match = zipcode =~ /^([0-9]{4})$/
31
56
  match == 0 ? true : false
32
57
  end
58
+ # Cabo Verde
59
+ def self.CV(zipcode)
60
+ match = zipcode =~ /^([0-9]{4})$/
61
+ match == 0 ? true : false
62
+ end
33
63
  # Canada
34
64
  def self.CA(zipcode)
35
65
  match = zipcode =~ /^([a-zA-Z][0-9][a-zA-Z][ ][0-9][a-zA-Z][0-9])$|([a-zA-Z][0-9][a-zA-Z][0-9][a-zA-Z][0-9])$|([a-zA-Z][0-9][a-zA-Z]-[0-9][a-zA-Z][0-9])/
@@ -50,6 +80,11 @@ module ValidateZipcode
50
80
  match = zipcode =~ /^([0-9]{6})$/
51
81
  match == 0 ? true : false
52
82
  end
83
+ # Costa Rica
84
+ def self.CR(zipcode)
85
+ match = zipcode =~ /^([0-9]{5})$/
86
+ match == 0 ? true : false
87
+ end
53
88
  # Croatia
54
89
  def self.HR(zipcode)
55
90
  match = zipcode =~ /^([0-9]{5})$/
@@ -60,6 +95,11 @@ module ValidateZipcode
60
95
  match = zipcode =~ /^([0-9]{5})$/
61
96
  match == 0 ? true : false
62
97
  end
98
+ # Cyprus
99
+ def self.CY(zipcode)
100
+ match = zipcode =~ /^([0-9]{4})$/
101
+ match == 0 ? true : false
102
+ end
63
103
  # Denmark
64
104
  def self.DK(zipcode)
65
105
  match = zipcode =~ /^([0-9]{4})$/
@@ -90,11 +130,31 @@ module ValidateZipcode
90
130
  match = zipcode =~ /^([0-9]{5})$/
91
131
  match == 0 ? true : false
92
132
  end
133
+ # Georgia
134
+ def self.GE(zipcode)
135
+ match = zipcode =~ /^([0-9]{4})$/
136
+ match == 0 ? true : false
137
+ end
93
138
  # Greece
94
139
  def self.GR(zipcode)
95
140
  match = zipcode =~ /^([0-9]{3}[ ][0-9]{2})$|([0-9]{5})$|([0-9]{3}-[0-9]{2})$/
96
141
  match == 0 ? true : false
97
142
  end
143
+ # Guinea-Bissau
144
+ def self.GW(zipcode)
145
+ match = zipcode =~ /^([0-9]{4})$/
146
+ match == 0 ? true : false
147
+ end
148
+ # Heard Island and McDonald Islands
149
+ def self.HM(zipcode)
150
+ match = zipcode =~ /^([0-9]{4})$/
151
+ match == 0 ? true : false
152
+ end
153
+ # Hungary
154
+ def self.HU(zipcode)
155
+ match = zipcode =~ /^([0-9]{4})$/
156
+ match == 0 ? true : false
157
+ end
98
158
  # India
99
159
  def self.IN(zipcode)
100
160
  match = zipcode =~ /^([0-9]{6})$/
@@ -130,6 +190,31 @@ module ValidateZipcode
130
190
  match = zipcode =~ /^([0-9]{6})$/
131
191
  match == 0 ? true : false
132
192
  end
193
+ # Kyrgyzstan
194
+ def self.KG(zipcode)
195
+ match = zipcode =~ /^([0-9]{6})$/
196
+ match == 0 ? true : false
197
+ end
198
+ # Liberia
199
+ def self.LR(zipcode)
200
+ match = zipcode =~ /^([0-9]{4})$/
201
+ match == 0 ? true : false
202
+ end
203
+ # Liechtenstein
204
+ def self.LI(zipcode)
205
+ match = zipcode =~ /^([0-9]{4})$/
206
+ match == 0 ? true : false
207
+ end
208
+ # Macedonia
209
+ def self.MK(zipcode)
210
+ match = zipcode =~ /^([0-9]{4})$/
211
+ match == 0 ? true : false
212
+ end
213
+ # Marshall Islands
214
+ def self.MH(zipcode)
215
+ match = zipcode =~ /^([0-9]{5})$/
216
+ match == 0 ? true : false
217
+ end
133
218
  # Mexico
134
219
  def self.MX(zipcode)
135
220
  match = zipcode =~ /^([0-9]{5})$/
@@ -140,6 +225,41 @@ module ValidateZipcode
140
225
  match = zipcode =~ /^([0-9]{5})$/
141
226
  match == 0 ? true : false
142
227
  end
228
+ # Mongolia
229
+ def self.MN(zipcode)
230
+ match = zipcode =~ /^([0-9]{5})$/
231
+ match == 0 ? true : false
232
+ end
233
+ # Mozambique
234
+ def self.MZ(zipcode)
235
+ match = zipcode =~ /^([0-9]{4})$/
236
+ match == 0 ? true : false
237
+ end
238
+ # Namibia
239
+ def self.NA(zipcode)
240
+ match = zipcode =~ /^([0-9]{5})$/
241
+ match == 0 ? true : false
242
+ end
243
+ # Nepal
244
+ def self.NP(zipcode)
245
+ match = zipcode =~ /^([0-9]{5})$/
246
+ match == 0 ? true : false
247
+ end
248
+ # Niger
249
+ def self.NE(zipcode)
250
+ match = zipcode =~ /^([0-9]{4})$/
251
+ match == 0 ? true : false
252
+ end
253
+ # New Zealand (including the Ross dependency)
254
+ def self.NZ(zipcode)
255
+ match = zipcode =~ /^([0-9]{4})$/
256
+ match == 0 ? true : false
257
+ end
258
+ # Norway
259
+ def self.NO(zipcode)
260
+ match = zipcode =~ /^([0-9]{4})$/
261
+ match == 0 ? true : false
262
+ end
143
263
  # Paraguay
144
264
  def self.PY(zipcode)
145
265
  match = zipcode =~ /^([0-9]{4})$/
@@ -150,6 +270,11 @@ module ValidateZipcode
150
270
  match = zipcode =~ /^([0-9]{5})$/
151
271
  match == 0 ? true : false
152
272
  end
273
+ # Philippines
274
+ def self.PH(zipcode)
275
+ match = zipcode =~ /^([0-9]{4})$/
276
+ match == 0 ? true : false
277
+ end
153
278
  # Portugal
154
279
  def self.PT(zipcode)
155
280
  match = zipcode =~ /^([0-9]{4}-[0-9]{3})$|([0-9]{7})$/
@@ -177,7 +302,7 @@ module ValidateZipcode
177
302
  end
178
303
  # Singapore
179
304
  def self.SG(zipcode)
180
- match = zipcode =~ /^([0-9]{5})$/
305
+ match = zipcode =~ /^([0-9]{6})$/
181
306
  match == 0 ? true : false
182
307
  end
183
308
  # Slovenia
@@ -200,6 +325,21 @@ module ValidateZipcode
200
325
  match = zipcode =~ /^([0-9]{5})$/
201
326
  match == 0 ? true : false
202
327
  end
328
+ # Sudan
329
+ def self.SD(zipcode)
330
+ match = zipcode =~ /^([0-9]{5})$/
331
+ match == 0 ? true : false
332
+ end
333
+ # Svalbard and Jan Mayen Island
334
+ def self.SJ(zipcode)
335
+ match = zipcode =~ /^([0-9]{4})$/
336
+ match == 0 ? true : false
337
+ end
338
+ # Switzerland
339
+ def self.CH(zipcode)
340
+ match = zipcode =~ /^([0-9]{4})$/
341
+ match == 0 ? true : false
342
+ end
203
343
  # Tajikistan
204
344
  def self.TJ(zipcode)
205
345
  match = zipcode =~ /^([0-9]{6})$/
@@ -210,6 +350,11 @@ module ValidateZipcode
210
350
  match = zipcode =~ /^([0-9]{5})$/
211
351
  match == 0 ? true : false
212
352
  end
353
+ # Trinidad and Tobago
354
+ def self.TT(zipcode)
355
+ match = zipcode =~ /^([0-9]{6})$/
356
+ match == 0 ? true : false
357
+ end
213
358
  # Tunisia
214
359
  def self.TN(zipcode)
215
360
  match = zipcode =~ /^([0-9]{4})$/
@@ -245,6 +390,16 @@ module ValidateZipcode
245
390
  match = zipcode =~ /^([0-9]{4})$/
246
391
  match == 0 ? true : false
247
392
  end
393
+ # Viet Nam
394
+ def self.VN(zipcode)
395
+ match = zipcode =~ /^([0-9]{6})$/
396
+ match == 0 ? true : false
397
+ end
398
+ # Virgin Islands of the United States of America
399
+ def self.VI(zipcode)
400
+ match = zipcode =~ /^([0-9]{5})$/
401
+ match == 0 ? true : false
402
+ end
248
403
  # Zambia
249
404
  def self.ZM(zipcode)
250
405
  match = zipcode =~ /^([0-9]{5})$/
@@ -1,3 +1,3 @@
1
1
  module ValidateZipcode
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["hosseinramon@gmail.com"]
11
11
 
12
12
  spec.summary = %q{ Zip code validation for Rails. }
13
- spec.description = %q{ Adds validation methods considering different country zip code formats. }
13
+ spec.description = %q{ Adds validation methods considering different country zip code formats. Currently, we can validate 81 countries. }
14
14
  spec.homepage = "https://github.com/RamonHossein/validate_zipcode"
15
15
  spec.license = "MIT"
16
16
 
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "shoulda", "~> 3.5"
26
+ spec.add_development_dependency 'coveralls'
26
27
 
27
28
  spec.add_dependency 'activemodel'
28
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate_zipcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - RamonHossein
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: activemodel
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +94,8 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
- description: " Adds validation methods considering different country zip code formats. "
97
+ description: " Adds validation methods considering different country zip code formats.
98
+ Currently, we can validate 81 countries. "
84
99
  email:
85
100
  - hosseinramon@gmail.com
86
101
  executables: []