europe 0.0.25 → 0.0.26
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/CHANGELOG.md +3 -0
- data/lib/europe/vat/format.rb +5 -9
- data/lib/europe/version.rb +1 -1
- data/test/europe/vat/format_test.rb +4 -0
- data/test/europe/vat/validation_test.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6e189312895736dcfbb848edb51298272702f0a051133ce1fa10ff0ca332e9
|
4
|
+
data.tar.gz: 772a816ac59d52a91428f94f998be5f42624a02c25698afea20c27789cb48071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d5827fce7a70c52def8b0869bca24fa7688363925ebc3e5c74f52f2f15a7b1d51277515f8a95418cb31ea1efdfc9b3357f5d00c7580a5a54a6920e22d83c815
|
7
|
+
data.tar.gz: 7a5f8f4f1a5dac64cf8c449ab06a20751c73c8b86a0aa7b7eecc2f452b797435de303016886bc87bac6a8add7b5917e08da6441ded34a859ac90f6e897117d31
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
## 0.0.26
|
5
|
+
- Removed spaces by default for VAT number format validations, as per request from tim-vandecasteele
|
6
|
+
- [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.25...v0.0.26)
|
4
7
|
## 0.0.25
|
5
8
|
- A fix for Ireland's VAT numbers, https://github.com/gem-shards/europe.rb/pull/5, thank you again tim-vandecasteele
|
6
9
|
- [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.24...v0.0.25)
|
data/lib/europe/vat/format.rb
CHANGED
@@ -13,12 +13,12 @@ module Europe
|
|
13
13
|
CY: /^CY\d{8}[A-Z]$/,
|
14
14
|
CZ: /^CZ(\d{8}|\d{9}|\d{10})$/,
|
15
15
|
DE: /^DE\d{9}$/,
|
16
|
-
DK: /^DK\d{2}
|
16
|
+
DK: /^DK\d{2}\d{2}\d{2}\d{2}$/,
|
17
17
|
EE: /^EE\d{9}$/,
|
18
18
|
EL: /^EL\d{9}$/,
|
19
19
|
ES: /^ES([A-Z0-9]\d{7}[A-Z0-9])$/,
|
20
20
|
FI: /^FI\d{8}$/,
|
21
|
-
FR: /^FR[A-Z0-9][A-Z0-9]
|
21
|
+
FR: /^FR[A-Z0-9][A-Z0-9]\d{9}$/,
|
22
22
|
HR: /^HR\d{11}$/,
|
23
23
|
HU: /^HU\d{8}$/,
|
24
24
|
IE: /^IE(\d[A-Z]\d{5}[A-Z]|\d{7}[A-Z]{2})$/,
|
@@ -38,18 +38,14 @@ module Europe
|
|
38
38
|
|
39
39
|
def self.validate(number)
|
40
40
|
country_code = number[0..1].to_sym
|
41
|
-
number = sanitize_number(number
|
41
|
+
number = sanitize_number(number)
|
42
42
|
return false unless VAT_REGEX.key?(country_code)
|
43
43
|
|
44
44
|
match_vat_number(number, country_code)
|
45
45
|
end
|
46
46
|
|
47
|
-
def self.sanitize_number(number
|
48
|
-
|
49
|
-
number.gsub(/\.|\t/, '').upcase
|
50
|
-
else
|
51
|
-
number.gsub(/\.|\t|\s/, '').upcase
|
52
|
-
end
|
47
|
+
def self.sanitize_number(number)
|
48
|
+
number.gsub(/\.|\t|\s/, '').upcase
|
53
49
|
end
|
54
50
|
|
55
51
|
def self.match_vat_number(number, country_code)
|
data/lib/europe/version.rb
CHANGED
@@ -21,6 +21,10 @@ module Europe
|
|
21
21
|
assert_equal false, validate_false_vat[:valid]
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_validation_of_vat_number_with_spaces
|
25
|
+
assert Europe::Vat.validate('DK 474 587 14')
|
26
|
+
end
|
27
|
+
|
24
28
|
def test_validation_of_correct_vat_number
|
25
29
|
# PostNL
|
26
30
|
validate_correct_vat = Europe::Vat.validate('NL009291477B01')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: europe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gem shards
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|