valvat 0.8.2 → 1.1.0

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.tar.gz.sig +0 -0
  4. data/.github/workflows/ruby.yml +35 -0
  5. data/.gitignore +3 -1
  6. data/.rubocop.yml +15 -0
  7. data/CHANGES.md +45 -1
  8. data/Gemfile +4 -3
  9. data/Guardfile +6 -4
  10. data/README.md +99 -47
  11. data/Rakefile +3 -1
  12. data/certs/yolk.pem +21 -21
  13. data/gemfiles/activemodel-5 +4 -5
  14. data/gemfiles/activemodel-6 +7 -0
  15. data/gemfiles/standalone +3 -5
  16. data/lib/active_model/validations/valvat_validator.rb +70 -22
  17. data/lib/valvat.rb +7 -3
  18. data/lib/valvat/checksum.rb +14 -13
  19. data/lib/valvat/checksum/at.rb +3 -1
  20. data/lib/valvat/checksum/be.rb +3 -1
  21. data/lib/valvat/checksum/bg.rb +17 -17
  22. data/lib/valvat/checksum/cy.rb +2 -0
  23. data/lib/valvat/checksum/de.rb +5 -3
  24. data/lib/valvat/checksum/dk.rb +3 -1
  25. data/lib/valvat/checksum/ee.rb +2 -0
  26. data/lib/valvat/checksum/es.rb +14 -16
  27. data/lib/valvat/checksum/fi.rb +3 -1
  28. data/lib/valvat/checksum/fr.rb +4 -2
  29. data/lib/valvat/checksum/gb.rb +53 -21
  30. data/lib/valvat/checksum/gr.rb +4 -2
  31. data/lib/valvat/checksum/hr.rb +2 -0
  32. data/lib/valvat/checksum/hu.rb +2 -0
  33. data/lib/valvat/checksum/ie.rb +5 -6
  34. data/lib/valvat/checksum/it.rb +6 -4
  35. data/lib/valvat/checksum/lt.rb +2 -0
  36. data/lib/valvat/checksum/lu.rb +3 -1
  37. data/lib/valvat/checksum/mt.rb +2 -0
  38. data/lib/valvat/checksum/nl.rb +9 -2
  39. data/lib/valvat/checksum/pl.rb +3 -1
  40. data/lib/valvat/checksum/pt.rb +3 -1
  41. data/lib/valvat/checksum/ro.rb +2 -0
  42. data/lib/valvat/checksum/se.rb +5 -3
  43. data/lib/valvat/checksum/si.rb +4 -2
  44. data/lib/valvat/error.rb +31 -0
  45. data/lib/valvat/local.rb +8 -5
  46. data/lib/valvat/locales/de.yml +2 -1
  47. data/lib/valvat/locales/en.yml +2 -1
  48. data/lib/valvat/locales/es.yml +1 -0
  49. data/lib/valvat/locales/fr.yml +18 -17
  50. data/lib/valvat/locales/hu.yml +1 -0
  51. data/lib/valvat/locales/nl.yml +1 -0
  52. data/lib/valvat/locales/pl.yml +1 -0
  53. data/lib/valvat/locales/pt.yml +28 -28
  54. data/lib/valvat/lookup.rb +14 -45
  55. data/lib/valvat/lookup/fault.rb +31 -0
  56. data/lib/valvat/lookup/request.rb +37 -11
  57. data/lib/valvat/lookup/response.rb +37 -0
  58. data/lib/valvat/syntax.rb +31 -30
  59. data/lib/valvat/utils.rb +20 -9
  60. data/lib/valvat/version.rb +3 -1
  61. data/spec/active_model/validations/valvat_validator_spec.rb +132 -100
  62. data/spec/spec_helper.rb +8 -8
  63. data/spec/valvat/checksum/at_spec.rb +8 -6
  64. data/spec/valvat/checksum/be_spec.rb +8 -6
  65. data/spec/valvat/checksum/bg_spec.rb +9 -6
  66. data/spec/valvat/checksum/cy_spec.rb +5 -3
  67. data/spec/valvat/checksum/de_spec.rb +8 -6
  68. data/spec/valvat/checksum/dk_spec.rb +8 -6
  69. data/spec/valvat/checksum/ee_spec.rb +5 -3
  70. data/spec/valvat/checksum/es_spec.rb +9 -6
  71. data/spec/valvat/checksum/fi_spec.rb +8 -6
  72. data/spec/valvat/checksum/fr_spec.rb +8 -6
  73. data/spec/valvat/checksum/gb_spec.rb +9 -5
  74. data/spec/valvat/checksum/gr_spec.rb +8 -6
  75. data/spec/valvat/checksum/hr_spec.rb +5 -3
  76. data/spec/valvat/checksum/hu_spec.rb +5 -3
  77. data/spec/valvat/checksum/ie_spec.rb +13 -5
  78. data/spec/valvat/checksum/it_spec.rb +12 -10
  79. data/spec/valvat/checksum/lt_spec.rb +5 -3
  80. data/spec/valvat/checksum/lu_spec.rb +8 -6
  81. data/spec/valvat/checksum/mt_spec.rb +5 -3
  82. data/spec/valvat/checksum/nl_spec.rb +9 -7
  83. data/spec/valvat/checksum/pl_spec.rb +10 -8
  84. data/spec/valvat/checksum/pt_spec.rb +12 -13
  85. data/spec/valvat/checksum/ro_spec.rb +5 -3
  86. data/spec/valvat/checksum/se_spec.rb +10 -8
  87. data/spec/valvat/checksum/si_spec.rb +12 -10
  88. data/spec/valvat/checksum_spec.rb +12 -10
  89. data/spec/valvat/lookup/fault_spec.rb +34 -0
  90. data/spec/valvat/lookup/request_spec.rb +19 -0
  91. data/spec/valvat/lookup/response_spec.rb +29 -0
  92. data/spec/valvat/lookup_spec.rb +202 -84
  93. data/spec/valvat/syntax_spec.rb +59 -280
  94. data/spec/valvat/utils_spec.rb +76 -42
  95. data/spec/valvat_spec.rb +140 -152
  96. data/valvat.gemspec +18 -17
  97. metadata +61 -41
  98. metadata.gz.sig +0 -0
  99. data/.travis.yml +0 -33
  100. data/gemfiles/activemodel-3-2 +0 -8
  101. data/gemfiles/activemodel-4 +0 -8
  102. data/gemfiles/before-ruby21/activemodel-3-2 +0 -9
  103. data/gemfiles/before-ruby21/activemodel-4 +0 -9
  104. data/gemfiles/before-ruby21/standalone +0 -8
  105. data/lib/valvat/lookup/request_with_id.rb +0 -31
metadata CHANGED
@@ -1,40 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valvat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIELDCCApSgAwIBAgIBATANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVzZWJh
14
- c3RpYW4vREM9eW8vREM9bGswHhcNMTkxMTE1MTIzM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a/HeBoU0s1Q==
27
+ KoZIhvcNAQELBQADggGBAIky67U9hnB8d4qMKwXHGb3Ne7JLvEigtEhjqGlDVecb
28
+ C94vQ8Jg7lYB3kKVjvFN2drptq/JUpxmAxPQIqfx39gKcKyv0BjkroVFE8MS1324
29
+ khMOZFOoSPMd9pkpm7oJ1M+sCYcUM+tPKnU8Ojq6r9j5b5XrbxG8YSpwahva3Vap
30
+ 1g0+3KzuWPpFjFen1VbS/Sb1cyE5uQtUj7lVcdhF3EFvzXkUMUUtJ4xsk114znFO
31
+ 986sKab5AjlJ7TnsmPphCv/UXans7rAVB2lnozlt/kw6dcct5JD4kz1tD6AmO5Qd
32
+ jWRuKNZs66GBglRvseKoypXz1XDCCu1m/uI1IGmKnq8Ry+IeRq9RnlvbfPvSxRIx
33
+ 9aowoL79T9plhcEcEX/KYRp8ht1z+3Vyk2UVZP8Xl5x+K44co5xdhljYi1gtw0w8
34
+ KzzULF0bF9oNpXwBEamlH2myNb19u1W8ijobQ7Y19ca8UFHr5LI32ZW5Zlmep8je
35
+ vb+o07oLRx3t2T/EO4DZ1w==
36
36
  -----END CERTIFICATE-----
37
- date: 2019-11-15 00:00:00.000000000 Z
37
+ date: 2021-01-15 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: savon
@@ -51,31 +51,45 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.3.0
53
53
  - !ruby/object:Gem::Dependency
54
- name: rspec
54
+ name: activemodel
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '3.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: '3.0'
66
+ version: '5.0'
67
67
  - !ruby/object:Gem::Dependency
68
- name: activemodel
68
+ name: rake
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: '3.0'
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
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '3.0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
79
93
  - !ruby/object:Gem::Version
80
94
  version: '3.0'
81
95
  description: Validates european vat numbers. Standalone or as a ActiveModel validator.
@@ -86,8 +100,9 @@ extensions: []
86
100
  extra_rdoc_files: []
87
101
  files:
88
102
  - ".editorconfig"
103
+ - ".github/workflows/ruby.yml"
89
104
  - ".gitignore"
90
- - ".travis.yml"
105
+ - ".rubocop.yml"
91
106
  - CHANGES.md
92
107
  - Gemfile
93
108
  - Guardfile
@@ -95,12 +110,8 @@ files:
95
110
  - README.md
96
111
  - Rakefile
97
112
  - certs/yolk.pem
98
- - gemfiles/activemodel-3-2
99
- - gemfiles/activemodel-4
100
113
  - gemfiles/activemodel-5
101
- - gemfiles/before-ruby21/activemodel-3-2
102
- - gemfiles/before-ruby21/activemodel-4
103
- - gemfiles/before-ruby21/standalone
114
+ - gemfiles/activemodel-6
104
115
  - gemfiles/standalone
105
116
  - lib/active_model/validations/valvat_validator.rb
106
117
  - lib/valvat.rb
@@ -130,6 +141,7 @@ files:
130
141
  - lib/valvat/checksum/ro.rb
131
142
  - lib/valvat/checksum/se.rb
132
143
  - lib/valvat/checksum/si.rb
144
+ - lib/valvat/error.rb
133
145
  - lib/valvat/local.rb
134
146
  - lib/valvat/locales/bg.yml
135
147
  - lib/valvat/locales/ca.yml
@@ -152,8 +164,9 @@ files:
152
164
  - lib/valvat/locales/sv.yml
153
165
  - lib/valvat/locales/tr.yml
154
166
  - lib/valvat/lookup.rb
167
+ - lib/valvat/lookup/fault.rb
155
168
  - lib/valvat/lookup/request.rb
156
- - lib/valvat/lookup/request_with_id.rb
169
+ - lib/valvat/lookup/response.rb
157
170
  - lib/valvat/syntax.rb
158
171
  - lib/valvat/utils.rb
159
172
  - lib/valvat/version.rb
@@ -185,6 +198,9 @@ files:
185
198
  - spec/valvat/checksum/se_spec.rb
186
199
  - spec/valvat/checksum/si_spec.rb
187
200
  - spec/valvat/checksum_spec.rb
201
+ - spec/valvat/lookup/fault_spec.rb
202
+ - spec/valvat/lookup/request_spec.rb
203
+ - spec/valvat/lookup/response_spec.rb
188
204
  - spec/valvat/lookup_spec.rb
189
205
  - spec/valvat/syntax_spec.rb
190
206
  - spec/valvat/utils_spec.rb
@@ -194,7 +210,7 @@ homepage: https://github.com/yolk/valvat
194
210
  licenses:
195
211
  - MIT
196
212
  metadata: {}
197
- post_install_message:
213
+ post_install_message:
198
214
  rdoc_options: []
199
215
  require_paths:
200
216
  - lib
@@ -202,15 +218,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
218
  requirements:
203
219
  - - ">="
204
220
  - !ruby/object:Gem::Version
205
- version: 1.9.3
221
+ version: 2.5.0
206
222
  required_rubygems_version: !ruby/object:Gem::Requirement
207
223
  requirements:
208
224
  - - ">="
209
225
  - !ruby/object:Gem::Version
210
226
  version: '0'
211
227
  requirements: []
212
- rubygems_version: 3.0.3
213
- signing_key:
228
+ rubyforge_project:
229
+ rubygems_version: 2.7.6.2
230
+ signing_key:
214
231
  specification_version: 4
215
232
  summary: Validates european vat numbers. Standalone or as a ActiveModel validator.
216
233
  test_files:
@@ -242,6 +259,9 @@ test_files:
242
259
  - spec/valvat/checksum/se_spec.rb
243
260
  - spec/valvat/checksum/si_spec.rb
244
261
  - spec/valvat/checksum_spec.rb
262
+ - spec/valvat/lookup/fault_spec.rb
263
+ - spec/valvat/lookup/request_spec.rb
264
+ - spec/valvat/lookup/response_spec.rb
245
265
  - spec/valvat/lookup_spec.rb
246
266
  - spec/valvat/syntax_spec.rb
247
267
  - spec/valvat/utils_spec.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,33 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- - 2.5
5
- - 2.4
6
- - 2.3
7
- - 2.2
8
- - 2.1
9
- - jruby-19mode
10
- gemfile:
11
- - gemfiles/activemodel-5
12
- - gemfiles/activemodel-4
13
- - gemfiles/activemodel-3-2
14
- - gemfiles/standalone
15
- matrix:
16
- exclude:
17
- - rvm: 2.1
18
- gemfile: gemfiles/activemodel-5
19
- - rvm: jruby-19mode
20
- gemfile: gemfiles/activemodel-5
21
- include:
22
- - rvm: 2.0
23
- gemfile: gemfiles/before-ruby21/activemodel-4
24
- - rvm: 2.0
25
- gemfile: gemfiles/before-ruby21/activemodel-3-2
26
- - rvm: 2.0
27
- gemfile: gemfiles/before-ruby21/standalone
28
- - rvm: 1.9.3
29
- gemfile: gemfiles/before-ruby21/activemodel-4
30
- - rvm: 1.9.3
31
- gemfile: gemfiles/before-ruby21/activemodel-3-2
32
- - rvm: 1.9.3
33
- gemfile: gemfiles/before-ruby21/standalone
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "savon", ">=2.3.0"
4
- gem "activemodel", "~> 3.2"
5
-
6
- gem 'rspec', '~> 3.0'
7
- gem 'rack', '< 2'
8
- gem 'rake'
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "savon", ">=2.3.0"
4
- gem "activemodel", "~> 4.2"
5
-
6
- gem 'rspec', '~> 3.0'
7
- gem 'rack', '< 2'
8
- gem 'rake'
@@ -1,9 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
- gem "savon", ">=2.3.0"
5
- gem "activemodel", "~> 3.2"
6
-
7
- gem 'rspec', '~> 3.0'
8
- gem 'rack', '< 2'
9
- gem 'rake'
@@ -1,9 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
- gem "savon", ">=2.3.0"
5
- gem "activemodel", "~> 4.2"
6
-
7
- gem 'rspec', '~> 3.0'
8
- gem 'rack', '< 2'
9
- gem 'rake'
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "nokogiri", "< 1.7"
4
- gem "savon", ">=2.3.0"
5
-
6
- gem 'rspec', '~> 3.0'
7
- gem 'rack', '< 2'
8
- gem 'rake'
@@ -1,31 +0,0 @@
1
- class Valvat
2
- class Lookup
3
- class RequestWithId < Request
4
- def initialize(vat, requester_vat)
5
- @vat = vat
6
- @requester_vat = requester_vat
7
- end
8
-
9
- private
10
-
11
- def body
12
- super.merge(
13
- :requester_country_code => @requester_vat.vat_country_code,
14
- :requester_vat_number => @requester_vat.to_s_wo_country
15
- )
16
- end
17
-
18
- def message_tag
19
- :checkVatApprox
20
- end
21
-
22
- def action
23
- :check_vat_approx
24
- end
25
-
26
- def response_key
27
- :check_vat_approx_response
28
- end
29
- end
30
- end
31
- end