valvat 1.0.1 → 1.1.0
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.tar.gz.sig +0 -0
- data/.github/workflows/ruby.yml +35 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +15 -0
- data/CHANGES.md +9 -1
- data/Gemfile +2 -0
- data/Guardfile +6 -4
- data/README.md +5 -3
- data/Rakefile +3 -1
- data/gemfiles/activemodel-5 +1 -1
- data/gemfiles/activemodel-6 +1 -1
- data/lib/active_model/validations/valvat_validator.rb +65 -32
- data/lib/valvat.rb +4 -2
- data/lib/valvat/checksum.rb +14 -13
- 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 +6 -4
- 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/error.rb +4 -1
- 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.rb +5 -4
- data/lib/valvat/lookup/fault.rb +17 -16
- data/lib/valvat/lookup/request.rb +21 -16
- data/lib/valvat/lookup/response.rb +11 -10
- data/lib/valvat/syntax.rb +31 -30
- data/lib/valvat/utils.rb +12 -9
- data/lib/valvat/version.rb +3 -1
- 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 +11 -9
- data/spec/valvat/lookup/fault_spec.rb +34 -0
- data/spec/valvat/lookup/request_spec.rb +19 -0
- data/spec/valvat/lookup/response_spec.rb +29 -0
- data/spec/valvat/lookup_spec.rb +138 -153
- data/spec/valvat/syntax_spec.rb +59 -280
- data/spec/valvat/utils_spec.rb +62 -47
- data/spec/valvat_spec.rb +140 -152
- data/valvat.gemspec +17 -17
- metadata +24 -27
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -47
- data/gemfiles/activemodel-3-2 +0 -7
- 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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Munz
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
KzzULF0bF9oNpXwBEamlH2myNb19u1W8ijobQ7Y19ca8UFHr5LI32ZW5Zlmep8je
|
35
35
|
vb+o07oLRx3t2T/EO4DZ1w==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2021-01-
|
37
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: savon
|
@@ -51,45 +51,45 @@ dependencies:
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 2.3.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: activemodel
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
59
|
+
version: '5.0'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
66
|
+
version: '5.0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
68
|
+
name: rake
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - "
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
80
|
+
version: '0'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: rspec
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '3.0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '3.0'
|
95
95
|
description: Validates european vat numbers. Standalone or as a ActiveModel validator.
|
@@ -100,8 +100,9 @@ extensions: []
|
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
102
|
- ".editorconfig"
|
103
|
+
- ".github/workflows/ruby.yml"
|
103
104
|
- ".gitignore"
|
104
|
-
- ".
|
105
|
+
- ".rubocop.yml"
|
105
106
|
- CHANGES.md
|
106
107
|
- Gemfile
|
107
108
|
- Guardfile
|
@@ -109,13 +110,8 @@ files:
|
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
111
112
|
- certs/yolk.pem
|
112
|
-
- gemfiles/activemodel-3-2
|
113
|
-
- gemfiles/activemodel-4
|
114
113
|
- gemfiles/activemodel-5
|
115
114
|
- gemfiles/activemodel-6
|
116
|
-
- gemfiles/before-ruby21/activemodel-3-2
|
117
|
-
- gemfiles/before-ruby21/activemodel-4
|
118
|
-
- gemfiles/before-ruby21/standalone
|
119
115
|
- gemfiles/standalone
|
120
116
|
- lib/active_model/validations/valvat_validator.rb
|
121
117
|
- lib/valvat.rb
|
@@ -202,9 +198,9 @@ files:
|
|
202
198
|
- spec/valvat/checksum/se_spec.rb
|
203
199
|
- spec/valvat/checksum/si_spec.rb
|
204
200
|
- spec/valvat/checksum_spec.rb
|
205
|
-
- spec/valvat/
|
206
|
-
- spec/valvat/
|
207
|
-
- spec/valvat/
|
201
|
+
- spec/valvat/lookup/fault_spec.rb
|
202
|
+
- spec/valvat/lookup/request_spec.rb
|
203
|
+
- spec/valvat/lookup/response_spec.rb
|
208
204
|
- spec/valvat/lookup_spec.rb
|
209
205
|
- spec/valvat/syntax_spec.rb
|
210
206
|
- spec/valvat/utils_spec.rb
|
@@ -222,14 +218,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
218
|
requirements:
|
223
219
|
- - ">="
|
224
220
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
221
|
+
version: 2.5.0
|
226
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
223
|
requirements:
|
228
224
|
- - ">="
|
229
225
|
- !ruby/object:Gem::Version
|
230
226
|
version: '0'
|
231
227
|
requirements: []
|
232
|
-
|
228
|
+
rubyforge_project:
|
229
|
+
rubygems_version: 2.7.6.2
|
233
230
|
signing_key:
|
234
231
|
specification_version: 4
|
235
232
|
summary: Validates european vat numbers. Standalone or as a ActiveModel validator.
|
@@ -262,9 +259,9 @@ test_files:
|
|
262
259
|
- spec/valvat/checksum/se_spec.rb
|
263
260
|
- spec/valvat/checksum/si_spec.rb
|
264
261
|
- spec/valvat/checksum_spec.rb
|
265
|
-
- spec/valvat/
|
266
|
-
- spec/valvat/
|
267
|
-
- spec/valvat/
|
262
|
+
- spec/valvat/lookup/fault_spec.rb
|
263
|
+
- spec/valvat/lookup/request_spec.rb
|
264
|
+
- spec/valvat/lookup/response_spec.rb
|
268
265
|
- spec/valvat/lookup_spec.rb
|
269
266
|
- spec/valvat/syntax_spec.rb
|
270
267
|
- 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-3-2
DELETED
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
|