sa_vat_validation 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ee5f5cb79a55957c35c87dbfe44c36eb2cd359a
4
+ data.tar.gz: 1e866c4dd9ac2c417bf5a6b9b6bcdf8ca86f5ede
5
+ SHA512:
6
+ metadata.gz: a9456795c2c75c7704054b1d4331ac53fddacf9817c02e7430693ade0d2b507f92197382d425afbe976dacfa424c7df3a4197b1885401ecb1646b7fc286f0028
7
+ data.tar.gz: 34954fdd1846fbee916e93d591b8861424a9f214dbdff258adefd89488c7fb8d730d40f83bd37fed899823e4c84f8a03df1838fd0b978a0b33de3875b995d20b
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ .autotest
3
+ pkg/*
4
+ test/*
5
+ bin/*
6
+ *.gemspec
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.3
4
+ before_install: gem install bundler -v 1.10.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sa_vat_validation.gemspec
4
+ gemspec
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sa_vat_validation (0.1.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (4.2.1)
10
+ i18n (~> 0.7)
11
+ json (~> 1.7, >= 1.7.7)
12
+ minitest (~> 5.1)
13
+ thread_safe (~> 0.3, >= 0.3.4)
14
+ tzinfo (~> 1.1)
15
+ diff-lcs (1.2.5)
16
+ i18n (0.7.0)
17
+ json (1.8.2)
18
+ minitest (5.7.0)
19
+ rake (10.4.2)
20
+ rspec (3.2.0)
21
+ rspec-core (~> 3.2.0)
22
+ rspec-expectations (~> 3.2.0)
23
+ rspec-mocks (~> 3.2.0)
24
+ rspec-core (3.2.3)
25
+ rspec-support (~> 3.2.0)
26
+ rspec-expectations (3.2.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.2.0)
29
+ rspec-mocks (3.2.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.2.0)
32
+ rspec-support (3.2.2)
33
+ thread_safe (0.3.5)
34
+ tzinfo (1.2.2)
35
+ thread_safe (~> 0.1)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ activesupport (~> 4.2)
42
+ bundler (~> 1.10)
43
+ rake (~> 10.0)
44
+ rspec (~> 3.2)
45
+ sa_vat_validation!
46
+
47
+ BUNDLED WITH
48
+ 1.10.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Shane Reddy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ # SaVatValidation
2
+
3
+ Validation of South African VAT numbers
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sa_vat_validation'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sa_vat_validation
20
+
21
+ ## Usage
22
+
23
+ Validating a South African VAT number is easy:
24
+ ```ruby
25
+ 4023340283.valid_sa_vat_number?
26
+ => false
27
+ ```
28
+
29
+ Works on strings too:
30
+ ```ruby
31
+ '4023340283'.valid_sa_vat_number?
32
+ => false
33
+ ```
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mpowered/sa_vat_validation
44
+
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
49
+
data/Rakefile CHANGED
@@ -1,12 +1,6 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'echoe'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
4
3
 
5
- Echoe.new('sa_vat_validation', '0.1.1') do |p|
6
- p.description = "Validate South African VAT numbers easily"
7
- p.url = "http://github.com/mpowered/sa_vat_validation"
8
- p.author = "Gary Greyling"
9
- p.email = "greyling.gary@gmail.co.za"
10
- p.ignore_pattern = ["tmp/*", "script/*"]
11
- p.development_dependencies = [['activesupport']]
12
- end
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,3 +1,6 @@
1
+ require "sa_vat_validation/version"
2
+ require 'active_support/core_ext/string'
3
+
1
4
  class Fixnum
2
5
  def last_digit
3
6
  self.to_s.last.to_i
@@ -14,10 +17,15 @@ class String
14
17
  end
15
18
  end
16
19
 
17
- class SaVatValidation
20
+ module SaVatValidation
18
21
  def self.valid?(vat_number)
19
22
  digits = vat_number.to_s.split(//).map(&:to_i)
23
+
24
+ # As per SARS
25
+ # A VAT Number is a unique number, which comprises of 10 digits and starts with the number 4
26
+ return false unless digits.first.to_i == 4
20
27
  return false unless digits.size == 10 && vat_number.to_s.is_numeric?
28
+
21
29
  check_digit = digits.pop
22
30
 
23
31
  sum = 0
@@ -46,4 +54,4 @@ class Object
46
54
  def valid_sa_vat_number?
47
55
  SaVatValidation::valid?(self)
48
56
  end
49
- end
57
+ end
@@ -0,0 +1,3 @@
1
+ module SaVatValidation
2
+ VERSION = "0.1.2"
3
+ end
metadata CHANGED
@@ -1,111 +1,111 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sa_vat_validation
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Gary Greyling
14
8
  autorequire:
15
- bindir: bin
16
- cert_chain:
17
- - |
18
- -----BEGIN CERTIFICATE-----
19
- MIIDVjCCAj6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBRMQ0wCwYDVQQDDARnYXJ5
20
- MRgwFgYKCZImiZPyLGQBGRYIbXBvd2VyZWQxEjAQBgoJkiaJk/IsZAEZFgJjbzES
21
- MBAGCgmSJomT8ixkARkWAnphMB4XDTEwMDkyOTExMDczM1oXDTExMDkyOTExMDcz
22
- M1owUTENMAsGA1UEAwwEZ2FyeTEYMBYGCgmSJomT8ixkARkWCG1wb3dlcmVkMRIw
23
- EAYKCZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJ6YTCCASIwDQYJKoZI
24
- hvcNAQEBBQADggEPADCCAQoCggEBAKgoGyjXVfeJ10SWFNjlJe0bdPhpZZS+Culh
25
- dr53YjWUuvQ7WzM+wvkwrUAnARVL/pmX2nMn/RwXgen26RR41dk5DA2KRuA+U06n
26
- hxbZkDPpmzUSHXTZfya7a4YlzfqHkIPfzESxzl/r4XrtX7/bfZl4/Yx6sJKZ2Oxj
27
- p/4FG24oRk1sq02KahoogB+tRIbQZyyIctkRkxpuJ87Jr+eQ5M0d/XC1dbSKpHoC
28
- 7wvFeXKN2Calp1iFc/5ivbXb7oVxVLQANMShdlueLh4O2I0/j+/EsRHTZjNHart1
29
- R9slB5rgRp/mieX+QKCBqJ8gNv13I8thWBRcxv1HIAObKOJiUUECAwEAAaM5MDcw
30
- CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAQ0h81rouVRKvMSoF2p
31
- VQmtFGwIMA0GCSqGSIb3DQEBBQUAA4IBAQBha9zG+tkYxyGq5GQtLzIukmNG5W/q
32
- q4kpQs8J6nK+6LbfP5iH7T65CT4Kb4+zTzleaOKSEp4exTsIvmaiH45makbSLRbn
33
- b8WkSdt2P1fy5uT9MVkieCvFfUP24Fbo0DiqP2coJLQ8BCnFZzN+GhJDVG0APd9X
34
- c9Nk9uAODl8IXJLPYYEJ0YmOj1Y31pO/PBqWWoZv0yesopFW7niMFv9ylwqRBjul
35
- hHuH2lU449ckVEXvs9lseZY8hHEvx5Bz90s7fv+gO+/NhKvEY+MeWuLORpZmPSD9
36
- JSzVUJL2pes8Sw+j0TmyW7A+CfMJJjNaGku4LvnRPgRRb6Gd973i6FUS
37
- -----END CERTIFICATE-----
38
-
39
- date: 2010-09-29 00:00:00 +02:00
40
- default_executable:
41
- dependencies:
42
- - !ruby/object:Gem::Dependency
43
- name: activesupport
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :development
44
49
  prerelease: false
45
- requirement: &id001 !ruby/object:Gem::Requirement
46
- none: false
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- hash: 3
51
- segments:
52
- - 0
53
- version: "0"
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activesupport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.2'
54
62
  type: :development
55
- version_requirements: *id001
56
- description: Validate South African VAT numbers easily
57
- email: greyling.gary@gmail.co.za
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.2'
69
+ description: This gem is used to validate a South African VAT number based on the
70
+ current rules and regulations
71
+ email:
72
+ - greyling.gary@gmail.co.za
58
73
  executables: []
59
-
60
74
  extensions: []
61
-
62
- extra_rdoc_files:
63
- - README.rdoc
64
- - lib/sa_vat_validation.rb
65
- files:
66
- - README.rdoc
67
- - lib/sa_vat_validation.rb
68
- - sa_vat_validation.gemspec
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.md
69
84
  - Rakefile
70
- has_rdoc: true
85
+ - lib/sa_vat_validation.rb
86
+ - lib/sa_vat_validation/version.rb
71
87
  homepage: http://github.com/mpowered/sa_vat_validation
72
- licenses: []
73
-
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
74
91
  post_install_message:
75
- rdoc_options:
76
- - --line-numbers
77
- - --inline-source
78
- - --title
79
- - Sa_vat_validation
80
- - --main
81
- - README.rdoc
82
- require_paths:
92
+ rdoc_options: []
93
+ require_paths:
83
94
  - lib
84
- required_ruby_version: !ruby/object:Gem::Requirement
85
- none: false
86
- requirements:
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
87
97
  - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
96
102
  - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 11
99
- segments:
100
- - 1
101
- - 2
102
- version: "1.2"
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
103
105
  requirements: []
104
-
105
- rubyforge_project: sa_vat_validation
106
- rubygems_version: 1.3.7
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.2
107
108
  signing_key:
108
- specification_version: 3
109
- summary: Validate South African VAT numbers easily
109
+ specification_version: 4
110
+ summary: Validation of South African VAT numbers
110
111
  test_files: []
111
-
data.tar.gz.sig DELETED
@@ -1,4 +0,0 @@
1
- '��g-���bW�$;�ď��fғw�C�v�����Hf��FE�Ў"?Q��ʊ�lohZ�uڈ� ��� ID�Zx��g��
2
- �Ђٓ�8�;~�(�|5���[�ASP��%����T�O�%B�7��L�K������-;�i�.</ }��� �(��M���XR��d��s h"��I�&�ήL>X�֚&ͬ�z�E�����X
3
- �<�RDIc.9ݠEU�prO��C������;k)xG��70�(��o��
4
- �^�9�
@@ -1,50 +0,0 @@
1
- = sa_vat_validation
2
-
3
- http://github.com/mpowered/sa_vat_validation
4
-
5
- == DESCRIPTION:
6
-
7
- Validation of South African VAT numbers
8
-
9
-
10
- == EXAMPLE:
11
-
12
- Validating a South African VAT number is easy:
13
- >> 4023340283.valid_sa_vat_number?
14
- => false
15
- Works on strings too:
16
- >> '4023340283'.valid_sa_vat_number?
17
- => false
18
-
19
- == REQUIREMENTS:
20
-
21
- * activesupport
22
-
23
- == INSTALL:
24
-
25
- gem install sa_vat_validation
26
-
27
- == LICENSE:
28
-
29
- (The MIT License)
30
-
31
- Copyright (c) 2010 FIX
32
-
33
- Permission is hereby granted, free of charge, to any person obtaining
34
- a copy of this software and associated documentation files (the
35
- 'Software'), to deal in the Software without restriction, including
36
- without limitation the rights to use, copy, modify, merge, publish,
37
- distribute, sublicense, and/or sell copies of the Software, and to
38
- permit persons to whom the Software is furnished to do so, subject to
39
- the following conditions:
40
-
41
- The above copyright notice and this permission notice shall be
42
- included in all copies or substantial portions of the Software.
43
-
44
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
45
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
47
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
48
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,35 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{sa_vat_validation}
5
- s.version = "0.1.1"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Gary Greyling"]
9
- s.cert_chain = ["/Users/gary/.gem_certs/gem-public_cert.pem"]
10
- s.date = %q{2010-09-29}
11
- s.description = %q{Validate South African VAT numbers easily}
12
- s.email = %q{greyling.gary@gmail.co.za}
13
- s.extra_rdoc_files = ["README.rdoc", "lib/sa_vat_validation.rb"]
14
- s.files = ["README.rdoc", "lib/sa_vat_validation.rb", "sa_vat_validation.gemspec", "Rakefile"]
15
- s.homepage = %q{http://github.com/mpowered/sa_vat_validation}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sa_vat_validation", "--main", "README.rdoc"]
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{sa_vat_validation}
19
- s.rubygems_version = %q{1.3.7}
20
- s.signing_key = %q{/Users/gary/.gem_certs/gem-private_key.pem}
21
- s.summary = %q{Validate South African VAT numbers easily}
22
-
23
- if s.respond_to? :specification_version then
24
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
- s.specification_version = 3
26
-
27
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
- s.add_development_dependency(%q<activesupport>, [">= 0"])
29
- else
30
- s.add_dependency(%q<activesupport>, [">= 0"])
31
- end
32
- else
33
- s.add_dependency(%q<activesupport>, [">= 0"])
34
- end
35
- end
metadata.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ��4������v��o8��x��B�99���c����)?���̹�y��
2
- ���,�+��:%:F�#6�˔���ԕ`�h�}q=�Ek��]��1“�I�