europe 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -0
- data/README.md +2 -2
- data/europe.gemspec +3 -3
- data/lib/europe/countries/countries.rb +1 -1
- data/lib/europe/postal/postal.rb +2 -2
- data/lib/europe/tasks/eurostat.rake +5 -5
- data/lib/europe/vat/rates.rb +7 -5
- data/lib/europe/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8dfe84a1c050d715865f2f5878458f4f9708437770e629ee64564d59ff622d4
|
4
|
+
data.tar.gz: d59e3b667b741269bfb5db4dafeb6cc531a052fd79ccfcbe354e941c5976cb13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da3ca3fc8579d8b55043b6f9af8da9ac1f69aa46ec9e4c9858a2318cae1222724679553ec45f61308928f65595bbd71682279aa219e46e698811eb3a27217a2
|
7
|
+
data.tar.gz: 3c5f1f99dab00df6e1e66acf202c4a12cf339fb0207566b5ef613d93c8ac262e61b243a05045e30c82dbc3b36667f89bc99345bb4b42456420951a5d7b889420
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
AllCops:
|
2
|
+
NewCops: enable
|
2
3
|
TargetRubyVersion: 2.7
|
4
|
+
SuggestExtensions: false
|
3
5
|
Exclude:
|
4
6
|
- 'europe.gemspec'
|
7
|
+
|
8
|
+
Style/SlicingWithRange:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/RedundantRegexpEscape:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/RedundantRegexpCharacterClass:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/CaseLikeIf:
|
18
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
![Europe gem logo](https://s3-eu-west-1.amazonaws.com/valorsis.s3-website-eu-west-1.amazonaws.com/static/logo256.png)
|
2
|
-
# Europe
|
2
|
+
# Europe :eu:
|
3
3
|
|
4
4
|
This gem provides EU governmental data, extracted from various EU / EC websites. With this gem you can validate VAT numbers, retrieve VAT tax rates and currency exchange rates matched to the Euro. How to use this gem is pretty straightforward and written below.
|
5
5
|
|
@@ -179,7 +179,7 @@ This gem is tested with the following Ruby versions on Linux and Mac OS X:
|
|
179
179
|
|
180
180
|
## Contributing
|
181
181
|
|
182
|
-
1. Fork it ( https://github.com/
|
182
|
+
1. Fork it ( https://github.com/gem-shards/europe.rb/fork )
|
183
183
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
184
184
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
185
185
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/europe.gemspec
CHANGED
@@ -6,15 +6,15 @@ require 'europe/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'europe'
|
8
8
|
spec.version = Europe::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = ['vincent@
|
9
|
+
spec.authors = ['Gem shards']
|
10
|
+
spec.email = ['vincent@gemshards.com']
|
11
11
|
spec.summary = 'Europe is a gem for retrieving and validating ' \
|
12
12
|
'EU government data.'
|
13
13
|
spec.description = 'Europe is a simple library for retrieving ' \
|
14
14
|
'EU government data such as VAT information, ' \
|
15
15
|
'VAT validation, currency exchange rates and ' \
|
16
16
|
'country information.'
|
17
|
-
spec.homepage = 'https://github.com/
|
17
|
+
spec.homepage = 'https://github.com/gem-shards/europe.rb'
|
18
18
|
spec.license = 'MIT'
|
19
19
|
|
20
20
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -81,7 +81,7 @@ module Europe
|
|
81
81
|
SI: { name: 'Slovenia', source_name: 'Slovenija',
|
82
82
|
official_name: 'Republic of Slovenia',
|
83
83
|
tld: '.si', currency: :EUR, capital: 'Ljubljana' },
|
84
|
-
SK: { name: '
|
84
|
+
SK: { name: 'Slovakia', source_name: 'Slovensko',
|
85
85
|
official_name: 'Slovak Republic',
|
86
86
|
tld: '.sk', currency: :EUR, capital: 'Bratislava' },
|
87
87
|
FI: { name: 'Finland', source_name: 'Suomi',
|
data/lib/europe/postal/postal.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
module Europe
|
5
5
|
# VAT
|
6
6
|
module Postal
|
7
|
-
# rubocop:disable LineLength
|
7
|
+
# rubocop:disable Layout/LineLength
|
8
8
|
POSTAL_REGEX = {
|
9
9
|
AT: /^\d{4}$/,
|
10
10
|
BE: /^\d{4}$/,
|
@@ -35,7 +35,7 @@ module Europe
|
|
35
35
|
SI: /^\d{4}$/,
|
36
36
|
SK: /^\d{3}[ ]?\d{2}$/
|
37
37
|
}.freeze
|
38
|
-
# rubocop:enable LineLength
|
38
|
+
# rubocop:enable Layout/LineLength
|
39
39
|
|
40
40
|
def self.validate(country_code, postal_code)
|
41
41
|
return false unless POSTAL_REGEX.key?(country_code.to_sym)
|
@@ -3,14 +3,14 @@
|
|
3
3
|
require 'open-uri'
|
4
4
|
|
5
5
|
namespace :eurostat do
|
6
|
-
EUROSTAT_BULK_URL = 'http://ec.europa.eu/eurostat/' \
|
7
|
-
'estat-navtree-portlet-prod/BulkDownloadListing' \
|
8
|
-
'?sort=1&file='
|
9
|
-
|
10
6
|
desc 'Download categories from Eurostat Bulk Facility'
|
11
7
|
task :download_categories do
|
8
|
+
eurostat_bulk_url = 'http://ec.europa.eu/eurostat/' \
|
9
|
+
'estat-navtree-portlet-prod/BulkDownloadListing' \
|
10
|
+
'?sort=1&file='
|
11
|
+
|
12
12
|
data = Net::HTTP.get_response(
|
13
|
-
URI.parse(
|
13
|
+
URI.parse("#{eurostat_bulk_url}table_of_contents_en.txt")
|
14
14
|
).body
|
15
15
|
File.open('cat.txt', 'w') do |f|
|
16
16
|
IO.copy_stream(data, f)
|
data/lib/europe/vat/rates.rb
CHANGED
@@ -6,8 +6,9 @@ module Europe
|
|
6
6
|
module Vat
|
7
7
|
# Rates
|
8
8
|
module Rates
|
9
|
-
RATES_URL = 'https://europa.eu/
|
10
|
-
'vat/
|
9
|
+
RATES_URL = 'https://ec.europa.eu/taxation_customs/' \
|
10
|
+
'business/vat/telecommunications-broadcasting' \
|
11
|
+
'-electronic-services/vat-rates_en'
|
11
12
|
|
12
13
|
def self.retrieve
|
13
14
|
resp = fetch_rates
|
@@ -30,9 +31,10 @@ module Europe
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def self.filter_rate(result, rates)
|
33
|
-
country = result[
|
34
|
-
rate = result[
|
35
|
-
|
34
|
+
country = result[0].text
|
35
|
+
rate = result[3].text
|
36
|
+
country_code = Europe::Countries::Reversed.generate(:name)[country]
|
37
|
+
rates[country_code] = rate.to_f if country_code
|
36
38
|
rates
|
37
39
|
end
|
38
40
|
|
data/lib/europe/version.rb
CHANGED
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Gem shards
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -139,7 +139,7 @@ dependencies:
|
|
139
139
|
description: Europe is a simple library for retrieving EU government data such as
|
140
140
|
VAT information, VAT validation, currency exchange rates and country information.
|
141
141
|
email:
|
142
|
-
- vincent@
|
142
|
+
- vincent@gemshards.com
|
143
143
|
executables: []
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
@@ -177,11 +177,11 @@ files:
|
|
177
177
|
- test/europe/vat/rates_test.rb
|
178
178
|
- test/europe/vat/validation_test.rb
|
179
179
|
- test/test_helper.rb
|
180
|
-
homepage: https://github.com/
|
180
|
+
homepage: https://github.com/gem-shards/europe.rb
|
181
181
|
licenses:
|
182
182
|
- MIT
|
183
183
|
metadata: {}
|
184
|
-
post_install_message:
|
184
|
+
post_install_message:
|
185
185
|
rdoc_options: []
|
186
186
|
require_paths:
|
187
187
|
- lib
|
@@ -196,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
rubygems_version: 3.1.
|
200
|
-
signing_key:
|
199
|
+
rubygems_version: 3.1.4
|
200
|
+
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Europe is a gem for retrieving and validating EU government data.
|
203
203
|
test_files:
|