valvat 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64381823f7e2709c5f0081eb33772f2a5a0e53d9
4
- data.tar.gz: '0907da537a7050f749e55a9b75a0f7bf6d539ef0'
3
+ metadata.gz: 35c51e2fec07101b00e4b87d9e95fb7ff134e6bd
4
+ data.tar.gz: ad4e0b154dd6af5354888135402bff135409b9e2
5
5
  SHA512:
6
- metadata.gz: 1729182d844d98ccdc4377582b03fcaf2a8c494c7c50828985b7fd02e9dd94045983e56b48510d3081f9843de6e40c4d5ef3492970e927c39bec4fbd04d54dec
7
- data.tar.gz: c4e87f422914f632fa6ab88c059f0c650132c002c78e7fcf5536cff1dcc32e481c930e867e97a3b3f4e1e1dcd364e3c230369b6544ae3877fd61c9fb92eded14
6
+ metadata.gz: e8ab1a7d14b5fff8a7917e190f3d3d850af8585befc54ec3beb80d84aaa6fd8c288ce78b095533bed68f0fc7c5127e03cdf54e7ed55d9004672f1e3cc1b7377f
7
+ data.tar.gz: be0f2b8ac6381f2fa45888c53a321b8bbebd02cdc8b22b86d1f223e07e2568d6afdddeddd97b4f2ec42919c380d1497404f9e711ede3bb620a7719c1811bb380
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/valvat/compare/v0.7.0...master)
3
+ [full changelog](http://github.com/yolk/valvat/compare/v0.7.1...master)
4
+
5
+ ### 0.7.1 / 2017-06-21
6
+
7
+ [full changelog](http://github.com/yolk/valvat/compare/v0.7.0...v0.7.1)
8
+
9
+ * Allow to require all functionality except lookup with 'valvat/local'
4
10
 
5
11
  ### 0.7.0 / 2017-05-16
6
12
 
data/README.md CHANGED
@@ -18,7 +18,21 @@ valvat is tested and works with ruby MRI 1.9.3/2.0/2.1/2.2/2.3/2.4, jruby (in 1.
18
18
 
19
19
  ## Installation
20
20
 
21
- gem install valvat
21
+ Add it to your Gemfile:
22
+
23
+ gem 'valvat'
24
+
25
+ To save most of the used memory and load only the local verification functionality – and not the remote lookup with VIES – add it like this instead:
26
+
27
+ gem 'valvat', :require => 'valvat/local'
28
+
29
+ In any case run:
30
+
31
+ $ bundle
32
+
33
+ Or install it yourself as:
34
+
35
+ $ gem install valvat
22
36
 
23
37
  ## Basic Usage
24
38
 
@@ -1,58 +1,12 @@
1
- class Valvat
2
- def initialize(raw)
3
- @raw = Valvat::Utils.normalize(raw || "")
4
- @vat_country_code, @to_s_wo_country = to_a
5
- end
6
-
7
- attr_reader :raw, :vat_country_code, :to_s_wo_country
8
-
9
- def blank?
10
- raw.nil? || raw.strip == ""
11
- end
12
-
13
- def valid?
14
- Valvat::Syntax.validate(self)
15
- end
16
-
17
- def valid_checksum?
18
- Valvat::Checksum.validate(self)
19
- end
1
+ require 'valvat/local'
2
+ require 'valvat/lookup'
3
+ require 'valvat/lookup/request'
4
+ require 'valvat/lookup/request_with_id'
5
+ require 'active_model/validations/valvat_validator' if defined?(ActiveModel)
20
6
 
7
+ class Valvat
21
8
  def exists?(options={})
22
9
  Valvat::Lookup.validate(self, options)
23
10
  end
24
11
  alias_method :exist?, :exists?
25
-
26
- def iso_country_code
27
- Valvat::Utils.vat_country_to_iso_country(vat_country_code)
28
- end
29
-
30
- def european?
31
- Valvat::Utils::EU_COUNTRIES.include?(iso_country_code)
32
- end
33
-
34
- def to_a
35
- Valvat::Utils.split(raw)
36
- end
37
-
38
- def to_s
39
- raw
40
- end
41
-
42
- def inspect
43
- "#<Valvat #{[raw, iso_country_code].compact.join(" ")}>"
44
- end
45
12
  end
46
-
47
- def Valvat(vat)
48
- vat.is_a?(Valvat) ? vat : Valvat.new(vat)
49
- end
50
-
51
- require 'valvat/utils'
52
- require 'valvat/syntax'
53
- require 'valvat/checksum'
54
- require 'valvat/lookup'
55
- require 'valvat/lookup/request'
56
- require 'valvat/lookup/request_with_id'
57
- require 'valvat/version'
58
- require 'active_model/validations/valvat_validator' if defined?(ActiveModel)
@@ -0,0 +1,49 @@
1
+ class Valvat
2
+ def initialize(raw)
3
+ @raw = Valvat::Utils.normalize(raw || "")
4
+ @vat_country_code, @to_s_wo_country = to_a
5
+ end
6
+
7
+ attr_reader :raw, :vat_country_code, :to_s_wo_country
8
+
9
+ def blank?
10
+ raw.nil? || raw.strip == ""
11
+ end
12
+
13
+ def valid?
14
+ Valvat::Syntax.validate(self)
15
+ end
16
+
17
+ def valid_checksum?
18
+ Valvat::Checksum.validate(self)
19
+ end
20
+
21
+ def iso_country_code
22
+ Valvat::Utils.vat_country_to_iso_country(vat_country_code)
23
+ end
24
+
25
+ def european?
26
+ Valvat::Utils::EU_COUNTRIES.include?(iso_country_code)
27
+ end
28
+
29
+ def to_a
30
+ Valvat::Utils.split(raw)
31
+ end
32
+
33
+ def to_s
34
+ raw
35
+ end
36
+
37
+ def inspect
38
+ "#<Valvat #{[raw, iso_country_code].compact.join(" ")}>"
39
+ end
40
+ end
41
+
42
+ def Valvat(vat)
43
+ vat.is_a?(Valvat) ? vat : Valvat.new(vat)
44
+ end
45
+
46
+ require 'valvat/utils'
47
+ require 'valvat/syntax'
48
+ require 'valvat/checksum'
49
+ require 'valvat/version'
@@ -1,3 +1,3 @@
1
1
  class Valvat
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
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: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
@@ -30,7 +30,7 @@ cert_chain:
30
30
  uE5yNhiszXkFmLQWPm57rwu8PbwT7av5kmYVhn8qkRz2aZnuAlLV3rcq2Khe5F0/
31
31
  jZmT2fJ8H8g=
32
32
  -----END CERTIFICATE-----
33
- date: 2017-05-16 00:00:00.000000000 Z
33
+ date: 2017-06-21 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: savon
@@ -125,6 +125,7 @@ files:
125
125
  - lib/valvat/checksum/ro.rb
126
126
  - lib/valvat/checksum/se.rb
127
127
  - lib/valvat/checksum/si.rb
128
+ - lib/valvat/local.rb
128
129
  - lib/valvat/locales/bg.yml
129
130
  - lib/valvat/locales/ca.yml
130
131
  - lib/valvat/locales/cs.yml
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- H�"�
1
+ |�|���