valvat 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGES.md +7 -1
- data/Gemfile +8 -1
- data/README.md +1 -1
- data/gemfiles/activemodel-3-2 +8 -3
- data/gemfiles/activemodel-4 +8 -3
- data/gemfiles/standalone +7 -2
- data/lib/valvat/version.rb +1 -1
- data/lib/valvat.rb +4 -0
- data/spec/valvat/lookup_spec.rb +45 -15
- data/spec/valvat_spec.rb +17 -1
- data/valvat.gemspec +0 -3
- metadata +2 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a11112c9d6ba5fb3bf17de04d3e3a29e9d4396ae
|
4
|
+
data.tar.gz: be2eb43d47a2324b16a94f40dca2107a69617fd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53cd0859a466ace1cf8945c8851ec739cfec407c015594c3740d3b992d77bc7c41793945b0329e9653f7601b03803dd7c9edaf429f55504cc43e6a0b14b7ac01
|
7
|
+
data.tar.gz: 3ccb4b764b57374ff27424ba9414eaa2917101b5be24e27b4115d24e58eaf0a37bdc93c67beca0a94f78eb080e1ef3f3eea27c412f928d58f275b32ac148673a
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
-
[full changelog](http://github.com/yolk/valvat/compare/v0.6.
|
3
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.6.2...master)
|
4
|
+
|
5
|
+
### 0.6.2 / 2013-11-10
|
6
|
+
|
7
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.6.1...v0.6.2)
|
8
|
+
|
9
|
+
* Added blank? method to Valvat object
|
4
10
|
|
5
11
|
### 0.6.1 / 2013-09-02
|
6
12
|
|
data/Gemfile
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in valvat.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'rake'
|
7
|
+
gem 'guard-rspec', '~>4.0'
|
8
|
+
gem 'rb-fsevent' if RUBY_PLATFORM.include?("x86_64-darwin")
|
9
|
+
|
10
|
+
platform :rbx do
|
11
|
+
gem 'racc'
|
12
|
+
gem 'rubysl'
|
13
|
+
end
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Validates european vat numbers. Standalone or as a ActiveModel validator.
|
|
14
14
|
* I18n locales for country specific error messages in English, German, Swedish, Italian, Portuguese, Polish, Bulgarian, Romanian and Latvian.
|
15
15
|
* *Experimental* checksum verification
|
16
16
|
|
17
|
-
valvat is tested and works with ruby 1.9.3/2.0 and ActiveModel 3.2/4.0
|
17
|
+
valvat is tested and works with ruby MRI 1.9.3/2.0 and jruby (in 1.9 mode) and ActiveModel 3.2/4.0
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
data/gemfiles/activemodel-3-2
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
gem "savon", "2.3.0"
|
4
|
-
gem "activemodel", "3.2.
|
4
|
+
gem "activemodel", "3.2.15"
|
5
5
|
|
6
|
-
gem 'rspec', '>= 2.
|
6
|
+
gem 'rspec', '>= 2.14.0'
|
7
7
|
gem 'fakeweb', '>= 1.3.0'
|
8
|
-
gem 'rake'
|
8
|
+
gem 'rake'
|
9
|
+
|
10
|
+
platform :rbx do
|
11
|
+
gem 'racc'
|
12
|
+
gem 'rubysl'
|
13
|
+
end
|
data/gemfiles/activemodel-4
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
gem "savon", "2.3.0"
|
4
|
-
gem "activemodel", "4.0"
|
4
|
+
gem "activemodel", "4.0.1"
|
5
5
|
|
6
|
-
gem 'rspec', '>= 2.
|
6
|
+
gem 'rspec', '>= 2.14.0'
|
7
7
|
gem 'fakeweb', '>= 1.3.0'
|
8
|
-
gem 'rake'
|
8
|
+
gem 'rake'
|
9
|
+
|
10
|
+
platform :rbx do
|
11
|
+
gem 'racc'
|
12
|
+
gem 'rubysl'
|
13
|
+
end
|
data/gemfiles/standalone
CHANGED
data/lib/valvat/version.rb
CHANGED
data/lib/valvat.rb
CHANGED
data/spec/valvat/lookup_spec.rb
CHANGED
@@ -5,17 +5,35 @@ describe Valvat::Lookup do
|
|
5
5
|
context "existing vat number" do
|
6
6
|
|
7
7
|
it "returns true" do
|
8
|
-
Valvat::Lookup.validate("
|
8
|
+
result = Valvat::Lookup.validate("LU21416127")
|
9
|
+
|
10
|
+
unless result.nil?
|
11
|
+
result.should eql(true)
|
12
|
+
else
|
13
|
+
puts "Skipping LU vies lookup spec"
|
14
|
+
end
|
9
15
|
end
|
10
16
|
|
11
17
|
it "allows Valvat instance as input" do
|
12
|
-
Valvat::Lookup.validate(Valvat.new("
|
18
|
+
result = Valvat::Lookup.validate(Valvat.new("LU21416127"))
|
19
|
+
|
20
|
+
unless result.nil?
|
21
|
+
result.should eql(true)
|
22
|
+
else
|
23
|
+
puts "Skipping LU vies lookup spec"
|
24
|
+
end
|
13
25
|
end
|
14
26
|
end
|
15
27
|
|
16
28
|
context "not existing vat number" do
|
17
29
|
it "returns false" do
|
18
|
-
Valvat::Lookup.validate("
|
30
|
+
result = Valvat::Lookup.validate("LU21416128")
|
31
|
+
|
32
|
+
unless result.nil?
|
33
|
+
result.should eql(false)
|
34
|
+
else
|
35
|
+
puts "Skipping LU vies lookup spec"
|
36
|
+
end
|
19
37
|
end
|
20
38
|
end
|
21
39
|
|
@@ -60,23 +78,35 @@ describe Valvat::Lookup do
|
|
60
78
|
end
|
61
79
|
|
62
80
|
it "still returns false on not existing vat number" do
|
63
|
-
Valvat::Lookup.validate("
|
81
|
+
result = Valvat::Lookup.validate("LU21416128", :detail => true)
|
82
|
+
|
83
|
+
unless result.nil?
|
84
|
+
result.should eql(false)
|
85
|
+
else
|
86
|
+
puts "Skipping LU vies lookup spec"
|
87
|
+
end
|
64
88
|
end
|
65
89
|
end
|
66
90
|
|
67
91
|
context "with request identifier" do
|
68
92
|
it "returns hash of details instead of true" do
|
69
|
-
response = Valvat::Lookup.validate("
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
93
|
+
response = Valvat::Lookup.validate("LU21416127", :requester_vat => "IE6388047V")
|
94
|
+
|
95
|
+
if response
|
96
|
+
response[:request_identifier].size.should eql(16)
|
97
|
+
request_identifier = response[:request_identifier]
|
98
|
+
response.delete(:request_date).should be_kind_of(Date)
|
99
|
+
response.should eql({
|
100
|
+
:country_code=>"LU",
|
101
|
+
:vat_number=>"21416127",
|
102
|
+
:name => "EBAY EUROPE S.A R.L.",
|
103
|
+
:company_type=>nil,
|
104
|
+
:address => "22, BOULEVARD ROYAL\nL-2449 LUXEMBOURG",
|
105
|
+
:request_identifier=> request_identifier
|
106
|
+
})
|
107
|
+
else
|
108
|
+
puts "Skipping LU vies lookup spec"
|
109
|
+
end
|
80
110
|
end
|
81
111
|
end
|
82
112
|
|
data/spec/valvat_spec.rb
CHANGED
@@ -28,6 +28,22 @@ describe Valvat do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
|
32
|
+
describe "#blank?" do
|
33
|
+
|
34
|
+
it "returns true when when initialized with nil" do
|
35
|
+
Valvat.new(nil).should be_blank
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns true when when initialized with an empty string" do
|
39
|
+
Valvat.new(" ").should be_blank
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns false when initialized with a value" do
|
43
|
+
Valvat.new("DE259597697").should_not be_blank
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
context "on european vat number" do
|
32
48
|
let(:de_vat) { Valvat.new("DE259597697") } # valid & exists
|
33
49
|
let(:invalid_checksum) { Valvat.new("DE259597687") } # valid & invalid checksum
|
@@ -274,4 +290,4 @@ describe Valvat do
|
|
274
290
|
end
|
275
291
|
|
276
292
|
end
|
277
|
-
end
|
293
|
+
end
|
data/valvat.gemspec
CHANGED
@@ -23,9 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency 'savon', '>=2.3.0'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rspec', '>= 2.4.0'
|
26
|
-
s.add_development_dependency 'guard-rspec', '>=0.1.9'
|
27
|
-
s.add_development_dependency 'growl', '>=1.0.3'
|
28
|
-
s.add_development_dependency 'rb-fsevent', '>=0.9.1'
|
29
26
|
s.add_development_dependency 'activemodel', '>=3.0'
|
30
27
|
s.add_development_dependency 'fakeweb', '>= 1.3.0'
|
31
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valvat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Munz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -38,48 +38,6 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.4.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: guard-rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.9
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.9
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: growl
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.0.3
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0.3
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rb-fsevent
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.9.1
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9.1
|
83
41
|
- !ruby/object:Gem::Dependency
|
84
42
|
name: activemodel
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|