valvat 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.md +7 -1
- data/lib/valvat.rb +9 -9
- data/lib/valvat/active_model.rb +10 -10
- data/lib/valvat/lookup.rb +3 -3
- data/lib/valvat/syntax.rb +2 -2
- data/lib/valvat/utils.rb +7 -7
- data/lib/valvat/version.rb +1 -1
- data/spec/spec_helper.rb +4 -4
- data/spec/valvat/active_model_spec.rb +31 -31
- data/spec/valvat/lookup_spec.rb +8 -8
- data/spec/valvat/syntax_spec.rb +7 -7
- data/spec/valvat/utils_spec.rb +12 -12
- data/spec/valvat_spec.rb +49 -44
- data/valvat.gemspec +6 -6
- metadata +80 -115
data/CHANGES.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
-
[full changelog](http://github.com/yolk/valvat/compare/v0.3.
|
3
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.3.4...master)
|
4
|
+
|
5
|
+
### 0.3.4 / 2011-08-01
|
6
|
+
|
7
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.3,3...v0.3.4)
|
8
|
+
|
9
|
+
* Normalize all input on initialization (by [SpoBo](https://github.com/SpoBo))
|
4
10
|
|
5
11
|
### 0.3.3 / 2011-06-02
|
6
12
|
|
data/lib/valvat.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
class Valvat
|
2
2
|
def initialize(raw)
|
3
|
-
@raw = raw || ""
|
3
|
+
@raw = Valvat::Utils.normalize(raw || "")
|
4
4
|
@vat_country_code, @to_s_wo_country = to_a
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
attr_reader :raw, :vat_country_code, :to_s_wo_country
|
8
|
-
|
8
|
+
|
9
9
|
def valid?
|
10
10
|
Valvat::Syntax.validate(self)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def exists?
|
14
14
|
Valvat::Lookup.validate(self)
|
15
15
|
end
|
16
16
|
alias_method :exist?, :exists?
|
17
|
-
|
17
|
+
|
18
18
|
def iso_country_code
|
19
19
|
Valvat::Utils.vat_country_to_iso_country(vat_country_code)
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def european?
|
23
23
|
Valvat::Utils::EU_COUNTRIES.include?(iso_country_code)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def to_a
|
27
27
|
Valvat::Utils.split(raw)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def to_s
|
31
31
|
raw
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def inspect
|
35
35
|
"#<Valvat #{[raw, iso_country_code].compact.join(" ")}>"
|
36
36
|
end
|
data/lib/valvat/active_model.rb
CHANGED
@@ -5,31 +5,31 @@ require 'valvat/lookup'
|
|
5
5
|
module ActiveModel
|
6
6
|
module Validations
|
7
7
|
class ValvatValidator < ::ActiveModel::EachValidator
|
8
|
-
|
8
|
+
|
9
9
|
def validate_each(record, attribute, value)
|
10
10
|
vat = Valvat(value)
|
11
11
|
iso_country_code = vat.iso_country_code
|
12
12
|
is_valid = true
|
13
|
-
|
13
|
+
|
14
14
|
if options[:match_country]
|
15
15
|
iso_country_code = (record.send(options[:match_country]) || "").upcase
|
16
16
|
is_valid = iso_country_code == vat.iso_country_code
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
if is_valid
|
20
20
|
is_valid = options[:lookup] ? vat.valid? && vat.exists? : vat.valid?
|
21
|
-
|
21
|
+
|
22
22
|
if is_valid.nil?
|
23
23
|
is_valid = options[:lookup] != :fail_if_down
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
unless is_valid
|
28
|
-
iso_country_code = "eu" if iso_country_code.blank?
|
29
|
-
record.errors.add(attribute, :invalid_vat,
|
30
|
-
:message => options[:message],
|
28
|
+
iso_country_code = "eu" if iso_country_code.blank?
|
29
|
+
record.errors.add(attribute, :invalid_vat,
|
30
|
+
:message => options[:message],
|
31
31
|
:country_adjective => I18n.t(
|
32
|
-
:"valvat.country_adjectives.#{iso_country_code.downcase}",
|
32
|
+
:"valvat.country_adjectives.#{iso_country_code.downcase}",
|
33
33
|
:default => [:"valvat.country_adjectives.eu", "european"]
|
34
34
|
)
|
35
35
|
)
|
@@ -41,4 +41,4 @@ end
|
|
41
41
|
|
42
42
|
%w(en de).each do |locale|
|
43
43
|
I18n.load_path << "#{File.dirname(__FILE__)}/locales/#{locale}.yml"
|
44
|
-
end
|
44
|
+
end
|
data/lib/valvat/lookup.rb
CHANGED
@@ -4,11 +4,11 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
class Valvat
|
6
6
|
module Lookup
|
7
|
-
|
7
|
+
|
8
8
|
def self.validate(vat)
|
9
9
|
vat = Valvat(vat)
|
10
10
|
return false unless vat.european?
|
11
|
-
|
11
|
+
|
12
12
|
begin
|
13
13
|
client.request("n1", "checkVat") do
|
14
14
|
soap.body = {"n1:countryCode" => vat.vat_country_code, "n1:vatNumber" => vat.to_s_wo_country}
|
@@ -37,4 +37,4 @@ class Valvat
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
data/lib/valvat/syntax.rb
CHANGED
data/lib/valvat/utils.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
class Valvat
|
2
2
|
module Utils
|
3
|
-
|
3
|
+
|
4
4
|
EU_COUNTRIES = %w(AT BE BG CY CZ DE DK EE ES FI FR GB GR HU IE IT LT LU LV MT NL PL PT RO SE SI SK)
|
5
5
|
COUNTRY_PATTERN = /\A([A-Z]{2})(.+)\Z/
|
6
6
|
NORMALIZE_PATTERN = /[-\.:_\s,;]+/
|
7
|
-
|
7
|
+
|
8
8
|
def self.split(vat)
|
9
|
-
COUNTRY_PATTERN =~ vat
|
9
|
+
COUNTRY_PATTERN =~ vat
|
10
10
|
result = [$1, $2]
|
11
11
|
iso_country = vat_country_to_iso_country(result[0])
|
12
12
|
EU_COUNTRIES.include?(iso_country) ? result : [nil, nil]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def self.normalize(vat)
|
16
16
|
vat.upcase.gsub(NORMALIZE_PATTERN, "")
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def self.vat_country_to_iso_country(vat_country)
|
20
20
|
vat_country == "EL" ? "GR" : vat_country
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def self.iso_country_to_vat_country(iso_country)
|
24
24
|
iso_country == "GR" ? "EL" : iso_country
|
25
25
|
end
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/lib/valvat/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -9,13 +9,13 @@ $fakeweb = true
|
|
9
9
|
class ModelBase
|
10
10
|
include ActiveModel::Serialization
|
11
11
|
include ActiveModel::Validations
|
12
|
-
|
12
|
+
|
13
13
|
attr_accessor :attributes
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(attributes = {})
|
16
16
|
@attributes = attributes
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def read_attribute_for_validation(key)
|
20
20
|
@attributes[key]
|
21
21
|
end
|
@@ -29,4 +29,4 @@ def without_any_web_requests!
|
|
29
29
|
after(:all) do
|
30
30
|
FakeWeb.allow_net_connect = true
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
class Invoice < ModelBase
|
3
|
+
class Invoice < ModelBase
|
4
4
|
validates :vat_number, :valvat => true
|
5
5
|
end
|
6
6
|
|
7
|
-
class InvoiceWithLookup < ModelBase
|
7
|
+
class InvoiceWithLookup < ModelBase
|
8
8
|
validates :vat_number, :valvat => {:lookup => true}
|
9
9
|
end
|
10
10
|
|
11
|
-
class InvoiceWithLookupAndFailIfDown < ModelBase
|
11
|
+
class InvoiceWithLookupAndFailIfDown < ModelBase
|
12
12
|
validates :vat_number, :valvat => {:lookup => :fail_if_down}
|
13
13
|
end
|
14
14
|
|
15
|
-
class InvoiceAllowBlank < ModelBase
|
15
|
+
class InvoiceAllowBlank < ModelBase
|
16
16
|
validates :vat_number, :valvat => {:allow_blank => true}
|
17
17
|
end
|
18
18
|
|
19
|
-
class InvoiceAllowBlankOnAll < ModelBase
|
19
|
+
class InvoiceAllowBlankOnAll < ModelBase
|
20
20
|
validates :vat_number, :valvat => true, :allow_blank => true
|
21
21
|
end
|
22
22
|
|
23
|
-
class InvoiceCheckCountry < ModelBase
|
23
|
+
class InvoiceCheckCountry < ModelBase
|
24
24
|
validates :vat_number, :valvat => {:match_country => :country}
|
25
|
-
|
25
|
+
|
26
26
|
def country
|
27
27
|
@attributes[:country]
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
class InvoiceCheckCountryWithLookup < ModelBase
|
31
|
+
class InvoiceCheckCountryWithLookup < ModelBase
|
32
32
|
validates :vat_number, :valvat => {:match_country => :country, :lookup => true}
|
33
|
-
|
33
|
+
|
34
34
|
def country
|
35
35
|
@attributes[:country]
|
36
36
|
end
|
@@ -42,34 +42,34 @@ describe Invoice do
|
|
42
42
|
Invoice.new(:vat_number => "DE259597697").should be_valid
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
context "with invalid vat number" do
|
47
47
|
let(:invoice) { Invoice.new(:vat_number => "DE259597697123") }
|
48
|
-
|
48
|
+
|
49
49
|
it "should not be valid" do
|
50
50
|
invoice.should_not be_valid
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "should add default (country specific) error message" do
|
54
54
|
invoice.valid?
|
55
55
|
invoice.errors[:vat_number].should eql(["is not a valid German vat number"])
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
context "with i18n translation in place" do
|
59
59
|
before do
|
60
60
|
I18n.backend.store_translations(:en, :activemodel => {
|
61
61
|
:errors => {:models => {:invoice => {:invalid_vat => "is ugly."}}}
|
62
62
|
})
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
after { I18n.reload! }
|
66
|
-
|
66
|
+
|
67
67
|
it "should use translation" do
|
68
68
|
invoice.valid?
|
69
69
|
invoice.errors[:vat_number].should eql(["is ugly."])
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
context "with i18n translation with country adjective placeholder in place" do
|
74
74
|
before do
|
75
75
|
I18n.backend.store_translations(:en, :activemodel => {
|
@@ -92,7 +92,7 @@ describe Invoice do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
context "with blank vat number" do
|
97
97
|
it "should not be valid" do
|
98
98
|
Invoice.new(:vat_number => "").should_not be_valid
|
@@ -107,29 +107,29 @@ describe InvoiceWithLookup do
|
|
107
107
|
Valvat::Syntax.stub(:validate => true)
|
108
108
|
Valvat::Lookup.stub(:validate => false)
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
it "should not be valid" do
|
112
112
|
InvoiceWithLookup.new(:vat_number => "DE123").should_not be_valid
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
context "with valid and existing vat number" do
|
117
117
|
before do
|
118
118
|
Valvat::Syntax.stub(:validate => true)
|
119
119
|
Valvat::Lookup.stub(:validate => true)
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
it "should be valid" do
|
123
123
|
InvoiceWithLookup.new(:vat_number => "DE123").should be_valid
|
124
124
|
end
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
context "with valid vat number and VIES country service down" do
|
128
128
|
before do
|
129
129
|
Valvat::Syntax.stub(:validate => true)
|
130
130
|
Valvat::Lookup.stub(:validate => nil)
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
it "should be valid" do
|
134
134
|
InvoiceWithLookup.new(:vat_number => "DE123").should be_valid
|
135
135
|
end
|
@@ -142,7 +142,7 @@ describe InvoiceWithLookupAndFailIfDown do
|
|
142
142
|
Valvat::Syntax.stub(:validate => true)
|
143
143
|
Valvat::Lookup.stub(:validate => nil)
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
it "should not be valid" do
|
147
147
|
InvoiceWithLookupAndFailIfDown.new(:vat_number => "DE123").should_not be_valid
|
148
148
|
end
|
@@ -172,29 +172,29 @@ describe InvoiceCheckCountry do
|
|
172
172
|
InvoiceCheckCountry.new(:country => nil, :vat_number => "DE259597697").should_not be_valid
|
173
173
|
InvoiceCheckCountry.new(:country => "", :vat_number => "DE259597697").should_not be_valid
|
174
174
|
end
|
175
|
-
|
175
|
+
|
176
176
|
it "should be not valid on wired country" do
|
177
177
|
InvoiceCheckCountry.new(:country => "XAXXX", :vat_number => "DE259597697").should_not be_valid
|
178
178
|
InvoiceCheckCountry.new(:country => "ZO", :vat_number => "DE259597697").should_not be_valid
|
179
179
|
end
|
180
|
-
|
180
|
+
|
181
181
|
it "should be not valid on mismatching (eu) country" do
|
182
182
|
InvoiceCheckCountry.new(:country => "FR", :vat_number => "DE259597697").should_not be_valid
|
183
183
|
InvoiceCheckCountry.new(:country => "AT", :vat_number => "DE259597697").should_not be_valid
|
184
184
|
InvoiceCheckCountry.new(:country => "DE", :vat_number => "ATU65931334").should_not be_valid
|
185
185
|
end
|
186
|
-
|
186
|
+
|
187
187
|
it "should be valid on matching country" do
|
188
188
|
InvoiceCheckCountry.new(:country => "DE", :vat_number => "DE259597697").should be_valid
|
189
189
|
InvoiceCheckCountry.new(:country => "AT", :vat_number => "ATU65931334").should be_valid
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
it "should give back error message with country from :country_match" do
|
193
193
|
invoice = InvoiceCheckCountry.new(:country => "FR", :vat_number => "DE259597697")
|
194
194
|
invoice.valid?
|
195
195
|
invoice.errors[:vat_number].should eql(["is not a valid French vat number"])
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
it "should give back error message with country from :country_match even on invalid vat number" do
|
199
199
|
invoice = InvoiceCheckCountry.new(:country => "FR", :vat_number => "DE259597697123")
|
200
200
|
invoice.valid?
|
@@ -207,16 +207,16 @@ describe InvoiceCheckCountryWithLookup do
|
|
207
207
|
Valvat::Syntax.stub(:validate => true)
|
208
208
|
Valvat::Lookup.stub(:validate => true)
|
209
209
|
end
|
210
|
-
|
210
|
+
|
211
211
|
it "avoids lookup or syntax check on failed because of mismatching country" do
|
212
212
|
Valvat::Syntax.should_not_receive(:validate)
|
213
213
|
Valvat::Lookup.should_not_receive(:validate)
|
214
214
|
InvoiceCheckCountryWithLookup.new(:country => "FR", :vat_number => "DE259597697").valid?
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
it "check syntax and looup on matching country" do
|
218
218
|
Valvat::Syntax.should_receive(:validate).and_return(true)
|
219
219
|
Valvat::Lookup.should_receive(:validate).and_return(true)
|
220
220
|
InvoiceCheckCountryWithLookup.new(:country => "DE", :vat_number => "DE259597697").valid?
|
221
221
|
end
|
222
|
-
end
|
222
|
+
end
|
data/spec/valvat/lookup_spec.rb
CHANGED
@@ -3,41 +3,41 @@ require 'spec_helper'
|
|
3
3
|
describe Valvat::Lookup do
|
4
4
|
context "#validate" do
|
5
5
|
context "existing vat number" do
|
6
|
-
|
6
|
+
|
7
7
|
it "returns true" do
|
8
8
|
Valvat::Lookup.validate("BE0817331995").should eql(true)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
it "allows Valvat instance as input" do
|
12
12
|
Valvat::Lookup.validate(Valvat.new("BE0817331995")).should eql(true)
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
context "not existing vat number" do
|
17
17
|
it "returns false" do
|
18
18
|
Valvat::Lookup.validate("BE08173319921").should eql(false)
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
context "invalid country code / input" do
|
23
23
|
without_any_web_requests!
|
24
|
-
|
24
|
+
|
25
25
|
it "returns false" do
|
26
26
|
Valvat::Lookup.validate("AE259597697").should eql(false)
|
27
27
|
Valvat::Lookup.validate("").should eql(false)
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
# TODO : Reactivate with coorect "down" response
|
32
32
|
# context "country web service down" do
|
33
33
|
# before do
|
34
34
|
# json = "{\"error_message\": \"Member State service unavailable.\", \"error_code\": 1, \"error\": true}"
|
35
35
|
# FakeWeb.register_uri(:get, "http://isvat.appspot.com/DE/259597697/", :body => json)
|
36
36
|
# end if $fakeweb
|
37
|
-
#
|
37
|
+
#
|
38
38
|
# it "returns nil" do
|
39
39
|
# Valvat::Lookup.validate("DE259597697").should eql(nil)
|
40
40
|
# end
|
41
41
|
# end
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
data/spec/valvat/syntax_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Valvat::Syntax do
|
|
4
4
|
context "#validate" do
|
5
5
|
it "validates a DE vat number" do
|
6
6
|
Valvat::Syntax.validate("DE345889003").should eql(true)
|
7
|
-
|
7
|
+
|
8
8
|
Valvat::Syntax.validate("DE34588900").should eql(false)
|
9
9
|
Valvat::Syntax.validate("DE3458890090").should eql(false)
|
10
10
|
Valvat::Syntax.validate("DE34588900C").should eql(false)
|
@@ -12,7 +12,7 @@ describe Valvat::Syntax do
|
|
12
12
|
|
13
13
|
it "validates a AT vat number" do
|
14
14
|
Valvat::Syntax.validate("ATU03458890").should eql(true)
|
15
|
-
|
15
|
+
|
16
16
|
Valvat::Syntax.validate("ATU034588908").should eql(false)
|
17
17
|
Valvat::Syntax.validate("ATU0345908").should eql(false)
|
18
18
|
Valvat::Syntax.validate("ATU0345889Y").should eql(false)
|
@@ -20,7 +20,7 @@ describe Valvat::Syntax do
|
|
20
20
|
|
21
21
|
it "should validate BE vat number" do
|
22
22
|
Valvat::Syntax.validate("BE0817331995").should eql(true)
|
23
|
-
|
23
|
+
|
24
24
|
Valvat::Syntax.validate("BE081733199").should eql(false)
|
25
25
|
Valvat::Syntax.validate("BE08173319944").should eql(false)
|
26
26
|
Valvat::Syntax.validate("BE081733199H").should eql(false)
|
@@ -228,14 +228,14 @@ describe Valvat::Syntax do
|
|
228
228
|
|
229
229
|
it "validates a SK vat number" do
|
230
230
|
Valvat::Syntax.validate("SK5683075682").should eql(true)
|
231
|
-
|
231
|
+
|
232
232
|
Valvat::Syntax.validate("SK56830756821").should eql(false)
|
233
233
|
Valvat::Syntax.validate("SK568307568").should eql(false)
|
234
234
|
end
|
235
235
|
|
236
236
|
it "validates a SI vat number" do
|
237
237
|
Valvat::Syntax.validate("SI74357893").should eql(true)
|
238
|
-
|
238
|
+
|
239
239
|
Valvat::Syntax.validate("SI743578931").should eql(false)
|
240
240
|
Valvat::Syntax.validate("SI7435789").should eql(false)
|
241
241
|
end
|
@@ -266,10 +266,10 @@ describe Valvat::Syntax do
|
|
266
266
|
Valvat::Syntax.validate("xxxxxxxxxx").should eql(false)
|
267
267
|
Valvat::Syntax.validate("BEFR").should eql(false)
|
268
268
|
end
|
269
|
-
|
269
|
+
|
270
270
|
it "allows Valvat instance as input" do
|
271
271
|
Valvat::Syntax.validate(Valvat.new("DE345889003")).should eql(true)
|
272
272
|
Valvat::Syntax.validate(Valvat.new("DE34588900X")).should eql(false)
|
273
273
|
end
|
274
274
|
end
|
275
|
-
end
|
275
|
+
end
|
data/spec/valvat/utils_spec.rb
CHANGED
@@ -6,12 +6,12 @@ describe Valvat::Utils do
|
|
6
6
|
Valvat::Utils.split("DE345889003").should eql(["DE", "345889003"])
|
7
7
|
Valvat::Utils.split("ESX4588900X").should eql(["ES", "X4588900X"])
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "returns two nils on non-european iso codes as array" do
|
11
11
|
Valvat::Utils.split("US345889003").should eql([nil, nil])
|
12
12
|
Valvat::Utils.split("RUX4588900X").should eql([nil, nil])
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it "returns two nils on non-sense input as array" do
|
16
16
|
Valvat::Utils.split("DE").should eql([nil, nil])
|
17
17
|
Valvat::Utils.split("X345889003").should eql([nil, nil])
|
@@ -19,51 +19,51 @@ describe Valvat::Utils do
|
|
19
19
|
Valvat::Utils.split("1234").should eql([nil, nil])
|
20
20
|
Valvat::Utils.split(" ").should eql([nil, nil])
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "returns EL (language iso code) on greek vat" do
|
24
24
|
Valvat::Utils.split("EL999999999").should eql(["EL", "999999999"])
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
context "#normalize" do
|
29
29
|
it "returns vat number with upcase chars" do
|
30
30
|
Valvat::Utils.normalize("de345889003").should eql("DE345889003")
|
31
31
|
Valvat::Utils.normalize("EsX4588900y").should eql("ESX4588900Y")
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "returns trimmed vat number" do
|
35
35
|
Valvat::Utils.normalize(" DE345889003").should eql("DE345889003")
|
36
36
|
Valvat::Utils.normalize(" DE345889003 ").should eql("DE345889003")
|
37
37
|
Valvat::Utils.normalize("DE345889003 ").should eql("DE345889003")
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "does not change already normalized vat numbers" do
|
41
41
|
Valvat::Utils.normalize("DE345889003").should eql("DE345889003")
|
42
42
|
Valvat::Utils.normalize("ESX4588900X").should eql("ESX4588900X")
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "removes spaces" do
|
46
46
|
Valvat::Utils.normalize("DE 345889003").should eql("DE345889003")
|
47
47
|
Valvat::Utils.normalize("ESX 458 8900 X").should eql("ESX4588900X")
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "removes special chars" do
|
51
51
|
Valvat::Utils.normalize("DE.345-889_00:3,;").should eql("DE345889003")
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
context "#vat_country_to_iso_country" do
|
56
56
|
it "returns iso country code on greek iso language 'EL'" do
|
57
57
|
Valvat::Utils.vat_country_to_iso_country("EL").should eql("GR")
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
Valvat::Utils::EU_COUNTRIES.each do |iso|
|
61
61
|
it "returns unchanged iso country code '#{iso}'" do
|
62
62
|
Valvat::Utils.vat_country_to_iso_country(iso).should eql(iso)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
context "#iso_country_to_vat_country" do
|
68
68
|
it "returns vat country on greek iso country code 'GR'" do
|
69
69
|
Valvat::Utils.iso_country_to_vat_country("GR").should eql("EL")
|
@@ -75,4 +75,4 @@ describe Valvat::Utils do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
-
end
|
78
|
+
end
|
data/spec/valvat_spec.rb
CHANGED
@@ -9,42 +9,47 @@ describe Valvat do
|
|
9
9
|
lambda{ Valvat.new("a", "b") }.should raise_error(ArgumentError)
|
10
10
|
lambda{ Valvat.new("a") }.should_not raise_error
|
11
11
|
end
|
12
|
+
|
13
|
+
it "normalizes input string" do
|
14
|
+
Valvat.new("de25.9597,69 7").to_s.should eql("DE259597697")
|
15
|
+
Valvat.new("de25.9597,69 7").iso_country_code.should eql("DE")
|
16
|
+
end
|
12
17
|
end
|
13
|
-
|
18
|
+
|
14
19
|
context "Valvat()" do
|
15
20
|
it "initializes new Valvat instance on string" do
|
16
21
|
Valvat("abc").should be_kind_of(Valvat)
|
17
22
|
end
|
18
|
-
|
23
|
+
|
19
24
|
it "returns same Valvat instance on Valvat instance" do
|
20
25
|
vat = Valvat.new("abc")
|
21
26
|
Valvat(vat).should be_kind_of(Valvat)
|
22
27
|
Valvat(vat).object_id.should eql(vat.object_id)
|
23
28
|
end
|
24
29
|
end
|
25
|
-
|
30
|
+
|
26
31
|
context "on european vat number" do
|
27
32
|
let(:de_vat) { Valvat.new("DE259597697") } # valid & exists
|
28
33
|
let(:at_vat) { Valvat.new("ATU458890031") } # invalid
|
29
34
|
let(:gr_vat) { Valvat.new("EL999943280") } # valid & exists
|
30
|
-
|
35
|
+
|
31
36
|
context "#valid?" do
|
32
37
|
it "returns true on valid numbers" do
|
33
38
|
de_vat.should be_valid
|
34
39
|
gr_vat.should be_valid
|
35
40
|
end
|
36
|
-
|
41
|
+
|
37
42
|
it "returns false on invalid numbers" do
|
38
43
|
at_vat.should_not be_valid
|
39
44
|
end
|
40
45
|
end
|
41
|
-
|
46
|
+
|
42
47
|
context "#exist(s)?" do
|
43
48
|
context "on existing vat numbers" do
|
44
49
|
before do
|
45
50
|
Valvat::Lookup.stub(:validate => true)
|
46
51
|
end
|
47
|
-
|
52
|
+
|
48
53
|
it "returns true" do
|
49
54
|
de_vat.exists?.should eql(true)
|
50
55
|
gr_vat.exists?.should eql(true)
|
@@ -52,41 +57,41 @@ describe Valvat do
|
|
52
57
|
gr_vat.exist?.should eql(true)
|
53
58
|
end
|
54
59
|
end
|
55
|
-
|
60
|
+
|
56
61
|
context "on not existing vat numbers" do
|
57
62
|
before do
|
58
63
|
Valvat::Lookup.stub(:validate => false)
|
59
64
|
end
|
60
|
-
|
65
|
+
|
61
66
|
it "returns false" do
|
62
67
|
at_vat.exists?.should eql(false)
|
63
68
|
at_vat.exist?.should eql(false)
|
64
69
|
end
|
65
70
|
end
|
66
71
|
end
|
67
|
-
|
68
|
-
context "#iso_country_code" do
|
72
|
+
|
73
|
+
context "#iso_country_code" do
|
69
74
|
it "returns iso country code on iso_country_code" do
|
70
75
|
de_vat.iso_country_code.should eql("DE")
|
71
76
|
at_vat.iso_country_code.should eql("AT")
|
72
77
|
end
|
73
|
-
|
78
|
+
|
74
79
|
it "returns GR iso country code on greek vat number" do
|
75
80
|
gr_vat.iso_country_code.should eql("GR")
|
76
81
|
end
|
77
82
|
end
|
78
|
-
|
79
|
-
context "#vat_country_code" do
|
83
|
+
|
84
|
+
context "#vat_country_code" do
|
80
85
|
it "returns iso country code on iso_country_code" do
|
81
86
|
de_vat.vat_country_code.should eql("DE")
|
82
87
|
at_vat.vat_country_code.should eql("AT")
|
83
88
|
end
|
84
|
-
|
89
|
+
|
85
90
|
it "returns EL iso language code on greek vat number" do
|
86
91
|
gr_vat.vat_country_code.should eql("EL")
|
87
92
|
end
|
88
93
|
end
|
89
|
-
|
94
|
+
|
90
95
|
context "#european?" do
|
91
96
|
it "returns true" do
|
92
97
|
de_vat.should be_european
|
@@ -94,7 +99,7 @@ describe Valvat do
|
|
94
99
|
gr_vat.should be_european
|
95
100
|
end
|
96
101
|
end
|
97
|
-
|
102
|
+
|
98
103
|
context "#to_s" do
|
99
104
|
it "returns full vat number" do
|
100
105
|
de_vat.to_s.should eql("DE259597697")
|
@@ -102,7 +107,7 @@ describe Valvat do
|
|
102
107
|
gr_vat.to_s.should eql("EL999943280")
|
103
108
|
end
|
104
109
|
end
|
105
|
-
|
110
|
+
|
106
111
|
context "#inspect" do
|
107
112
|
it "returns vat number with iso country code" do
|
108
113
|
de_vat.inspect.should eql("#<Valvat DE259597697 DE>")
|
@@ -110,7 +115,7 @@ describe Valvat do
|
|
110
115
|
gr_vat.inspect.should eql("#<Valvat EL999943280 GR>")
|
111
116
|
end
|
112
117
|
end
|
113
|
-
|
118
|
+
|
114
119
|
context "#to_a" do
|
115
120
|
it "calls Valvat::Utils.split with raw vat number and returns result" do
|
116
121
|
de_vat # initialize
|
@@ -119,70 +124,70 @@ describe Valvat do
|
|
119
124
|
end
|
120
125
|
end
|
121
126
|
end
|
122
|
-
|
127
|
+
|
123
128
|
context "on vat number from outside of europe" do
|
124
129
|
let(:us_vat) { Valvat.new("US345889003") }
|
125
130
|
let(:ch_vat) { Valvat.new("CH445889003") }
|
126
|
-
|
131
|
+
|
127
132
|
context "#valid?" do
|
128
133
|
it "returns false" do
|
129
134
|
us_vat.should_not be_valid
|
130
135
|
ch_vat.should_not be_valid
|
131
136
|
end
|
132
137
|
end
|
133
|
-
|
138
|
+
|
134
139
|
context "#exist?" do
|
135
140
|
without_any_web_requests!
|
136
|
-
|
141
|
+
|
137
142
|
it "returns false" do
|
138
143
|
us_vat.should_not be_exist
|
139
144
|
ch_vat.should_not be_exist
|
140
145
|
end
|
141
146
|
end
|
142
|
-
|
143
|
-
context "#iso_country_code" do
|
147
|
+
|
148
|
+
context "#iso_country_code" do
|
144
149
|
it "returns nil" do
|
145
150
|
us_vat.iso_country_code.should eql(nil)
|
146
151
|
ch_vat.iso_country_code.should eql(nil)
|
147
152
|
end
|
148
153
|
end
|
149
|
-
|
150
|
-
context "#vat_country_code" do
|
154
|
+
|
155
|
+
context "#vat_country_code" do
|
151
156
|
it "returns nil" do
|
152
157
|
us_vat.vat_country_code.should eql(nil)
|
153
158
|
ch_vat.vat_country_code.should eql(nil)
|
154
159
|
end
|
155
160
|
end
|
156
|
-
|
161
|
+
|
157
162
|
context "#european?" do
|
158
163
|
it "returns false" do
|
159
164
|
us_vat.should_not be_european
|
160
165
|
ch_vat.should_not be_european
|
161
166
|
end
|
162
167
|
end
|
163
|
-
|
168
|
+
|
164
169
|
context "#to_s" do
|
165
170
|
it "returns full given vat number" do
|
166
171
|
us_vat.to_s.should eql("US345889003")
|
167
172
|
ch_vat.to_s.should eql("CH445889003")
|
168
173
|
end
|
169
174
|
end
|
170
|
-
|
175
|
+
|
171
176
|
context "#inspect" do
|
172
177
|
it "returns vat number without iso country code" do
|
173
178
|
us_vat.inspect.should eql("#<Valvat US345889003>")
|
174
179
|
ch_vat.inspect.should eql("#<Valvat CH445889003>")
|
175
180
|
end
|
176
181
|
end
|
177
|
-
|
182
|
+
|
178
183
|
end
|
179
|
-
|
184
|
+
|
180
185
|
context "on non-sense/empty vat number" do
|
181
186
|
let(:only_iso_vat) { Valvat.new("DE") }
|
182
187
|
let(:num_vat) { Valvat.new("12445889003") }
|
183
188
|
let(:empty_vat) { Valvat.new("") }
|
184
189
|
let(:nil_vat) { Valvat.new("") }
|
185
|
-
|
190
|
+
|
186
191
|
context "#valid?" do
|
187
192
|
it "returns false" do
|
188
193
|
only_iso_vat.should_not be_valid
|
@@ -191,10 +196,10 @@ describe Valvat do
|
|
191
196
|
nil_vat.should_not be_valid
|
192
197
|
end
|
193
198
|
end
|
194
|
-
|
199
|
+
|
195
200
|
context "#exist?" do
|
196
201
|
without_any_web_requests!
|
197
|
-
|
202
|
+
|
198
203
|
it "returns false" do
|
199
204
|
only_iso_vat.should_not be_exist
|
200
205
|
num_vat.should_not be_exist
|
@@ -202,8 +207,8 @@ describe Valvat do
|
|
202
207
|
nil_vat.should_not be_exist
|
203
208
|
end
|
204
209
|
end
|
205
|
-
|
206
|
-
context "#iso_country_code" do
|
210
|
+
|
211
|
+
context "#iso_country_code" do
|
207
212
|
it "returns nil" do
|
208
213
|
only_iso_vat.iso_country_code.should eql(nil)
|
209
214
|
num_vat.iso_country_code.should eql(nil)
|
@@ -211,8 +216,8 @@ describe Valvat do
|
|
211
216
|
nil_vat.iso_country_code.should eql(nil)
|
212
217
|
end
|
213
218
|
end
|
214
|
-
|
215
|
-
context "#vat_country_code" do
|
219
|
+
|
220
|
+
context "#vat_country_code" do
|
216
221
|
it "returns nil" do
|
217
222
|
only_iso_vat.vat_country_code.should eql(nil)
|
218
223
|
num_vat.vat_country_code.should eql(nil)
|
@@ -220,7 +225,7 @@ describe Valvat do
|
|
220
225
|
nil_vat.vat_country_code.should eql(nil)
|
221
226
|
end
|
222
227
|
end
|
223
|
-
|
228
|
+
|
224
229
|
context "#european?" do
|
225
230
|
it "returns false" do
|
226
231
|
only_iso_vat.should_not be_european
|
@@ -229,7 +234,7 @@ describe Valvat do
|
|
229
234
|
nil_vat.should_not be_european
|
230
235
|
end
|
231
236
|
end
|
232
|
-
|
237
|
+
|
233
238
|
context "#to_s" do
|
234
239
|
it "returns full given vat number" do
|
235
240
|
only_iso_vat.to_s.should eql("DE")
|
@@ -238,7 +243,7 @@ describe Valvat do
|
|
238
243
|
nil_vat.to_s.should eql("")
|
239
244
|
end
|
240
245
|
end
|
241
|
-
|
246
|
+
|
242
247
|
context "#inspect" do
|
243
248
|
it "returns vat number without iso country code" do
|
244
249
|
only_iso_vat.inspect.should eql("#<Valvat DE>")
|
@@ -247,6 +252,6 @@ describe Valvat do
|
|
247
252
|
nil_vat.inspect.should eql("#<Valvat >")
|
248
253
|
end
|
249
254
|
end
|
250
|
-
|
255
|
+
|
251
256
|
end
|
252
|
-
end
|
257
|
+
end
|
data/valvat.gemspec
CHANGED
@@ -12,23 +12,23 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Validates european vat numbers. Standalone or as a ActiveModel validator.}
|
13
13
|
s.description = <<-END
|
14
14
|
Validates european vat numbers. Standalone or as a ActiveModel validator.
|
15
|
-
|
15
|
+
|
16
16
|
* Simple syntax verification
|
17
17
|
* Lookup via the VIES web service
|
18
18
|
* Works standalone without any gem dependencies
|
19
19
|
* (Optional) ActiveModel/Rails3 integration
|
20
20
|
* I18n locales for country specific error messages
|
21
21
|
END
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
|
23
|
+
|
24
|
+
|
25
25
|
s.files = `git ls-files`.split("\n")
|
26
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
27
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
28
28
|
s.require_paths = ["lib"]
|
29
|
-
|
29
|
+
|
30
30
|
s.add_dependency 'savon', '>=0.8.2'
|
31
|
-
|
31
|
+
|
32
32
|
s.add_development_dependency 'rspec', '>= 2.4.0'
|
33
33
|
s.add_development_dependency 'guard-rspec', '>=0.1.9'
|
34
34
|
s.add_development_dependency 'growl', '>=1.0.3'
|
metadata
CHANGED
@@ -1,136 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: valvat
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 3
|
9
|
-
version: 0.3.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.4
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Sebastian Munz
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-31 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: savon
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2151804260 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 8
|
31
|
-
- 2
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
32
21
|
version: 0.8.2
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *2151804260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &2151803340 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 4
|
46
|
-
- 0
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
47
32
|
version: 2.4.0
|
48
33
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: guard-rspec
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *2151803340
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &2151801820 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 1
|
61
|
-
- 9
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
62
43
|
version: 0.1.9
|
63
44
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: growl
|
67
45
|
prerelease: false
|
68
|
-
|
46
|
+
version_requirements: *2151801820
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: growl
|
49
|
+
requirement: &2151800560 !ruby/object:Gem::Requirement
|
69
50
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 1
|
75
|
-
- 0
|
76
|
-
- 3
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
77
54
|
version: 1.0.3
|
78
55
|
type: :development
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: rb-fsevent
|
82
56
|
prerelease: false
|
83
|
-
|
57
|
+
version_requirements: *2151800560
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rb-fsevent
|
60
|
+
requirement: &2151799240 !ruby/object:Gem::Requirement
|
84
61
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
- 3
|
91
|
-
- 9
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
92
65
|
version: 0.3.9
|
93
66
|
type: :development
|
94
|
-
version_requirements: *id005
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: activemodel
|
97
67
|
prerelease: false
|
98
|
-
|
68
|
+
version_requirements: *2151799240
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activemodel
|
71
|
+
requirement: &2151797900 !ruby/object:Gem::Requirement
|
99
72
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
- 3
|
105
|
-
- 0
|
106
|
-
version: "3.0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.0'
|
107
77
|
type: :development
|
108
|
-
version_requirements: *id006
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: fakeweb
|
111
78
|
prerelease: false
|
112
|
-
|
79
|
+
version_requirements: *2151797900
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: fakeweb
|
82
|
+
requirement: &2151826140 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
segments:
|
118
|
-
- 1
|
119
|
-
- 3
|
120
|
-
- 0
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
121
87
|
version: 1.3.0
|
122
88
|
type: :development
|
123
|
-
|
124
|
-
|
125
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2151826140
|
91
|
+
description: ! " Validates european vat numbers. Standalone or as a ActiveModel validator.\n\n
|
92
|
+
\ * Simple syntax verification\n * Lookup via the VIES web service\n * Works standalone
|
93
|
+
without any gem dependencies\n * (Optional) ActiveModel/Rails3 integration\n *
|
94
|
+
I18n locales for country specific error messages\n"
|
95
|
+
email:
|
126
96
|
- sebastian@yo.lk
|
127
97
|
executables: []
|
128
|
-
|
129
98
|
extensions: []
|
130
|
-
|
131
99
|
extra_rdoc_files: []
|
132
|
-
|
133
|
-
files:
|
100
|
+
files:
|
134
101
|
- .gitignore
|
135
102
|
- .rvmrc
|
136
103
|
- CHANGES.md
|
@@ -154,39 +121,37 @@ files:
|
|
154
121
|
- spec/valvat/utils_spec.rb
|
155
122
|
- spec/valvat_spec.rb
|
156
123
|
- valvat.gemspec
|
157
|
-
has_rdoc: true
|
158
124
|
homepage: https://github.com/yolk/valvat
|
159
125
|
licenses: []
|
160
|
-
|
161
126
|
post_install_message:
|
162
127
|
rdoc_options: []
|
163
|
-
|
164
|
-
require_paths:
|
128
|
+
require_paths:
|
165
129
|
- lib
|
166
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
131
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
segments:
|
172
137
|
- 0
|
173
|
-
|
174
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
hash: 2750871567190462179
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
140
|
none: false
|
176
|
-
requirements:
|
177
|
-
- -
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
segments:
|
180
146
|
- 0
|
181
|
-
|
147
|
+
hash: 2750871567190462179
|
182
148
|
requirements: []
|
183
|
-
|
184
149
|
rubyforge_project:
|
185
|
-
rubygems_version: 1.
|
150
|
+
rubygems_version: 1.7.2
|
186
151
|
signing_key:
|
187
152
|
specification_version: 3
|
188
153
|
summary: Validates european vat numbers. Standalone or as a ActiveModel validator.
|
189
|
-
test_files:
|
154
|
+
test_files:
|
190
155
|
- spec/spec_helper.rb
|
191
156
|
- spec/valvat/active_model_spec.rb
|
192
157
|
- spec/valvat/lookup_spec.rb
|