valvat 1.0.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ruby.yml +41 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +15 -0
- data/CHANGES.md +27 -1
- data/Gemfile +2 -0
- data/Guardfile +6 -4
- data/README.md +6 -4
- data/Rakefile +3 -1
- data/certs/yolk.pem +25 -24
- data/gemfiles/activemodel-5 +1 -1
- data/gemfiles/activemodel-6 +1 -1
- data/gemfiles/{activemodel-3-2 → activemodel-7} +2 -2
- data/lib/active_model/validations/valvat_validator.rb +65 -32
- data/lib/valvat/checksum/at.rb +3 -1
- data/lib/valvat/checksum/be.rb +3 -1
- data/lib/valvat/checksum/bg.rb +17 -17
- data/lib/valvat/checksum/cy.rb +2 -0
- data/lib/valvat/checksum/de.rb +5 -3
- data/lib/valvat/checksum/dk.rb +3 -1
- data/lib/valvat/checksum/ee.rb +2 -0
- data/lib/valvat/checksum/es.rb +14 -16
- data/lib/valvat/checksum/fi.rb +3 -1
- data/lib/valvat/checksum/fr.rb +4 -2
- data/lib/valvat/checksum/gb.rb +46 -31
- data/lib/valvat/checksum/gr.rb +4 -2
- data/lib/valvat/checksum/hr.rb +2 -0
- data/lib/valvat/checksum/hu.rb +2 -0
- data/lib/valvat/checksum/ie.rb +5 -6
- data/lib/valvat/checksum/it.rb +7 -5
- data/lib/valvat/checksum/lt.rb +2 -0
- data/lib/valvat/checksum/lu.rb +3 -1
- data/lib/valvat/checksum/mt.rb +2 -0
- data/lib/valvat/checksum/nl.rb +5 -3
- data/lib/valvat/checksum/pl.rb +3 -1
- data/lib/valvat/checksum/pt.rb +3 -1
- data/lib/valvat/checksum/ro.rb +2 -0
- data/lib/valvat/checksum/se.rb +5 -3
- data/lib/valvat/checksum/si.rb +4 -2
- data/lib/valvat/checksum.rb +24 -28
- data/lib/valvat/error.rb +8 -2
- data/lib/valvat/local.rb +6 -4
- data/lib/valvat/locales/de.yml +2 -1
- data/lib/valvat/locales/en.yml +2 -1
- data/lib/valvat/locales/es.yml +1 -0
- data/lib/valvat/locales/fr.yml +1 -0
- data/lib/valvat/locales/hu.yml +1 -0
- data/lib/valvat/locales/nl.yml +1 -0
- data/lib/valvat/locales/pl.yml +1 -0
- data/lib/valvat/lookup/fault.rb +29 -21
- data/lib/valvat/lookup/request.rb +21 -16
- data/lib/valvat/lookup/response.rb +11 -10
- data/lib/valvat/lookup.rb +5 -4
- data/lib/valvat/syntax.rb +31 -30
- data/lib/valvat/utils.rb +12 -9
- data/lib/valvat/version.rb +3 -1
- data/lib/valvat.rb +4 -2
- data/spec/active_model/validations/valvat_validator_spec.rb +99 -93
- data/spec/spec_helper.rb +8 -8
- data/spec/valvat/checksum/at_spec.rb +6 -4
- data/spec/valvat/checksum/be_spec.rb +6 -4
- data/spec/valvat/checksum/bg_spec.rb +7 -4
- data/spec/valvat/checksum/cy_spec.rb +3 -1
- data/spec/valvat/checksum/de_spec.rb +6 -4
- data/spec/valvat/checksum/dk_spec.rb +6 -4
- data/spec/valvat/checksum/ee_spec.rb +3 -1
- data/spec/valvat/checksum/es_spec.rb +7 -4
- data/spec/valvat/checksum/fi_spec.rb +6 -4
- data/spec/valvat/checksum/fr_spec.rb +6 -4
- data/spec/valvat/checksum/gb_spec.rb +4 -2
- data/spec/valvat/checksum/gr_spec.rb +6 -4
- data/spec/valvat/checksum/hr_spec.rb +3 -1
- data/spec/valvat/checksum/hu_spec.rb +3 -1
- data/spec/valvat/checksum/ie_spec.rb +8 -6
- data/spec/valvat/checksum/it_spec.rb +10 -8
- data/spec/valvat/checksum/lt_spec.rb +3 -1
- data/spec/valvat/checksum/lu_spec.rb +6 -4
- data/spec/valvat/checksum/mt_spec.rb +3 -1
- data/spec/valvat/checksum/nl_spec.rb +9 -7
- data/spec/valvat/checksum/pl_spec.rb +8 -6
- data/spec/valvat/checksum/pt_spec.rb +10 -11
- data/spec/valvat/checksum/ro_spec.rb +3 -1
- data/spec/valvat/checksum/se_spec.rb +8 -6
- data/spec/valvat/checksum/si_spec.rb +10 -8
- data/spec/valvat/checksum_spec.rb +24 -9
- data/spec/valvat/lookup/fault_spec.rb +34 -0
- data/spec/valvat/lookup/request_spec.rb +32 -0
- data/spec/valvat/lookup/response_spec.rb +29 -0
- data/spec/valvat/lookup_spec.rb +171 -152
- data/spec/valvat/syntax_spec.rb +59 -280
- data/spec/valvat/utils_spec.rb +64 -47
- data/spec/valvat_spec.rb +140 -152
- data/valvat.gemspec +17 -17
- data.tar.gz.sig +1 -2
- metadata +48 -50
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -47
- data/gemfiles/activemodel-4 +0 -7
- data/gemfiles/before-ruby21/activemodel-3-2 +0 -8
- data/gemfiles/before-ruby21/activemodel-4 +0 -8
- data/gemfiles/before-ruby21/standalone +0 -7
- data/spec/valvat/lockup/fault_spec.rb +0 -32
- data/spec/valvat/lockup/request_spec.rb +0 -15
- data/spec/valvat/lockup/response_spec.rb +0 -27
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valvat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Munz
|
@@ -10,31 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
13
|
+
MIIEZDCCAsygAwIBAgIBATANBgkqhkiG9w0BAQsFADA8MRIwEAYDVQQDDAlzZWJh
|
14
|
+
c3RpYW4xEjAQB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6g1v/
|
29
|
+
t9TcO8JmX6UqEgoRHsdxPEyCK9RroYIv7X5GDyJ12ZdiGpzCqJiBIC9Gz3cCWAbp
|
30
|
+
LtnkhO8SQbz5B0NMOvo4o6XnbAr+rhVihuJmf0zXInnm1KZW/Yi+4JNAebPqwF1S
|
31
|
+
VZ/2Dz2BtTuTFhqlHOGxV2NxcnZjFff9kfUOLwl/oNUKgBecsMP5aW74zSOmc2fO
|
32
|
+
3sykOkKf5mWSY/KSuaCmAP1Ou3UUXOQmxiPUW9SDAzhYGKS63yPMkzJAziDP9ewI
|
33
|
+
zmOE2OJr0NuCmH9ykqlJZU4wnmloCnE1+8kHCl4+76cgBnN5gnYnzUb4RDM3J4EI
|
34
|
+
Jdm7+JxQbgAP/HJ2C2ara+uwc9jwhw2s1b2+TPnVCZdh9uBttHWfk0wgDoeFwky1
|
35
|
+
BUdT7mtr41GgvWnIjaGWAldSuabxx5H+PKS5FzjNDMHThRZWuvYp/nP2RXDh4gIa
|
36
|
+
7hV09P+XxvS96G+petG5KmC/lev8VqKu
|
36
37
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
38
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
38
39
|
dependencies:
|
39
40
|
- !ruby/object:Gem::Dependency
|
40
41
|
name: savon
|
@@ -51,45 +52,45 @@ dependencies:
|
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: 2.3.0
|
53
54
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
55
|
+
name: activemodel
|
55
56
|
requirement: !ruby/object:Gem::Requirement
|
56
57
|
requirements:
|
57
58
|
- - ">="
|
58
59
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
60
|
+
version: '5.0'
|
60
61
|
type: :development
|
61
62
|
prerelease: false
|
62
63
|
version_requirements: !ruby/object:Gem::Requirement
|
63
64
|
requirements:
|
64
65
|
- - ">="
|
65
66
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
67
|
+
version: '5.0'
|
67
68
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
69
|
+
name: rake
|
69
70
|
requirement: !ruby/object:Gem::Requirement
|
70
71
|
requirements:
|
71
|
-
- - "
|
72
|
+
- - ">="
|
72
73
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
74
|
+
version: '0'
|
74
75
|
type: :development
|
75
76
|
prerelease: false
|
76
77
|
version_requirements: !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
|
-
- - "
|
79
|
+
- - ">="
|
79
80
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
81
|
+
version: '0'
|
81
82
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
83
|
+
name: rspec
|
83
84
|
requirement: !ruby/object:Gem::Requirement
|
84
85
|
requirements:
|
85
|
-
- - "
|
86
|
+
- - "~>"
|
86
87
|
- !ruby/object:Gem::Version
|
87
88
|
version: '3.0'
|
88
89
|
type: :development
|
89
90
|
prerelease: false
|
90
91
|
version_requirements: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
|
-
- - "
|
93
|
+
- - "~>"
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: '3.0'
|
95
96
|
description: Validates european vat numbers. Standalone or as a ActiveModel validator.
|
@@ -100,8 +101,9 @@ extensions: []
|
|
100
101
|
extra_rdoc_files: []
|
101
102
|
files:
|
102
103
|
- ".editorconfig"
|
104
|
+
- ".github/workflows/ruby.yml"
|
103
105
|
- ".gitignore"
|
104
|
-
- ".
|
106
|
+
- ".rubocop.yml"
|
105
107
|
- CHANGES.md
|
106
108
|
- Gemfile
|
107
109
|
- Guardfile
|
@@ -109,13 +111,9 @@ files:
|
|
109
111
|
- README.md
|
110
112
|
- Rakefile
|
111
113
|
- certs/yolk.pem
|
112
|
-
- gemfiles/activemodel-3-2
|
113
|
-
- gemfiles/activemodel-4
|
114
114
|
- gemfiles/activemodel-5
|
115
115
|
- gemfiles/activemodel-6
|
116
|
-
- gemfiles/
|
117
|
-
- gemfiles/before-ruby21/activemodel-4
|
118
|
-
- gemfiles/before-ruby21/standalone
|
116
|
+
- gemfiles/activemodel-7
|
119
117
|
- gemfiles/standalone
|
120
118
|
- lib/active_model/validations/valvat_validator.rb
|
121
119
|
- lib/valvat.rb
|
@@ -202,9 +200,9 @@ files:
|
|
202
200
|
- spec/valvat/checksum/se_spec.rb
|
203
201
|
- spec/valvat/checksum/si_spec.rb
|
204
202
|
- spec/valvat/checksum_spec.rb
|
205
|
-
- spec/valvat/
|
206
|
-
- spec/valvat/
|
207
|
-
- spec/valvat/
|
203
|
+
- spec/valvat/lookup/fault_spec.rb
|
204
|
+
- spec/valvat/lookup/request_spec.rb
|
205
|
+
- spec/valvat/lookup/response_spec.rb
|
208
206
|
- spec/valvat/lookup_spec.rb
|
209
207
|
- spec/valvat/syntax_spec.rb
|
210
208
|
- spec/valvat/utils_spec.rb
|
@@ -222,14 +220,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
220
|
requirements:
|
223
221
|
- - ">="
|
224
222
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
223
|
+
version: 2.5.0
|
226
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
225
|
requirements:
|
228
226
|
- - ">="
|
229
227
|
- !ruby/object:Gem::Version
|
230
228
|
version: '0'
|
231
229
|
requirements: []
|
232
|
-
rubygems_version: 3.
|
230
|
+
rubygems_version: 3.3.3
|
233
231
|
signing_key:
|
234
232
|
specification_version: 4
|
235
233
|
summary: Validates european vat numbers. Standalone or as a ActiveModel validator.
|
@@ -262,9 +260,9 @@ test_files:
|
|
262
260
|
- spec/valvat/checksum/se_spec.rb
|
263
261
|
- spec/valvat/checksum/si_spec.rb
|
264
262
|
- spec/valvat/checksum_spec.rb
|
265
|
-
- spec/valvat/
|
266
|
-
- spec/valvat/
|
267
|
-
- spec/valvat/
|
263
|
+
- spec/valvat/lookup/fault_spec.rb
|
264
|
+
- spec/valvat/lookup/request_spec.rb
|
265
|
+
- spec/valvat/lookup/response_spec.rb
|
268
266
|
- spec/valvat/lookup_spec.rb
|
269
267
|
- spec/valvat/syntax_spec.rb
|
270
268
|
- spec/valvat/utils_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/.travis.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
rvm:
|
4
|
-
- 2.7
|
5
|
-
- 2.6
|
6
|
-
- 2.5
|
7
|
-
- 2.4
|
8
|
-
- 2.3
|
9
|
-
- 2.2
|
10
|
-
- 2.1
|
11
|
-
- jruby-head
|
12
|
-
- jruby-19mode
|
13
|
-
gemfile:
|
14
|
-
- gemfiles/activemodel-6
|
15
|
-
- gemfiles/activemodel-5
|
16
|
-
- gemfiles/activemodel-4
|
17
|
-
- gemfiles/activemodel-3-2
|
18
|
-
- gemfiles/standalone
|
19
|
-
matrix:
|
20
|
-
exclude:
|
21
|
-
- rvm: 2.4
|
22
|
-
gemfile: gemfiles/activemodel-6
|
23
|
-
- rvm: 2.3
|
24
|
-
gemfile: gemfiles/activemodel-6
|
25
|
-
- rvm: 2.2
|
26
|
-
gemfile: gemfiles/activemodel-6
|
27
|
-
- rvm: 2.1
|
28
|
-
gemfile: gemfiles/activemodel-6
|
29
|
-
- rvm: jruby-19mode
|
30
|
-
gemfile: gemfiles/activemodel-6
|
31
|
-
- rvm: 2.1
|
32
|
-
gemfile: gemfiles/activemodel-5
|
33
|
-
- rvm: jruby-19mode
|
34
|
-
gemfile: gemfiles/activemodel-5
|
35
|
-
include:
|
36
|
-
- rvm: 2.0
|
37
|
-
gemfile: gemfiles/before-ruby21/activemodel-4
|
38
|
-
- rvm: 2.0
|
39
|
-
gemfile: gemfiles/before-ruby21/activemodel-3-2
|
40
|
-
- rvm: 2.0
|
41
|
-
gemfile: gemfiles/before-ruby21/standalone
|
42
|
-
- rvm: 1.9.3
|
43
|
-
gemfile: gemfiles/before-ruby21/activemodel-4
|
44
|
-
- rvm: 1.9.3
|
45
|
-
gemfile: gemfiles/before-ruby21/activemodel-3-2
|
46
|
-
- rvm: 1.9.3
|
47
|
-
gemfile: gemfiles/before-ruby21/standalone
|
data/gemfiles/activemodel-4
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Valvat::Lookup::Fault do
|
4
|
-
it "returns {valid: false} on fault 'INVALID_INPUT'" do
|
5
|
-
expect(Valvat::Lookup::Fault.new({
|
6
|
-
fault: {faultstring: "INVALID_INPUT"}
|
7
|
-
}).to_hash).to eql({valid: false})
|
8
|
-
end
|
9
|
-
|
10
|
-
{
|
11
|
-
"SERVICE_UNAVAILABLE" => Valvat::ServiceUnavailable,
|
12
|
-
"MS_UNAVAILABLE" => Valvat::MemberStateUnavailable,
|
13
|
-
"INVALID_REQUESTER_INFO" => Valvat::InvalidRequester,
|
14
|
-
"TIMEOUT" => Valvat::Timeout,
|
15
|
-
"VAT_BLOCKED" => Valvat::BlockedError,
|
16
|
-
"IP_BLOCKED" => Valvat::BlockedError,
|
17
|
-
"GLOBAL_MAX_CONCURRENT_REQ" => Valvat::RateLimitError,
|
18
|
-
"GLOBAL_MAX_CONCURRENT_REQ_TIME" => Valvat::RateLimitError,
|
19
|
-
"MS_MAX_CONCURRENT_REQ" => Valvat::RateLimitError,
|
20
|
-
"MS_MAX_CONCURRENT_REQ_TIME" => Valvat::RateLimitError,
|
21
|
-
"ANYTHING ELSE" => Valvat::UnknownViesError,
|
22
|
-
"REALLY ANYTHING" => Valvat::UnknownViesError
|
23
|
-
}.each do |fault, error|
|
24
|
-
it "returns error on fault '#{fault}'" do
|
25
|
-
expect(Valvat::Lookup::Fault.new({
|
26
|
-
fault: {faultstring: fault}
|
27
|
-
}).to_hash).to eql({
|
28
|
-
error: error.new(fault)
|
29
|
-
})
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Valvat::Lookup::Request do
|
4
|
-
it "returns Response on success" do
|
5
|
-
response = Valvat::Lookup::Request.new("IE6388047V", {}).perform
|
6
|
-
expect(response).to be_a(Valvat::Lookup::Response)
|
7
|
-
expect(response.to_hash[:name]).to eql("GOOGLE IRELAND LIMITED")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "returns Fault on failure" do
|
11
|
-
response = Valvat::Lookup::Request.new("XC123123", {}).perform
|
12
|
-
expect(response).to be_a(Valvat::Lookup::Fault)
|
13
|
-
expect(response.to_hash).to eql({valid: false})
|
14
|
-
end
|
15
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Valvat::Lookup::Response do
|
4
|
-
it "removes @xmlns from :check_vat_response hash" do
|
5
|
-
expect(Valvat::Lookup::Response.new({
|
6
|
-
check_vat_response: {:a => 1, :b => 2, :@xmlns => true}
|
7
|
-
}).to_hash).to eql({a: 1, b: 2})
|
8
|
-
end
|
9
|
-
|
10
|
-
it "removes 'trader_'-Prefixes :check_vat_response hash" do
|
11
|
-
expect(Valvat::Lookup::Response.new({
|
12
|
-
check_vat_response: {:a => 1, :trader_b => 2}
|
13
|
-
}).to_hash).to eql({a: 1, b: 2})
|
14
|
-
end
|
15
|
-
|
16
|
-
it "accepts hash keyed as :check_vat_approx_response" do
|
17
|
-
expect(Valvat::Lookup::Response.new({
|
18
|
-
check_vat_approx_response: {:a => 1, :b => 2}
|
19
|
-
}).to_hash).to eql({a: 1, b: 2})
|
20
|
-
end
|
21
|
-
|
22
|
-
it "allows direct access to hash via []" do
|
23
|
-
expect(Valvat::Lookup::Response.new({
|
24
|
-
check_vat_response: {:a => 123, :b => 2}
|
25
|
-
})[:a]).to eql(123)
|
26
|
-
end
|
27
|
-
end
|