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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f240e97b6b50e8ce6d85aa147b6ad316cc1feed7642b10b38c985162e27c0914
4
- data.tar.gz: 892bf37785235c8af2c05df4104f52c2a246a5a60e6341565a24a73eef22c3f1
3
+ metadata.gz: b8dfe84a1c050d715865f2f5878458f4f9708437770e629ee64564d59ff622d4
4
+ data.tar.gz: d59e3b667b741269bfb5db4dafeb6cc531a052fd79ccfcbe354e941c5976cb13
5
5
  SHA512:
6
- metadata.gz: f5014f8ac9fe0e6728172aa0987c117bd7d8191d381ea0d442be6f9a418b515db575f577f429efefb610b9b13f3fd2b26acc7c685d2eae938fe780515106380c
7
- data.tar.gz: 5d6c2aed9734805fc2798180057d1e14a632b78a7c155f07a17bfee30d27c148fdcfc9f5b4dc15a1c4870151b8194b0405b9173efbf652e95dbf90aac3fd9152
6
+ metadata.gz: 5da3ca3fc8579d8b55043b6f9af8da9ac1f69aa46ec9e4c9858a2318cae1222724679553ec45f61308928f65595bbd71682279aa219e46e698811eb3a27217a2
7
+ data.tar.gz: 3c5f1f99dab00df6e1e66acf202c4a12cf339fb0207566b5ef613d93c8ac262e61b243a05045e30c82dbc3b36667f89bc99345bb4b42456420951a5d7b889420
@@ -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/VvanGemert/europe/fork )
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`)
@@ -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 = ['VvanGemert']
10
- spec.email = ['vincent@floorplanner.com']
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/VvanGemert/europe'
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: 'Slovak Republic', source_name: 'Slovensko',
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',
@@ -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(EUROSTAT_BULK_URL + 'table_of_contents_en.txt')
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)
@@ -6,8 +6,9 @@ module Europe
6
6
  module Vat
7
7
  # Rates
8
8
  module Rates
9
- RATES_URL = 'https://europa.eu/youreurope/business/taxation/' \
10
- 'vat/vat-rules-rates/index_en.htm'
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[3].text
34
- rate = result[5].text
35
- rates[country.to_sym] = rate.to_f if country
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
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Europe version
4
4
  module Europe
5
- VERSION = '0.0.15'
5
+ VERSION = '0.0.16'
6
6
  end
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.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
- - VvanGemert
8
- autorequire:
7
+ - Gem shards
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
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@floorplanner.com
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/VvanGemert/europe
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.2
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: