europe 0.0.16 → 0.0.17
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/.github/workflows/ruby.yml +33 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +15 -0
- data/README.md +7 -7
- data/lib/europe/vat/format.rb +1 -2
- data/lib/europe/vat/vat.rb +2 -6
- data/lib/europe/version.rb +1 -1
- data/test/europe/vat/format_test.rb +0 -4
- data/test/europe/vat/validation_test.rb +0 -5
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a51fd47c777826d6b43e650779d56da1dd6cade5cef5fbccdba86f9f0f1dbb5
|
|
4
|
+
data.tar.gz: aaf979e70a5e3dc6799824614c6d5c6d83c0ccd21d08960f66e6aee3d56006fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5473553fd2039a96277d7086dbc6d9e8b5a70891a70fb94361822ac1ce486000f1f18cde78796bb7d0eba35a443c47c5c6371d0497768bfcb4f8c81ad3d3c8a
|
|
7
|
+
data.tar.gz: 6f08b6079cf1bf521533e97d663b88779393fcddc4adda55860eb4329d99a22db2b610e3e106a2a798490e28301dbb3a5928a9b6b21be7b3e649d25f7f8fdfa0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ master ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ master ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v2
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
26
|
+
# uses: ruby/setup-ruby@v1
|
|
27
|
+
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: 2.7
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: bundle install
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
4
|
|
|
5
|
+
## 0.0.17
|
|
6
|
+
- Removed all UK VAT logic
|
|
7
|
+
- Updated development dependencies
|
|
8
|
+
- [Full Changelog](https://github.com/VvanGemert/europe/compare/v0.0.15...v0.0.16)
|
|
9
|
+
|
|
10
|
+
## 0.0.16
|
|
11
|
+
- Changed Slovak Republic to Slovakia in country names
|
|
12
|
+
- Updated outdated endpoint for VAT rates, thanks to @firstpromoter
|
|
13
|
+
- Fixed a couple of rubocop issues
|
|
14
|
+
- [Full Changelog](https://github.com/VvanGemert/europe/compare/v0.0.15...v0.0.16)
|
|
15
|
+
## 0.0.15
|
|
16
|
+
- Checked library on Ruby 2.7
|
|
17
|
+
- Moved repository to gem-shards
|
|
18
|
+
- [Full Changelog](https://github.com/VvanGemert/europe/compare/v0.0.14...v0.0.15)
|
|
19
|
+
|
|
5
20
|
## 0.0.14
|
|
6
21
|
- Fixed rubocop syntax issues
|
|
7
22
|
- Fixed issue with retrieving exchange rates when no valid JSON is returned
|
data/README.md
CHANGED
|
@@ -43,16 +43,16 @@ where this gem can be used for.
|
|
|
43
43
|
** Updated: Parameter now consists of one value.**
|
|
44
44
|
Call to validate VAT number (always starts with country code as specified in VIES)
|
|
45
45
|
```ruby
|
|
46
|
-
Europe::Vat.validate('
|
|
46
|
+
Europe::Vat.validate('NL009291477B01')
|
|
47
47
|
```
|
|
48
48
|
Response
|
|
49
49
|
```ruby
|
|
50
|
-
{ :country_code=>"
|
|
51
|
-
:vat_number=>"
|
|
52
|
-
:request_date
|
|
53
|
-
:valid=>true,
|
|
54
|
-
:name=>"
|
|
55
|
-
:address=>
|
|
50
|
+
{ :country_code => "NL",
|
|
51
|
+
:vat_number => "009291477B01",
|
|
52
|
+
:request_date => #<Date: 2015-12-15 ((2457372j,0s,0n),+0s,2299161j)>,
|
|
53
|
+
:valid => true,
|
|
54
|
+
:name => "KONINKLIJKE POSTNL B.V.",
|
|
55
|
+
:address => nil }
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Validate VAT number format
|
data/lib/europe/vat/format.rb
CHANGED
|
@@ -19,7 +19,6 @@ module Europe
|
|
|
19
19
|
ES: /^ES([A-Z0-9]\d{7}[A-Z0-9])$/,
|
|
20
20
|
FI: /^FI\d{8}$/,
|
|
21
21
|
FR: /^FR[A-Z0-9][A-Z0-9] \d{9}$/,
|
|
22
|
-
GB: [/^GB(\d{3} \d{4} \d{2}( \d{3}5)?)$/, /^GB(HA|GD)\d{3}(6|7)$/],
|
|
23
22
|
HR: /^HR\d{11}$/,
|
|
24
23
|
HU: /^HU\d{8}$/,
|
|
25
24
|
IE: /^IE\d[A-Z0-9\+\*|\d]\d{5}([A-Z]|WI)$/,
|
|
@@ -46,7 +45,7 @@ module Europe
|
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
def self.sanitize_number(number, country_code)
|
|
49
|
-
if %i[
|
|
48
|
+
if %i[DK FR].include?(country_code)
|
|
50
49
|
number.gsub(/\.|\t/, '').upcase
|
|
51
50
|
else
|
|
52
51
|
number.gsub(/\.|\t|\s/, '').upcase
|
data/lib/europe/vat/vat.rb
CHANGED
|
@@ -74,12 +74,8 @@ module Europe
|
|
|
74
74
|
def self.charge_vat?(origin_country, number)
|
|
75
75
|
return false if number.nil? || number.empty?
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
else
|
|
80
|
-
Europe::Countries::COUNTRIES
|
|
81
|
-
.key?(number[0..1].to_sym)
|
|
82
|
-
end
|
|
77
|
+
Europe::Vat::Fromat::VAT_REGEX.key?(origin_country.to_sym) ||
|
|
78
|
+
Europe::Vat::Fromat::VAT_REGEX.key?(number[0..1].to_sym)
|
|
83
79
|
end
|
|
84
80
|
|
|
85
81
|
def self.send_request(country_code, number)
|
data/lib/europe/version.rb
CHANGED
|
@@ -23,11 +23,6 @@ module Europe
|
|
|
23
23
|
assert validate_correct_vat[:valid] \
|
|
24
24
|
unless %i[timeout failed].include?(validate_correct_vat)
|
|
25
25
|
|
|
26
|
-
# Sky
|
|
27
|
-
validate_correct_vat = Europe::Vat.validate('GB440627467')
|
|
28
|
-
assert validate_correct_vat[:valid] \
|
|
29
|
-
unless %i[timeout failed].include?(validate_correct_vat)
|
|
30
|
-
|
|
31
26
|
# Volkswagen
|
|
32
27
|
validate_correct_vat = Europe::Vat.validate('DE115235681')
|
|
33
28
|
assert validate_correct_vat[:valid] \
|
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.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gem shards
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|
|
@@ -145,6 +145,7 @@ extensions: []
|
|
|
145
145
|
extra_rdoc_files: []
|
|
146
146
|
files:
|
|
147
147
|
- ".coveralls.yml"
|
|
148
|
+
- ".github/workflows/ruby.yml"
|
|
148
149
|
- ".gitignore"
|
|
149
150
|
- ".pryrc"
|
|
150
151
|
- ".rubocop.yml"
|