europe 0.0.22 → 0.0.24
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 +8 -0
- data/lib/europe/vat/format.rb +1 -1
- data/lib/europe/vat/rates.rb +10 -10
- data/lib/europe/vat/vat.rb +2 -0
- data/lib/europe/version.rb +1 -1
- data/test/europe/vat/rates_test.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e64d994e1bcde40d5299ac2f99a1709a57e6fb44af2577ee88a22f12dbafaac8
|
4
|
+
data.tar.gz: 2035eec388fb5c6e975465c46e0cab5767e82064dbcfdffbfa46969ab1a7d2be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50ef66cb98eefbde1b30e0178a326b398f43b88cf56e6d187f58a26b755bb29ae37398a60b3cb3f541b0e5002059504453965208352f376fef008ba037c10b49
|
7
|
+
data.tar.gz: bf540b38bda311c563456826a56e835cf30f2aac6a2db9ef204bd124379c96fac4c811e209f0f190dc067155b4e4d48f1dd943e528442fc74a6a2cecb5f804af
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
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.24
|
5
|
+
- Changed source for retrieving VAT rates. (https://europa.eu/youreurope/business/taxation/vat/vat-rules-rates/index_en.htm)
|
6
|
+
- Removed UK from VAT rate fallbacks
|
7
|
+
- Updated VAT rates for Slovakia (SK) and Finland (FI)
|
8
|
+
- [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.23...v0.0.24)
|
9
|
+
## 0.0.23
|
10
|
+
- Added support for new Belgium VAT numbers, thank you tim-vandecasteele
|
11
|
+
- [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.22...v0.0.23)
|
4
12
|
## 0.0.22
|
5
13
|
- Updated Estonia's tax rate to 22%
|
6
14
|
- [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.21...v0.0.22)
|
data/lib/europe/vat/format.rb
CHANGED
data/lib/europe/vat/rates.rb
CHANGED
@@ -8,13 +8,12 @@ module Europe
|
|
8
8
|
module Rates
|
9
9
|
FALLBACK_RATES = {
|
10
10
|
AT: 20.0, BE: 21.0, BG: 20.0, CY: 19.0, CZ: 21.0, DE: 19.0, DK: 25.0, EE: 22.0,
|
11
|
-
EL: 24.0, ES: 21.0, FI:
|
11
|
+
EL: 24.0, ES: 21.0, FI: 25.5, FR: 20.0, HR: 25.0, HU: 27.0, IE: 23.0,
|
12
12
|
IT: 22.0, LT: 21.0, LU: 17.0, LV: 21.0, MT: 18.0, NL: 21.0, PL: 23.0, PT: 23.0,
|
13
|
-
RO: 19.0, SE: 25.0, SI: 22.0, SK:
|
13
|
+
RO: 19.0, SE: 25.0, SI: 22.0, SK: 23.0
|
14
14
|
}.freeze
|
15
|
-
RATES_URL = 'https://
|
16
|
-
'
|
17
|
-
'-electronic-services/vat-rates_en'
|
15
|
+
RATES_URL = 'https://europa.eu/youreurope/business/taxation/vat' \
|
16
|
+
'/vat-rules-rates/index_en.htm'
|
18
17
|
|
19
18
|
def self.retrieve
|
20
19
|
resp = fetch_rates
|
@@ -37,17 +36,18 @@ module Europe
|
|
37
36
|
xml.first.elements.each('tr') do |result|
|
38
37
|
next if result[3].nil?
|
39
38
|
|
40
|
-
rates = filter_rate(result, rates)
|
39
|
+
rates = filter_rate(result, rates || {})
|
41
40
|
end
|
42
41
|
rates
|
43
42
|
end
|
44
43
|
# rubocop:enable Metrics/MethodLength
|
45
44
|
|
46
45
|
def self.filter_rate(result, rates)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
return unless result[1].text.size == 2
|
47
|
+
|
48
|
+
country = result[1].text
|
49
|
+
rate = result[5].text
|
50
|
+
rates[country.to_sym] = rate.to_f if country && rate
|
51
51
|
rates
|
52
52
|
end
|
53
53
|
|
data/lib/europe/vat/vat.rb
CHANGED
@@ -38,6 +38,8 @@ module Europe
|
|
38
38
|
response = send_request(number[0..1], number[2..-1])
|
39
39
|
return :failed unless response.is_a? Net::HTTPSuccess
|
40
40
|
return :failed if response.body.include?('soap:Fault')
|
41
|
+
return :timeout if response.body.include?('TIMEOUT')
|
42
|
+
return :timeout if response.body.include?('MS_MAX_CONCURRENT_REQ')
|
41
43
|
|
42
44
|
setup_response(response)
|
43
45
|
rescue Net::OpenTimeout
|
data/lib/europe/version.rb
CHANGED
@@ -15,7 +15,8 @@ module Europe
|
|
15
15
|
def test_retrieval_of_vat_rates
|
16
16
|
rates = Europe::Vat::Rates.retrieve
|
17
17
|
|
18
|
-
|
18
|
+
# Remove UK from VAT rates
|
19
|
+
assert_equal rates.count, (Europe::Countries::COUNTRIES.keys - [:UK]).count
|
19
20
|
|
20
21
|
assert rates[:NL]
|
21
22
|
assert rates[:DE]
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gem shards
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.5.23
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Europe is a gem for retrieving and validating EU government data.
|