postcode_validator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/.travis.yml +3 -3
- data/Gemfile.lock +46 -39
- data/lib/active_model/validations/postcode_validator.rb +1 -1
- data/lib/postcode_validator.rb +2 -1
- data/lib/postcode_validator/version.rb +1 -1
- data/postcode_validator.gemspec +7 -4
- metadata +17 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6eed35124d1bb71fece149bd9c1b903f41c9c4140ab6ca2e759693b0891ea3c3
|
4
|
+
data.tar.gz: 0f77faff57440f00f32e56a12e855d4543446d1e98271c98c1cf66a1672c396e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1472669261e5ce6c5480908837dd261db54eed354fb006c9c68d204a1370362a7505185c6a5a835a0e18e244519af7c94684e17cf0a57da315abd4c7b31c6870
|
7
|
+
data.tar.gz: 8f78d3146cf363df72228528a075dfc21c24479353e2fb5b2756a5e0d99c2358eb46d381b10d45e0a3bdb74f0965109d677a8202caf99dcca958fca81869ef5b
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,62 +1,69 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
postcode_validator (1.0.
|
5
|
-
twitter_cldr (
|
4
|
+
postcode_validator (1.0.1)
|
5
|
+
twitter_cldr (> 4.4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activesupport (
|
10
|
+
activemodel (6.0.3.4)
|
11
|
+
activesupport (= 6.0.3.4)
|
12
|
+
activesupport (6.0.3.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (
|
14
|
+
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
-
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
+
ast (2.4.1)
|
18
19
|
camertron-eprun (1.1.1)
|
19
20
|
cldr-plurals-runtime-rb (1.0.1)
|
20
|
-
concurrent-ruby (1.
|
21
|
-
diff-lcs (1.
|
22
|
-
i18n (
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
diff-lcs (1.4.4)
|
23
|
+
i18n (1.8.5)
|
23
24
|
concurrent-ruby (~> 1.0)
|
24
|
-
minitest (5.
|
25
|
-
parallel (1.
|
26
|
-
parser (2.
|
27
|
-
ast (~> 2.4.
|
28
|
-
powerpack (0.1.1)
|
25
|
+
minitest (5.14.2)
|
26
|
+
parallel (1.19.2)
|
27
|
+
parser (2.7.2.0)
|
28
|
+
ast (~> 2.4.1)
|
29
29
|
rainbow (3.0.0)
|
30
|
-
rake (
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rspec-
|
35
|
-
|
36
|
-
rspec-
|
37
|
-
rspec-
|
30
|
+
rake (13.0.1)
|
31
|
+
regexp_parser (1.8.2)
|
32
|
+
rexml (3.2.4)
|
33
|
+
rspec (3.10.0)
|
34
|
+
rspec-core (~> 3.10.0)
|
35
|
+
rspec-expectations (~> 3.10.0)
|
36
|
+
rspec-mocks (~> 3.10.0)
|
37
|
+
rspec-core (3.10.0)
|
38
|
+
rspec-support (~> 3.10.0)
|
39
|
+
rspec-expectations (3.10.0)
|
38
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-mocks (3.
|
41
|
+
rspec-support (~> 3.10.0)
|
42
|
+
rspec-mocks (3.10.0)
|
41
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-support (3.
|
44
|
-
rubocop (
|
44
|
+
rspec-support (~> 3.10.0)
|
45
|
+
rspec-support (3.10.0)
|
46
|
+
rubocop (1.1.0)
|
45
47
|
parallel (~> 1.10)
|
46
|
-
parser (>= 2.5)
|
47
|
-
powerpack (~> 0.1)
|
48
|
+
parser (>= 2.7.1.5)
|
48
49
|
rainbow (>= 2.2.2, < 4.0)
|
50
|
+
regexp_parser (>= 1.8)
|
51
|
+
rexml
|
52
|
+
rubocop-ast (>= 1.0.1)
|
49
53
|
ruby-progressbar (~> 1.7)
|
50
|
-
unicode-display_width (
|
51
|
-
|
54
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
55
|
+
rubocop-ast (1.1.0)
|
56
|
+
parser (>= 2.7.1.5)
|
57
|
+
ruby-progressbar (1.10.1)
|
52
58
|
thread_safe (0.3.6)
|
53
|
-
twitter_cldr (
|
59
|
+
twitter_cldr (6.3.0)
|
54
60
|
camertron-eprun
|
55
61
|
cldr-plurals-runtime-rb (~> 1.0)
|
56
62
|
tzinfo
|
57
|
-
tzinfo (1.2.
|
63
|
+
tzinfo (1.2.7)
|
58
64
|
thread_safe (~> 0.1)
|
59
|
-
unicode-display_width (1.
|
65
|
+
unicode-display_width (1.7.0)
|
66
|
+
zeitwerk (2.4.1)
|
60
67
|
|
61
68
|
PLATFORMS
|
62
69
|
ruby
|
@@ -64,11 +71,11 @@ PLATFORMS
|
|
64
71
|
DEPENDENCIES
|
65
72
|
activemodel (> 3.2.0)
|
66
73
|
activesupport (> 3.2.0)
|
67
|
-
bundler (~> 1
|
74
|
+
bundler (~> 2.1)
|
68
75
|
postcode_validator!
|
69
|
-
rake (~>
|
70
|
-
rspec (~> 3.
|
76
|
+
rake (~> 13.0)
|
77
|
+
rspec (~> 3.10.0)
|
71
78
|
rubocop
|
72
79
|
|
73
80
|
BUNDLED WITH
|
74
|
-
1.
|
81
|
+
2.1.4
|
@@ -8,7 +8,7 @@ module ActiveModel
|
|
8
8
|
def validate_each(record, attribute, value)
|
9
9
|
country = option_call(record, :country)
|
10
10
|
record.errors.add(attribute, :invalid_postcode) unless validator.valid?(value, country: country)
|
11
|
-
rescue ::PostcodeValidator::Error
|
11
|
+
rescue ::PostcodeValidator::Error
|
12
12
|
# When :country is not a valid country, just skip postcode validation
|
13
13
|
# :country validation is developer's responsability
|
14
14
|
end
|
data/lib/postcode_validator.rb
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
ActiveSupport.on_load(:i18n) do
|
12
12
|
I18n.load_path += Dir[File.expand_path(File.join(__dir__, '..', 'locales', '*.yml')).to_s]
|
13
13
|
end
|
14
|
-
rescue LoadError # rubocop:disable Lint/
|
14
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
15
15
|
end
|
16
16
|
|
17
17
|
# A simple postcode validator
|
@@ -33,6 +33,7 @@ class PostcodeValidator
|
|
33
33
|
|
34
34
|
def country_as_iso(options)
|
35
35
|
raise Error, 'Missing :country option' unless options.key?(:country) && !options[:country].nil?
|
36
|
+
|
36
37
|
iso = TwitterCldr::Shared::Territories.normalize_territory_code(options[:country])
|
37
38
|
|
38
39
|
# raise ArgumentError if :iso is not a valid territory code
|
data/postcode_validator.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = 'https://github.com/notus-sh/postcode_validator'
|
17
17
|
|
18
18
|
raise 'RubyGems 2.0 or newer is required.' unless spec.respond_to?(:metadata)
|
19
|
+
|
19
20
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
21
|
|
21
22
|
spec.require_paths = ['lib']
|
@@ -23,15 +24,17 @@ Gem::Specification.new do |spec|
|
|
23
24
|
f.match(%r{^(test|spec|features)/})
|
24
25
|
end
|
25
26
|
|
26
|
-
spec.
|
27
|
+
spec.required_ruby_version = '>= 2.5'
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'twitter_cldr', '> 4.4.0'
|
27
30
|
|
28
31
|
# Optional dependencies, used in tests
|
29
32
|
spec.add_development_dependency 'activemodel', '> 3.2.0'
|
30
33
|
spec.add_development_dependency 'activesupport', '> 3.2.0'
|
31
34
|
|
32
35
|
# Development tools
|
33
|
-
spec.add_development_dependency 'bundler', '~> 1
|
34
|
-
spec.add_development_dependency 'rake', '~>
|
35
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
36
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
37
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
36
39
|
spec.add_development_dependency 'rubocop'
|
37
40
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postcode_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gaël-Ian Havard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter_cldr
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.4.
|
19
|
+
version: 4.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.4.
|
26
|
+
version: 4.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,42 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
61
|
+
version: '2.1'
|
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: '1
|
68
|
+
version: '2.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
89
|
+
version: 3.10.0
|
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.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,7 +135,7 @@ licenses:
|
|
135
135
|
- Apache-2.0
|
136
136
|
metadata:
|
137
137
|
allowed_push_host: https://rubygems.org
|
138
|
-
post_install_message:
|
138
|
+
post_install_message:
|
139
139
|
rdoc_options: []
|
140
140
|
require_paths:
|
141
141
|
- lib
|
@@ -143,16 +143,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: '
|
146
|
+
version: '2.5'
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
|
154
|
-
|
155
|
-
signing_key:
|
153
|
+
rubygems_version: 3.1.2
|
154
|
+
signing_key:
|
156
155
|
specification_version: 4
|
157
156
|
summary: A simple postcode validator for Rails.
|
158
157
|
test_files: []
|