brval2 0.9.75

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5b7e0b9a7a49c16be3359235a7663158ece874e6144d00f6dd95cf5b183c0769
4
+ data.tar.gz: c461e0dc544456fccaa2d3ba4073358d331ce07ced75405cc4327d58487e300f
5
+ SHA512:
6
+ metadata.gz: df4363cc276d920abe593e7a0f8733e2c1c1997d3b9ecdd301ac5ef17a5decf137c62f732fdfaa31f477bf800c3e5a4d516c6b00c5308554c34730529970dfcb
7
+ data.tar.gz: 4fa55d7951cf046208b0143a2c4e74fd2d5243b526e05a58a4d690268b67002d764d38074a7af24463a46f1f1941c9cec124d0c0e7763e4a49692edf6dd1fd68
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Brval
2
+ This is a gem to validate many Brazilian codes. Because it's common to use many gems, libs and even copy and paste methods found around the internet to do that.
3
+
4
+ So the idea of Brval gem is: reunite all those validations methods in one single gem, making our lives even "easier" to develop Ruby apps.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your Gemfile
9
+
10
+ ```ruby
11
+ gem 'brval2'
12
+ ```
13
+
14
+ Or run it direct on terminal:
15
+
16
+ $ gem install brval2
17
+
18
+ ## Usage
19
+
20
+ To use Brval gem is quite simple, just call the module `Brval` with the validation you wish.
21
+ Examples:
22
+
23
+ ```ruby
24
+ # CPF valid
25
+ Brval.cpf_valid?('79411449050') # => true
26
+
27
+ # CPF invalid
28
+ Brval.cpf_valid?('79411400000') # => false
29
+
30
+ # CNH valid
31
+ Brval.cnh_valid?('30142868570') # => true
32
+
33
+ # Título de eleitor valid
34
+ Brval.te_valid?('264632480167') # => true
35
+
36
+ # Cep valid
37
+ Brval.cep_valid?('70297-400') # => true
38
+ ```
39
+
40
+ ### Lista da Funções
41
+ ### Functions List
42
+ Above is the list with all the functions and validations avaible on Brval gem.
43
+
44
+ | Function | Return | Description |
45
+ |-------------------------|--------------|-----------|
46
+ | Brval.cep_valid? |true/false | |
47
+ | Brval.cep_info? |json | Json with cep information |
48
+ | Brval.cnh_valid? |true/false | |
49
+ | Brval.cnpj_valid? |true/false | |
50
+ | Brval.cnpj_mask |CNPJ com máscara| retorna o CNPJ com máscara: 00.000.000/0000-00 |
51
+ | Brval.cpf_valid? |true/false | |
52
+ | Brval.cpf_mask |CPF com máscara| retorna o CPF com máscara: 000.000.000-00 |
53
+ | Brval.credit_card_valid?|true/false | Number of credit card with 16 digits |
54
+ | Brval.lawsuit_valid? |true/false | Number of judicial process|
55
+ | Brval.pis_valid? |true/false | Same validation for: PIS/PASEP/NIT |
56
+ | Brval.renavam_valid? |true/false | |
57
+ | Brval.te_valid? |true/false | te = "Título de eleitor" |
58
+
59
+
60
+ ### CEP Validation
61
+ Brazilian postal code, CEP, doesn't has any formula or calculation to check if some CEP is valid or not, the only way to know that is searching in a database with all CEP's in Brazil
62
+
63
+ Apparently Correios doesn't provides any database with all CEP's of Brazil, so some devs developer their own services to search for a CEP info, some of those services are public API's and anyone can use it.
64
+
65
+ Considering this, Brval does the CEP validation following this flow:
66
+
67
+ - `Brval.cep_valid?('00000000')`
68
+ - The gem does a first query at [Via Cep API](https://viacep.com.br/)
69
+ - If the CEP is not found, the gem does a **second** query at [WideNet API](http://apps.widenet.com.br/busca-cep)
70
+ - If again, the CEP is not found the gem does third query to search the CEP at [Postmon API](https://postmon.com.br/)
71
+ - And finally, if the CEP is not found in any of these three API's the gem Brval will say that this CEP doesn't exists.
72
+
73
+ The gem uses the same procedure to get the info of some CEP with the function: `Brval.cep_info(00000000)`
74
+
75
+ **OBS:** the gem "only" search in three API's, if a CEP exists but any of these API's doesn't have it, the gem will return a false negative.
76
+
77
+
78
+ ## Contributing
79
+
80
+ If you miss any validation, create an Issue explaining about it, if possible, leave some links with the calculation or any formula example about the validation. I will be happy trying to implement that to help you.
81
+
82
+ If you want to contribute with some code create an issue so we can discuss about, if everyone agree with your idea, create a fork, create your branch and send your pull request explaining the details about your PR.
83
+
84
+ Don't forget the tests, Brval use Rspec to test. Update the README with the new info. Also, try to follow the gem pattern to implement your contribution.
85
+
86
+ ### Run the gem from local project
87
+ You can run the gem with: `rake console`
88
+
89
+ And before send your PR make a simulation installing the gem locally with your changes, just run the `./build.sh` script.
90
+
91
+ ```
92
+ chmod +x build.sh
93
+ ./build.sh
94
+ ```
95
+
96
+ Thanks!
97
+
98
+ ## License
99
+
100
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,34 @@
1
+ module Cep
2
+ class CepService
3
+ attr_accessor :cep, :url
4
+
5
+ def initialize cep
6
+ @cep = cep.to_s.tr('^0-9', '')
7
+ end
8
+
9
+ def check
10
+ return false if @cep.nil? || @cep.length > 8
11
+ json = load_cep_json
12
+ json_valid?(json)
13
+ end
14
+
15
+ def info
16
+ return response_error if @cep.nil? || @cep.length > 8
17
+ json = load_cep_json
18
+ json_valid?(json) ? translate_params(json) : response_error
19
+ end
20
+
21
+ private
22
+
23
+ def load_cep_json
24
+ response = HTTParty.get(@url)
25
+ return nil if response.code != 200
26
+ JSON.parse(response.body)
27
+ end
28
+
29
+ def response_error
30
+ { 'error' => "Nenhum cep encontrado para: #{@cep}" }
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,37 @@
1
+ module Cep
2
+ class Postmon < CepService
3
+
4
+ # Thank you Postmon for this API
5
+ # https://postmon.com.br/
6
+
7
+ URL_HOME = 'https://api.postmon.com.br/v1/cep/'.freeze
8
+
9
+ def initialize cep
10
+ super
11
+ @url = URL_HOME + @cep
12
+ end
13
+
14
+ private
15
+
16
+ def json_valid? json
17
+ return false if json.nil?
18
+ json.key?('bairro') && json.key?('logradouro') && json.key?('cidade') && json.key?('estado')
19
+ end
20
+
21
+ def translate_params json
22
+ json['cep'] = json['cep'].insert(5, '-')
23
+ json['address'] = json.delete 'logradouro'
24
+ json['complement'] = ''
25
+ json['neighborhood'] = json.delete 'bairro'
26
+ json['city'] = json.delete 'cidade'
27
+ json['state'] = json.delete 'estado'
28
+ json['unit'] = ''
29
+ json['ibge'] = json['cidade_info']['codigo_ibge']
30
+ json['gia'] = ''
31
+ json.delete 'estado_info'
32
+ json.delete 'cidade_info'
33
+ json
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,31 @@
1
+ module Cep
2
+ class ViaCep < CepService
3
+
4
+ URL_HOME = 'https://viacep.com.br/ws/'.freeze
5
+
6
+ def initialize cep
7
+ super
8
+ @url = URL_HOME + @cep + '/json'
9
+ end
10
+
11
+ private
12
+
13
+ def json_valid? json
14
+ return false if json.nil? || json.key?('erro')
15
+ json.key?('logradouro') && json.key?('bairro') && json.key?('localidade') && json.key?('uf')
16
+ end
17
+
18
+ def translate_params json
19
+ json['address'] = json.delete 'logradouro'
20
+ json['complement'] = json.delete 'complemento'
21
+ json['neighborhood'] = json.delete 'bairro'
22
+ json['city'] = json.delete 'localidade'
23
+ json['state'] = json.delete 'uf'
24
+ json['unit'] = json.delete 'unidade'
25
+ json['ibge'] = json.delete 'ibge'
26
+ json['gia'] = json.delete 'gia'
27
+ json
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,37 @@
1
+ module Cep
2
+ class Widenet < CepService
3
+
4
+ # Thank you WideNet for this API
5
+ # apps.widenet.com.br/busca-cep/api-de-consulta
6
+
7
+ URL_HOME = 'http://apps.widenet.com.br/busca-cep/api/cep/'.freeze
8
+
9
+ def initialize cep
10
+ super
11
+ @url = URL_HOME + @cep + '.json'
12
+ end
13
+
14
+ private
15
+
16
+ def json_valid? json
17
+ return false if json.nil? || json.key?('message')
18
+ json.key?('district') && json.key?('city') && json.key?('address') && json.key?('state')
19
+ end
20
+
21
+ def translate_params json
22
+ json.delete 'status'
23
+ json['cep'] = json.delete 'code'
24
+ json['address'] = json.delete 'address'
25
+ json['complement'] = ''
26
+ json['neighborhood'] = json.delete 'district'
27
+ json['city'] = json.delete 'city'
28
+ json['state'] = json.delete 'state'
29
+ json['unit'] = ''
30
+ json['ibge'] = ''
31
+ json['gia'] = ''
32
+ json
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -0,0 +1,40 @@
1
+ module Brval::CepCall
2
+
3
+ def cep_valid?(cep)
4
+ cep = cep.to_s.tr('^0-9', '')
5
+ return false if cep.nil? || cep.length > 8
6
+ call_apis_check(cep)
7
+ end
8
+
9
+ def cep_info(cep)
10
+ cep = cep.to_s.tr('^0-9', '')
11
+ return false if cep.nil? || cep.length > 8
12
+ call_apis_info(cep)
13
+ end
14
+
15
+ private
16
+
17
+ def call_apis_check(cep)
18
+ via = Cep::ViaCep.new(cep).check
19
+ widenet = Cep::Widenet.new(cep).check if via != true
20
+ postmon = Cep::Postmon.new(cep).check if via != true && widenet != true
21
+ return true if (via == true || widenet == true || postmon == true)
22
+ false
23
+ end
24
+
25
+ def call_apis_info(cep)
26
+ via = Cep::ViaCep.new(cep).info
27
+ if via.key?('error')
28
+ widenet = Cep::Widenet.new(cep).info
29
+ else
30
+ return via
31
+ end
32
+ if via.key?('error') && widenet.key?('error')
33
+ postmon = Cep::Postmon.new(cep).info
34
+ else
35
+ return widenet
36
+ end
37
+ return postmon
38
+ end
39
+
40
+ end
data/lib/brval/cnh.rb ADDED
@@ -0,0 +1,46 @@
1
+ module Brval
2
+ # Validate CNH
3
+ class Cnh < Val
4
+
5
+ private
6
+
7
+ def validate_code
8
+ return false if @code.length < 11
9
+ return false if @code[0] * 11 == @code
10
+
11
+ cnh_without_digits = @code[0..8]
12
+ cnh_digits = @code[-2..-1]
13
+ incr_dig2 = 0
14
+
15
+ sum = 0
16
+ mult = 9
17
+ (0..8).each do |i|
18
+ sum += cnh_without_digits[i].to_i * mult
19
+ mult -= 1
20
+ end
21
+
22
+ digit1 = sum % 11
23
+ incr_dig2 = -2 if digit1 == 10
24
+ digit1 = 0 if digit1 > 9
25
+
26
+ sum = 0
27
+ mult = 1
28
+ (0..8).each do |i|
29
+ sum += (cnh_without_digits[i].to_i * mult)
30
+ mult += 1
31
+ end
32
+
33
+ digit2 = if ((sum % 11) + incr_dig2) < 0
34
+ 11 + (sum % 11) + incr_dig2
35
+ else
36
+ (sum % 11) + incr_dig2
37
+ end
38
+ digit2 = 0 if digit2 > 9
39
+
40
+ dig_to_compare = digit1.to_s + digit2.to_s
41
+
42
+ return true if cnh_digits == dig_to_compare
43
+ false
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/cnh"
2
+
3
+ module Brval
4
+ module CnhCall
5
+
6
+ def cnh_valid? cnh
7
+ Cnh.new(cnh).valid?
8
+ end
9
+
10
+ end
11
+ end
data/lib/brval/cnpj.rb ADDED
@@ -0,0 +1,35 @@
1
+ module Brval
2
+ class Cnpj < Val
3
+
4
+ def masked
5
+ @code.dup.insert(2, '.').insert(6, '.').insert(10, '/').insert(15, '-')
6
+ end
7
+
8
+ private
9
+
10
+ NULLS = %w{11111111111111 22222222222222 33333333333333 44444444444444 55555555555555 66666666666666 77777777777777 88888888888888 99999999999999 00000000000000}.freeze
11
+
12
+ # function from https://gist.github.com/lucascaton/1109488
13
+ def validate_code
14
+ return false if @code.nil?
15
+
16
+ value = @code.split('')
17
+ if value.length == 14
18
+ unless NULLS.include?(value.join)
19
+ value = value.collect{|x| x.to_i}
20
+ sum = value[0]*5+value[1]*4+value[2]*3+value[3]*2+value[4]*9+value[5]*8+value[6]*7+value[7]*6+value[8]*5+value[9]*4+value[10]*3+value[11]*2
21
+ sum = sum - (11*(sum/11))
22
+ result1 = (sum==0 || sum==1) ? 0 : 11 - sum
23
+ if result1 == value[12]
24
+ sum = value[0]*6+value[1]*5+value[2]*4+value[3]*3+value[4]*2+value[5]*9+value[6]*8+value[7]*7+value[8]*6+value[9]*5+value[10]*4+value[11]*3+value[12]*2
25
+ sum = sum - (11*(sum/11))
26
+ result2 = (sum == 0 || sum == 1) ? 0 : 11 - sum
27
+ return true if result2 == value[13] # valid CNPJ
28
+ end
29
+ end
30
+ end
31
+ false # invalid CNPJ
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,15 @@
1
+ require "brval/cnpj"
2
+
3
+ module Brval
4
+ module CnpjCall
5
+
6
+ def cnpj_valid? cnpj
7
+ Cnpj.new(cnpj).valid?
8
+ end
9
+
10
+ def cnpj_mask cnpj
11
+ Cnpj.new(cnpj).mask
12
+ end
13
+
14
+ end
15
+ end
data/lib/brval/cpf.rb ADDED
@@ -0,0 +1,37 @@
1
+ module Brval
2
+ class Cpf < Val
3
+
4
+ def masked
5
+ @code.dup.insert(3, '.').insert(7, '.').insert(11, '-')
6
+ end
7
+
8
+ private
9
+
10
+ NULLS = %w{12345678909 11111111111 22222222222 33333333333 44444444444 55555555555 66666666666 77777777777 88888888888 99999999999 00000000000 01234567890}.freeze
11
+
12
+ # function from https://gist.github.com/lucascaton/1109488
13
+ def validate_code
14
+ # remote_mask(cpf)
15
+ # Add errors after initialize CPF this class if cpf has wrong value
16
+ return false if @code.nil?
17
+
18
+ value = @code.split('')
19
+ if value.length == 11
20
+ unless NULLS.include?(value.join)
21
+ value = value.collect{|x| x.to_i}
22
+ sum = 10*value[0]+9*value[1]+8*value[2]+7*value[3]+6*value[4]+5*value[5]+4*value[6]+3*value[7]+2*value[8]
23
+ sum = sum - (11 * (sum/11))
24
+ result1 = (sum == 0 or sum == 1) ? 0 : 11 - sum
25
+ if result1 == value[9]
26
+ sum = value[0]*11+value[1]*10+value[2]*9+value[3]*8+value[4]*7+value[5]*6+value[6]*5+value[7]*4+value[8]*3+value[9]*2
27
+ sum = sum - (11 * (sum/11))
28
+ result2 = (sum == 0 or sum == 1) ? 0 : 11 - sum
29
+ return true if result2 == value[10] # valid CPF
30
+ end
31
+ end
32
+ end
33
+ return false # invalid CPF
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ require "brval/cpf"
2
+
3
+ module Brval
4
+ module CpfCall
5
+
6
+ def cpf_valid? cpf
7
+ Cpf.new(cpf).valid?
8
+ end
9
+
10
+ def cpf_mask cpf
11
+ Cpf.new(cpf).mask
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,41 @@
1
+ module Brval
2
+ class CreditCard < Val
3
+
4
+ private
5
+
6
+ # Calc from: http://datagenetics.com/blog/july42013/index.html
7
+ def validate_code
8
+ raise ArgumentError, 'Credit card number must have 16 digits' if @code.length != 16
9
+ value = @code.split('')
10
+ if value.length == 16
11
+ sum = sum_nums(value[0..14])
12
+ sum_complete = treat_sum(sum.digits.reverse)
13
+ return true if sum_complete - sum == value[15].to_i
14
+ end
15
+ false
16
+ end
17
+
18
+ def sum_nums nums
19
+ sum = 0
20
+ nums.each_with_index do |n, i|
21
+ num = n.to_i
22
+ if i%2 != 0
23
+ sum += num
24
+ else
25
+ new_num = (num*2).digits.sum
26
+ sum += new_num
27
+ end
28
+ end
29
+ sum
30
+ end
31
+
32
+ def treat_sum nums
33
+ if nums.last != 0
34
+ nums[0] = nums[0]+1
35
+ nums[nums.count-1] = 0
36
+ end
37
+ nums.join.to_i
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/credit_card"
2
+
3
+ module Brval
4
+ module CreditCardCall
5
+
6
+ def credit_card_valid? credit_card
7
+ CreditCard.new(credit_card).valid?
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module Brval
2
+ class Lawsuit < Val
3
+
4
+ LENGTH = 20.freeze
5
+
6
+ private
7
+
8
+ def validate_code
9
+ return false if @code.length != LENGTH
10
+ dv = @code[7..8].to_i
11
+ num_calc = (@code[0..6]+@code[9..19]).to_i
12
+ dv_check = 98 - (num_calc*100).modulo(97)
13
+ dv == dv_check ? true : false
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/lawsuit"
2
+
3
+ module Brval
4
+ module LawsuitCall
5
+
6
+ def lawsuit_valid? lawsuit
7
+ Lawsuit.new(lawsuit).valid?
8
+ end
9
+
10
+ end
11
+ end
data/lib/brval/pis.rb ADDED
@@ -0,0 +1,21 @@
1
+ module Brval
2
+ class Pis < Val
3
+
4
+ private
5
+
6
+ def validate_code
7
+ return false if @code.nil?
8
+
9
+ value = @code.split('')
10
+ if value.length == 11
11
+ value = value.collect{|x| x.to_i}
12
+ sum = 3*value[0] + 2*value[1] + 9*value[2] + 8*value[3] + 7*value[4] + 6*value[5] + 5*value[6] + 4*value[7] + 3*value[8] + 2*value[9]
13
+ result = 11 - sum.modulo(11)
14
+ return true if result == value[10]
15
+ return true if value[10] == 0 && (result == 10 || result == 11)
16
+ end
17
+ return false
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/pis"
2
+
3
+ module Brval
4
+ module PisCall
5
+
6
+ def pis_valid? pis
7
+ Pis.new(pis).valid?
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ module Brval
2
+ class Renavam < Val
3
+
4
+ private
5
+
6
+ def validate_code
7
+ @code = "00" + @code if @code.length == 9
8
+ ren_cut = @code[0..9]
9
+ ren_reverse = ren_cut.reverse[0..7]
10
+ sum = 0
11
+ (2..9).to_a.each do |i|
12
+ sum += ren_reverse[i-2].to_i * i
13
+ end
14
+ sum += @code[0].to_i*3 + @code[1].to_i*2
15
+ result1 = 11 - (sum % 11)
16
+ digit1 = (result1 == 10 || result1 == 11) ? 0 : result1
17
+ return true if @code[10].to_i == digit1
18
+ false
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/renavam"
2
+
3
+ module Brval
4
+ module RenavamCall
5
+
6
+ def renavam_valid? renavam
7
+ Renavam.new(renavam).valid?
8
+ end
9
+
10
+ end
11
+ end
data/lib/brval/te.rb ADDED
@@ -0,0 +1,48 @@
1
+ # Te = Titulo Eleitoral
2
+ module Brval
3
+ class Te < Val
4
+
5
+ private
6
+
7
+ def validate_code
8
+ return false if @code.nil?
9
+ value = @code.split('')
10
+ if value.length == 12
11
+ value = value.collect{|x| x.to_i}
12
+ digit1 = calc_digit1(value)
13
+ digit2 = calc_digit2(value, digit1)
14
+ return true if value[10] == digit1 && value[11] == digit2
15
+ end
16
+
17
+ return false
18
+ end
19
+
20
+ def calc_digit1 nums
21
+ sum = nums[0]*9 + nums[1]*8 + nums[2]*7 + nums[3]*6 + nums[4]*5 + nums[5]*4 + nums[6]*3 + nums[7]*2
22
+ check_result(nums, sum)
23
+ end
24
+
25
+ def calc_digit2 nums, digit1
26
+ sum = nums[8]*4 + nums[9]*3 + digit1*2
27
+ check_result(nums, sum)
28
+ end
29
+
30
+ def check_result nums, sum
31
+ rest = sum.modulo(11)
32
+ if rest == 0 || rest == 1
33
+ if nums[8] == 0 && (nums[9] == 1 || nums[9] == 2)
34
+ if rest == 0
35
+ result = 1
36
+ else
37
+ result = 0
38
+ end
39
+ else
40
+ result = 0
41
+ end
42
+ else
43
+ result = 11 - rest
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,11 @@
1
+ require "brval/te"
2
+
3
+ module Brval
4
+ module TeCall
5
+
6
+ def te_valid? te
7
+ Te.new(te).valid?
8
+ end
9
+
10
+ end
11
+ end
data/lib/brval/val.rb ADDED
@@ -0,0 +1,22 @@
1
+ module Brval
2
+ class Val
3
+
4
+ attr_accessor :code
5
+
6
+ def initialize(code)
7
+ return if code.nil?
8
+ @code = code.tr('^0-9', '')
9
+ end
10
+
11
+ def mask
12
+ return if @code.nil?
13
+ masked
14
+ end
15
+
16
+ def valid?
17
+ return false if @code.nil?
18
+ validate_code
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Brval
2
+ VERSION = "0.9.75"
3
+ end
data/lib/brval.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'httparty'
2
+ require 'brval/version'
3
+
4
+ require 'brval/val'
5
+ require 'brval/cnh_call'
6
+ require 'brval/cnpj_call'
7
+ require 'brval/cpf_call'
8
+ require 'brval/credit_card_call'
9
+ require 'brval/lawsuit_call'
10
+ require 'brval/pis_call'
11
+ require 'brval/renavam_call'
12
+ require 'brval/te_call'
13
+
14
+ require 'brval/cep/cep_service'
15
+ require 'brval/cep/postmon'
16
+ require 'brval/cep/via_cep'
17
+ require 'brval/cep/widenet'
18
+ require 'brval/cep_call'
19
+
20
+ # main module
21
+ module Brval
22
+ extend CnhCall
23
+ extend CnpjCall
24
+ extend CpfCall
25
+ extend CreditCardCall
26
+ extend LawsuitCall
27
+ extend PisCall
28
+ extend RenavamCall
29
+ extend TeCall
30
+
31
+ extend CepCall
32
+
33
+ class Error < StandardError; end
34
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brval2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.75
5
+ platform: ruby
6
+ authors:
7
+ - Wagner Rigoli da Rosa
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-12-16 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.17'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.17.3
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.17'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.17.3
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '10.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '10.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.8'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.8.0
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '3.8'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.8.0
67
+ - !ruby/object:Gem::Dependency
68
+ name: simplecov
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 0.16.1
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: 0.16.1
81
+ - !ruby/object:Gem::Dependency
82
+ name: rubycritic
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '3.5'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.5'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rubocop
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 0.62.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 0.62.0
109
+ - !ruby/object:Gem::Dependency
110
+ name: json
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '2.1'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '2.1'
123
+ - !ruby/object:Gem::Dependency
124
+ name: httparty
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 0.21.0
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: 0.21.0
137
+ description: Gem to validates Brazilian codes, like CPF, CNPJ, CNH, PIS ...
138
+ email:
139
+ - wagnerr2@gmail.com
140
+ executables: []
141
+ extensions: []
142
+ extra_rdoc_files: []
143
+ files:
144
+ - README.md
145
+ - lib/brval.rb
146
+ - lib/brval/cep/cep_service.rb
147
+ - lib/brval/cep/postmon.rb
148
+ - lib/brval/cep/via_cep.rb
149
+ - lib/brval/cep/widenet.rb
150
+ - lib/brval/cep_call.rb
151
+ - lib/brval/cnh.rb
152
+ - lib/brval/cnh_call.rb
153
+ - lib/brval/cnpj.rb
154
+ - lib/brval/cnpj_call.rb
155
+ - lib/brval/cpf.rb
156
+ - lib/brval/cpf_call.rb
157
+ - lib/brval/credit_card.rb
158
+ - lib/brval/credit_card_call.rb
159
+ - lib/brval/lawsuit.rb
160
+ - lib/brval/lawsuit_call.rb
161
+ - lib/brval/pis.rb
162
+ - lib/brval/pis_call.rb
163
+ - lib/brval/renavam.rb
164
+ - lib/brval/renavam_call.rb
165
+ - lib/brval/te.rb
166
+ - lib/brval/te_call.rb
167
+ - lib/brval/val.rb
168
+ - lib/brval/version.rb
169
+ homepage: https://github.com/wr2net/brval
170
+ licenses:
171
+ - MIT
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 2.7.6.3
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: Gem to validates many Brazilian codes
193
+ test_files: []