valvat 1.0.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ruby.yml +41 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +15 -0
  6. data/CHANGES.md +27 -1
  7. data/Gemfile +2 -0
  8. data/Guardfile +6 -4
  9. data/README.md +6 -4
  10. data/Rakefile +3 -1
  11. data/certs/yolk.pem +25 -24
  12. data/gemfiles/activemodel-5 +1 -1
  13. data/gemfiles/activemodel-6 +1 -1
  14. data/gemfiles/{activemodel-3-2 → activemodel-7} +2 -2
  15. data/lib/active_model/validations/valvat_validator.rb +65 -32
  16. data/lib/valvat/checksum/at.rb +3 -1
  17. data/lib/valvat/checksum/be.rb +3 -1
  18. data/lib/valvat/checksum/bg.rb +17 -17
  19. data/lib/valvat/checksum/cy.rb +2 -0
  20. data/lib/valvat/checksum/de.rb +5 -3
  21. data/lib/valvat/checksum/dk.rb +3 -1
  22. data/lib/valvat/checksum/ee.rb +2 -0
  23. data/lib/valvat/checksum/es.rb +14 -16
  24. data/lib/valvat/checksum/fi.rb +3 -1
  25. data/lib/valvat/checksum/fr.rb +4 -2
  26. data/lib/valvat/checksum/gb.rb +46 -31
  27. data/lib/valvat/checksum/gr.rb +4 -2
  28. data/lib/valvat/checksum/hr.rb +2 -0
  29. data/lib/valvat/checksum/hu.rb +2 -0
  30. data/lib/valvat/checksum/ie.rb +5 -6
  31. data/lib/valvat/checksum/it.rb +7 -5
  32. data/lib/valvat/checksum/lt.rb +2 -0
  33. data/lib/valvat/checksum/lu.rb +3 -1
  34. data/lib/valvat/checksum/mt.rb +2 -0
  35. data/lib/valvat/checksum/nl.rb +5 -3
  36. data/lib/valvat/checksum/pl.rb +3 -1
  37. data/lib/valvat/checksum/pt.rb +3 -1
  38. data/lib/valvat/checksum/ro.rb +2 -0
  39. data/lib/valvat/checksum/se.rb +5 -3
  40. data/lib/valvat/checksum/si.rb +4 -2
  41. data/lib/valvat/checksum.rb +24 -28
  42. data/lib/valvat/error.rb +8 -2
  43. data/lib/valvat/local.rb +6 -4
  44. data/lib/valvat/locales/de.yml +2 -1
  45. data/lib/valvat/locales/en.yml +2 -1
  46. data/lib/valvat/locales/es.yml +1 -0
  47. data/lib/valvat/locales/fr.yml +1 -0
  48. data/lib/valvat/locales/hu.yml +1 -0
  49. data/lib/valvat/locales/nl.yml +1 -0
  50. data/lib/valvat/locales/pl.yml +1 -0
  51. data/lib/valvat/lookup/fault.rb +29 -21
  52. data/lib/valvat/lookup/request.rb +21 -16
  53. data/lib/valvat/lookup/response.rb +11 -10
  54. data/lib/valvat/lookup.rb +5 -4
  55. data/lib/valvat/syntax.rb +31 -30
  56. data/lib/valvat/utils.rb +12 -9
  57. data/lib/valvat/version.rb +3 -1
  58. data/lib/valvat.rb +4 -2
  59. data/spec/active_model/validations/valvat_validator_spec.rb +99 -93
  60. data/spec/spec_helper.rb +8 -8
  61. data/spec/valvat/checksum/at_spec.rb +6 -4
  62. data/spec/valvat/checksum/be_spec.rb +6 -4
  63. data/spec/valvat/checksum/bg_spec.rb +7 -4
  64. data/spec/valvat/checksum/cy_spec.rb +3 -1
  65. data/spec/valvat/checksum/de_spec.rb +6 -4
  66. data/spec/valvat/checksum/dk_spec.rb +6 -4
  67. data/spec/valvat/checksum/ee_spec.rb +3 -1
  68. data/spec/valvat/checksum/es_spec.rb +7 -4
  69. data/spec/valvat/checksum/fi_spec.rb +6 -4
  70. data/spec/valvat/checksum/fr_spec.rb +6 -4
  71. data/spec/valvat/checksum/gb_spec.rb +4 -2
  72. data/spec/valvat/checksum/gr_spec.rb +6 -4
  73. data/spec/valvat/checksum/hr_spec.rb +3 -1
  74. data/spec/valvat/checksum/hu_spec.rb +3 -1
  75. data/spec/valvat/checksum/ie_spec.rb +8 -6
  76. data/spec/valvat/checksum/it_spec.rb +10 -8
  77. data/spec/valvat/checksum/lt_spec.rb +3 -1
  78. data/spec/valvat/checksum/lu_spec.rb +6 -4
  79. data/spec/valvat/checksum/mt_spec.rb +3 -1
  80. data/spec/valvat/checksum/nl_spec.rb +9 -7
  81. data/spec/valvat/checksum/pl_spec.rb +8 -6
  82. data/spec/valvat/checksum/pt_spec.rb +10 -11
  83. data/spec/valvat/checksum/ro_spec.rb +3 -1
  84. data/spec/valvat/checksum/se_spec.rb +8 -6
  85. data/spec/valvat/checksum/si_spec.rb +10 -8
  86. data/spec/valvat/checksum_spec.rb +24 -9
  87. data/spec/valvat/lookup/fault_spec.rb +34 -0
  88. data/spec/valvat/lookup/request_spec.rb +32 -0
  89. data/spec/valvat/lookup/response_spec.rb +29 -0
  90. data/spec/valvat/lookup_spec.rb +171 -152
  91. data/spec/valvat/syntax_spec.rb +59 -280
  92. data/spec/valvat/utils_spec.rb +64 -47
  93. data/spec/valvat_spec.rb +140 -152
  94. data/valvat.gemspec +17 -17
  95. data.tar.gz.sig +1 -2
  96. metadata +48 -50
  97. metadata.gz.sig +0 -0
  98. data/.travis.yml +0 -47
  99. data/gemfiles/activemodel-4 +0 -7
  100. data/gemfiles/before-ruby21/activemodel-3-2 +0 -8
  101. data/gemfiles/before-ruby21/activemodel-4 +0 -8
  102. data/gemfiles/before-ruby21/standalone +0 -7
  103. data/spec/valvat/lockup/fault_spec.rb +0 -32
  104. data/spec/valvat/lockup/request_spec.rb +0 -15
  105. 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.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
- MIIELDCCApSgAwIBAgIBATANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVzZWJh
14
- c3RpYW4vREM9eW8vREM9bGswHhcNMj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gv3JZ/4H3q6tGPHigLKneRmaXo3e6jna
24
+ RFDxQLXbJgI37qusk4Qyl/iBVSBZ+TABBvA/jPXnHdd29qkuMTXvWLIiBDM6H0+2
25
+ SUabsieR1CqNZs/6YLO7nQHwFudHqzo8OB4+3QIDAQABo3EwbzAJBgNVHRMEAjAA
26
+ MAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUfC99QRDzqEe0tw1Da+XR9u4dmjEwGgYD
27
+ VR0RBBMwEYEPc2ViYXN0aWFuQHlvLmxrMBoGA1UdEgQTMBGBD3NlYmFzdGlhbkB5
28
+ by5sazANBgkqhkiG9w0BAQsFAAOCAYEAwYCyAFFXgYXWgaO8vQEZoQSjp5v6g1v/
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: 2021-01-06 00:00:00.000000000 Z
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: rake
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: rspec
69
+ name: rake
69
70
  requirement: !ruby/object:Gem::Requirement
70
71
  requirements:
71
- - - "~>"
72
+ - - ">="
72
73
  - !ruby/object:Gem::Version
73
- version: '3.0'
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: '3.0'
81
+ version: '0'
81
82
  - !ruby/object:Gem::Dependency
82
- name: activemodel
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
- - ".travis.yml"
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/before-ruby21/activemodel-3-2
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/lockup/fault_spec.rb
206
- - spec/valvat/lockup/request_spec.rb
207
- - spec/valvat/lockup/response_spec.rb
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: 1.9.3
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.0.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/lockup/fault_spec.rb
266
- - spec/valvat/lockup/request_spec.rb
267
- - spec/valvat/lockup/response_spec.rb
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
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activemodel", "~> 4.2"
4
-
5
- gem 'rack', '< 2'
6
-
7
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
- gem "activemodel", "~> 3.2"
5
-
6
- gem 'rack', '< 2'
7
-
8
- gemspec path: "../../"
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
- gem "activemodel", "~> 4.2"
5
-
6
- gem 'rack', '< 2'
7
-
8
- gemspec path: "../../"
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
-
5
- gem 'rack', '< 2'
6
-
7
- gemspec path: "../../"
@@ -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