europe 0.0.16 → 0.0.17

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: b8dfe84a1c050d715865f2f5878458f4f9708437770e629ee64564d59ff622d4
4
- data.tar.gz: d59e3b667b741269bfb5db4dafeb6cc531a052fd79ccfcbe354e941c5976cb13
3
+ metadata.gz: 2a51fd47c777826d6b43e650779d56da1dd6cade5cef5fbccdba86f9f0f1dbb5
4
+ data.tar.gz: aaf979e70a5e3dc6799824614c6d5c6d83c0ccd21d08960f66e6aee3d56006fa
5
5
  SHA512:
6
- metadata.gz: 5da3ca3fc8579d8b55043b6f9af8da9ac1f69aa46ec9e4c9858a2318cae1222724679553ec45f61308928f65595bbd71682279aa219e46e698811eb3a27217a2
7
- data.tar.gz: 3c5f1f99dab00df6e1e66acf202c4a12cf339fb0207566b5ef613d93c8ac262e61b243a05045e30c82dbc3b36667f89bc99345bb4b42456420951a5d7b889420
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
@@ -15,3 +15,4 @@ mkmf.log
15
15
  .DS_Store
16
16
  coverage
17
17
  .byebug_history
18
+ *.gem
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('GB440627467')
46
+ Europe::Vat.validate('NL009291477B01')
47
47
  ```
48
48
  Response
49
49
  ```ruby
50
- { :country_code=>"GB",
51
- :vat_number=>"440627467",
52
- :request_date=>#<Date: 2015-12-15 ((2457372j,0s,0n),+0s,2299161j)>,
53
- :valid=>true,
54
- :name=>"SKY PLC",
55
- :address=>"6 CENTAURS BUSINESS PARK\nGRANT WAY\nISLEWORTH\nMIDDLESEX\n\nTW7 5QD" }
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
@@ -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[GB DK FR].include?(country_code)
48
+ if %i[DK FR].include?(country_code)
50
49
  number.gsub(/\.|\t/, '').upcase
51
50
  else
52
51
  number.gsub(/\.|\t|\s/, '').upcase
@@ -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
- if origin_country.to_sym == number[0..1].to_sym
78
- true
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)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Europe version
4
4
  module Europe
5
- VERSION = '0.0.16'
5
+ VERSION = '0.0.17'
6
6
  end
@@ -21,10 +21,6 @@ module Europe
21
21
  ES: 'ESX9999999X',
22
22
  FI: 'FI99999999',
23
23
  FR: 'FRXX 999999999',
24
- GB: ['GB999 9999 99 9995',
25
- 'GBGD9996',
26
- 'GBHA9997',
27
- 'GB999 9999 99'],
28
24
  HR: 'HR99999999999',
29
25
  HU: 'HU99999999',
30
26
  IE: %w[IE9S99999L IE9999999WI],
@@ -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.16
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-01-31 00:00:00.000000000 Z
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"