validates_as_vat_number 1.0.3 → 1.0.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/README.markdown +1 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/validates_as_vat_number.rb +4 -4
- metadata +17 -3
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## validates_as_vat_number
|
2
2
|
|
3
|
-
Now you can validate VAT using the European service called [VIES](http://ec.europa.eu/taxation_customs/vies/
|
3
|
+
Now you can validate VAT using the European service called [VIES](http://ec.europa.eu/taxation_customs/vies/services/checkVatService?wsdl), to ensure it exists. Only require this gem and call validate_as_vat_number on your VAT field, in an Active Record object.
|
4
4
|
|
5
5
|
## Install
|
6
6
|
|
data/Rakefile
CHANGED
@@ -13,6 +13,7 @@ begin
|
|
13
13
|
gem.homepage = "http://github.com/develon/validates_as_vat_number"
|
14
14
|
gem.authors = ["Alessandro Dal Grande", "Marco Sanson"]
|
15
15
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
16
|
+
gem.add_development_dependency "savon", ">= 0.7.5"
|
16
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
18
|
end
|
18
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Develon
|
2
2
|
module ValidatesAsVatNumber
|
3
|
-
require '
|
3
|
+
require 'savon'
|
4
4
|
|
5
5
|
def validates_as_vat_number(*attr_names)
|
6
6
|
configuration = {
|
@@ -32,13 +32,13 @@ module Develon
|
|
32
32
|
protected
|
33
33
|
|
34
34
|
def vies_driver
|
35
|
-
wsdl = "http://ec.europa.eu/taxation_customs/vies/
|
36
|
-
@driver =
|
35
|
+
wsdl = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?wsdl"
|
36
|
+
@driver = Savon::Client.new(wsdl)
|
37
37
|
end
|
38
38
|
|
39
39
|
def check_vat(country_code, vat_number)
|
40
40
|
@driver = vies_driver unless @driver
|
41
|
-
@driver.
|
41
|
+
@driver.check_vat { |soap| soap.body = { :country_code => country_code, :vat_number => vat_number } }.to_hash[:check_vat_response][:valid]
|
42
42
|
end
|
43
43
|
|
44
44
|
def country_code(vat)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 4
|
9
|
+
version: 1.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alessandro Dal Grande
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,20 @@ dependencies:
|
|
32
32
|
version: 1.2.9
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: savon
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 7
|
45
|
+
- 5
|
46
|
+
version: 0.7.5
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
35
49
|
description: |-
|
36
50
|
Now you can validate VAT using the European service called VIES,
|
37
51
|
to ensure it exists. Only require this gem and call validate_as_vat_number
|