validate_zipcode 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/validate_zipcode/regex.rb +5 -0
- data/lib/validate_zipcode/validator.rb +3 -3
- data/lib/validate_zipcode/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752ff8cc4665b24fef8bc2e4a8c72d3c14d2d55f
|
4
|
+
data.tar.gz: e104573885ae882fc26dd6bde82eadcf8a5e3cf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb002149675737d17d843e6a40d04744dde8581c97f7b2311efa3cd9ff6f33d5e102e1f65af848883cdd051cd304abcf6d4acb06118d88da6d3ca84e4fa05e68
|
7
|
+
data.tar.gz: 81562a58cd1287ff66bf14d765c448e6c31c27d80a0494d3f800307d4f2e4101ef928a15bf0765d8008bd0de7d11c55453ed2df6713403eacf62426cf4d9c5ed
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# ValidateZipcode
|
2
2
|
|
3
|
-
Adds
|
3
|
+
Adds ZipCode / PostalCode validation support to Rails (ActiveModel) and test it in a simple way.
|
4
4
|
|
5
|
-
Any other country's postal code that not
|
5
|
+
Any other country's postal code that not on the [list of country identification](https://github.com/RamonHossein/validate_zipcode#list-of-country-identification) will validate without errors.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
Just use as any other validator passing the country:
|
26
26
|
|
27
|
-
ValidateZipcode expects the model
|
27
|
+
ValidateZipcode expects the model has an attribute called country to contain the country identification.
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
class Address < ActiveRecord::Base
|
@@ -36,7 +36,8 @@ end
|
|
36
36
|
|
37
37
|
| Country | Identification | Format | Link |
|
38
38
|
|:-------:|:------------:|:-----------:|:-----------:|
|
39
|
-
| United States | US |
|
39
|
+
| United States | US | 90410 or 10118-0229 | no link yet |
|
40
|
+
| Brazil | BR | 35001-345 | no link yet |
|
40
41
|
|
41
42
|
## Error Message
|
42
43
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module ValidateZipcode
|
2
2
|
class Validator
|
3
3
|
def initialize(zipcode, locale)
|
4
|
-
|
4
|
+
@zipcode = zipcode
|
5
|
+
variables(locale) unless @zipcode.blank?
|
5
6
|
end
|
6
7
|
|
7
8
|
def valid?
|
@@ -10,8 +11,7 @@ module ValidateZipcode
|
|
10
11
|
end
|
11
12
|
|
12
13
|
private
|
13
|
-
def variables(
|
14
|
-
@zipcode = zipcode
|
14
|
+
def variables(locale)
|
15
15
|
@match = regex_zipcode(locale.upcase)
|
16
16
|
end
|
17
17
|
|
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.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RamonHossein
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,4 +128,3 @@ signing_key:
|
|
128
128
|
specification_version: 4
|
129
129
|
summary: Zip code validation for Rails.
|
130
130
|
test_files: []
|
131
|
-
has_rdoc:
|