europe 0.0.23 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53500bbab54cb394a57ca323ede9880d16be13d637b1e686868e6ca7e8447ee8
4
- data.tar.gz: eb2f9f52ad5a0ffa1c48a45ef4cf21cbfdabe0a817762c11b31a7ca4fddcc683
3
+ metadata.gz: e64d994e1bcde40d5299ac2f99a1709a57e6fb44af2577ee88a22f12dbafaac8
4
+ data.tar.gz: 2035eec388fb5c6e975465c46e0cab5767e82064dbcfdffbfa46969ab1a7d2be
5
5
  SHA512:
6
- metadata.gz: d6f9b55ab0c70afa0a97f1674b10317ba76442eca7f61b5e23ea8aa79bfd4c5e671faf00f25233250b7540d32cad830b9651eba8a5a4699af58218a5244e683a
7
- data.tar.gz: caeea4286835e9996ce8367c8be9c0fa9ac8c19fe457c8c8b58f9c87aef242a54cbb451eedba3a7f5f339135c45acc8e9a0ff24404e956e3aee2c57fe3e81531
6
+ metadata.gz: 50ef66cb98eefbde1b30e0178a326b398f43b88cf56e6d187f58a26b755bb29ae37398a60b3cb3f541b0e5002059504453965208352f376fef008ba037c10b49
7
+ data.tar.gz: bf540b38bda311c563456826a56e835cf30f2aac6a2db9ef204bd124379c96fac4c811e209f0f190dc067155b4e4d48f1dd943e528442fc74a6a2cecb5f804af
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
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)
4
9
  ## 0.0.23
5
10
  - Added support for new Belgium VAT numbers, thank you tim-vandecasteele
6
11
  - [Full Changelog](https://github.com/gem-shards/europe.rb/compare/v0.0.22...v0.0.23)
@@ -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: 24.0, FR: 20.0, UK: 20.0, HR: 25.0, HU: 27.0, IE: 23.0,
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: 20.0
13
+ RO: 19.0, SE: 25.0, SI: 22.0, SK: 23.0
14
14
  }.freeze
15
- RATES_URL = 'https://ec.europa.eu/taxation_customs/' \
16
- 'business/vat/telecommunications-broadcasting' \
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
- country = result[0].text
48
- rate = result[3].text
49
- country_code = Europe::Countries::Reversed.generate(:name)[country]
50
- rates[country_code] = rate.to_f if country_code
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
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Europe version
4
4
  module Europe
5
- VERSION = '0.0.23'
5
+ VERSION = '0.0.24'
6
6
  end
@@ -15,7 +15,8 @@ module Europe
15
15
  def test_retrieval_of_vat_rates
16
16
  rates = Europe::Vat::Rates.retrieve
17
17
 
18
- assert_equal rates.count, Europe::Countries::COUNTRIES.count
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.23
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: 2025-02-12 00:00:00.000000000 Z
11
+ date: 2025-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug