eu-vat 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 80ae0833f2156deb178cbb4f76985c5a67cee98e2a5ac8c405858814f6747b0d
4
+ data.tar.gz: 61eb9b10bb6810ec38af67b0dc8191ccf7f27c5f2eb1a17c40a38b02f0f729b5
5
+ SHA512:
6
+ metadata.gz: 53ec5c52231e656ec2a1709ecb6a558c28814abae1fd6e520e3e405746c39f62c5fe2dec63cd3bd3f5aaf790cbaf8fe0059ce3a712f43e6dc00d8365c00e55eb
7
+ data.tar.gz: 979f8524527e889fc431b47209b4df7ed687690466fa482d7ae2480d39af5736141efee54ab881d1100ac552950fbec520995eb2668007cca4e8882af1fc6e5a
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © Fingertips <manfred@fngtps.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # EU VAT
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EuVat
4
+ VERSION = '0.0.1'
5
+ end
data/lib/eu_vat.rb ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Encapsulates the library implementation.
4
+ module EuVat
5
+ autoload :VERSION, 'eu_vat/version'
6
+
7
+ NORMALIZE_RE = /[^\d^[A-Z]]/
8
+ VALIDATE_RE = /\A([A-Z]{2})([\d[A-Z]]+)\Z/
9
+
10
+ def self.normalize(formatted_number)
11
+ formatted_number.upcase.gsub(NORMALIZE_RE, '')
12
+ end
13
+
14
+ def self.format(normalized_number)
15
+ [
16
+ normalized_number[0, 2],
17
+ normalized_number[2..]
18
+ ].join('.')
19
+ end
20
+
21
+ def self.validate(normalized_number)
22
+ match = VALIDATE_RE.match(normalized_number)
23
+ if match
24
+ []
25
+ else
26
+ [{ error: :invalid }]
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eu-vat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Manfred Stienstra
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: " Allows developers to normalize, validate, and verify EU VAT numbers.\n"
13
+ email:
14
+ - manfred@fngtps.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - lib/eu_vat.rb
22
+ - lib/eu_vat/version.rb
23
+ homepage: https://github.com/Fingertips/eu-var
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ rubygems_mfa_required: 'true'
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">"
34
+ - !ruby/object:Gem::Version
35
+ version: '3.3'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 4.0.10
43
+ specification_version: 4
44
+ summary: Tools to validate and verify EU VAT numbers.
45
+ test_files: []