rfc_facil 1.0.0 → 1.2.3

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
- SHA1:
3
- metadata.gz: 13be1b95f84eeda13a0db0fef85d61561db1f8cd
4
- data.tar.gz: a0927464ec27e36164f7a2f81b168dc6da322690
2
+ SHA256:
3
+ metadata.gz: 6138ffabf361b38bfdbb6dd7b0b14c519979c5e738e44282caba604bee642095
4
+ data.tar.gz: 99c357e9151225a60ad44ecb78752304fbeb4550785c05227b41d3ff160ae09d
5
5
  SHA512:
6
- metadata.gz: 8f8e93171358b4cc72b4082235fbf2d562595caf7b7c4781319e1b43edc42b62182a4b6de36d124dc69f3de6d7d1685792ecc962b72a987bd5f23dbfaf694170
7
- data.tar.gz: bd7f631ffce63eafde81dac49bb1c1c4b214c8cb33b3ea1121a638de7e762f168146576f9da55e33e4f7cb6270b785ddbf92addd6d8e34910cabce2b7be22b3f
6
+ metadata.gz: 7c4ead213fff630506e97a260204ca43113c84d899379c0b7c1958d9b6905711a480175ce656515c0195197a0d775934ea3b431538547bd77aefb59409a5ea42
7
+ data.tar.gz: 8ee600d23fa0a8a2bf8a96653bf4f7f15147e5395c10838139294393c4b8a23479527ef075bbc07299f806d524b79268630bc3c93332a7d346de663405554d01
data/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
  [![Code Climate](https://codeclimate.com/github/Munett/rfc_facil/badges/gpa.svg)](https://codeclimate.com/github/Munett/rfc_facil)
3
3
  [![Test Coverage](https://codeclimate.com/github/Munett/rfc_facil/badges/coverage.svg)](https://codeclimate.com/github/Munett/rfc_facil/coverage)
4
4
 
5
- ![](https://github.com/acrogenesis/rfc_facil/raw/master/logo.png)
5
+ ![](https://github.com/Munett/rfc_facil/raw/master/logo.png)
6
6
 
7
7
  Libreria para calcular el Registro Federal de Contribuyentes en México (RFC) en Ruby.
8
8
 
9
- [![Build Status](https://travis-ci.org/acrogenesis/rfc_facil.svg?branch=master)](https://travis-ci.org/acrogenesis/rfc_facil)
9
+ [![Build Status](https://travis-ci.org/Munett/rfc_facil.svg?branch=master)](https://travis-ci.org/Munett/rfc_facil)
10
10
 
11
11
  ## Uso
12
12
 
@@ -22,8 +22,11 @@ rfc.to_s # => 'RAAA921127RI6'
22
22
  ## Fuente
23
23
  Esta librería se basa en documentación oficial obtenida por medio del IFAI (Instituto Federal de Acceso a la Información). El documento puede ser consultado en el sitio de [INFOMEX](https://www.infomex.org.mx/gobiernofederal/moduloPublico/moduloPublico.action) con el folio 0610100135506.
24
24
 
25
+ ## En otros lenguajes
26
+ - .NET [migsalazar/RfcFacil](https://github.com/migsalazar/RfcFacil)
27
+
25
28
  ### Agradecimiento
26
29
  El código es una version en Ruby de [rfc-facil](https://github.com/josketres/rfc-facil) hecha en Java por [josketres](https://github.com/josketres)
27
30
 
28
31
  ## Colabora
29
- Errores y pull requests son bienvenidos en Github: https://github.com/acrogenesis/rfc_facil.
32
+ Errores y pull requests son bienvenidos en Github: https://github.com/Munett/rfc_facil.
data/lib/rfc_facil.rb CHANGED
@@ -9,5 +9,5 @@ require 'rfc_facil/verification_digit_calculator'
9
9
  require 'i18n'
10
10
  require 'unicode_utils/upcase'
11
11
  module RfcFacil
12
- I18n.available_locales = :en
12
+ I18n.available_locales ||= :en
13
13
  end
@@ -76,11 +76,7 @@ module RfcFacil
76
76
  end
77
77
 
78
78
  def filter_name(name)
79
- raw_name = normalize(name).strip
80
- if raw_name.include?(' ') && (raw_name.start_with?('MARIA', 'JOSE'))
81
- return raw_name.split(' ')[1]
82
- end
83
- name
79
+ normalize(name).strip.sub(/^(MA|MA\.|MARIA|JOSE)\s+/, "")
84
80
  end
85
81
 
86
82
  def formatted_in_two_digits(number)
@@ -22,8 +22,7 @@ module RfcFacil
22
22
  reminder = sum % 11
23
23
 
24
24
  return '0' if reminder == 0
25
- return 'A' if reminder == 10
26
- (11 - reminder).to_s
25
+ (11 - reminder).to_s(16).upcase # from 1 to A (hex)
27
26
  end
28
27
 
29
28
  def map_digit(c)
@@ -1,3 +1,3 @@
1
1
  module RfcFacil
2
- VERSION = '1.0.0'
2
+ VERSION = '1.2.3'
3
3
  end
data/rfc_facil.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'i18n', '~> 0.7.0'
22
- spec.add_dependency 'unicode_utils', '~> 1.4'
21
+ spec.add_dependency 'i18n'
22
+ spec.add_dependency 'unicode_utils'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.10'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -7,14 +7,46 @@ class TestRfc < Minitest::Test
7
7
  assert_equal('RI', rfc.homoclave)
8
8
  assert_equal('6', rfc.verification_digit)
9
9
  assert_equal('RAAA921127RI6', rfc.to_s)
10
+
11
+ rfc = RfcFacil::Rfc.new(name: 'ELIUD', first_last_name: 'OROZCO',
12
+ second_last_name: 'GOMEZ', day: 11, month: 7, year: 1952)
13
+
14
+ assert_equal('OOGE520711', rfc.ten_digits_code)
15
+ assert_equal('15', rfc.homoclave)
16
+ assert_equal('1', rfc.verification_digit)
17
+ assert_equal('OOGE520711151', rfc.to_s)
18
+
19
+ rfc = RfcFacil::Rfc.new(name: 'SATURNINA', first_last_name: 'ANGEL',
20
+ second_last_name: 'CRUZ', day: 12, month: 11, year: 1921)
21
+
22
+ assert_equal('AECS211112', rfc.ten_digits_code)
23
+ assert_equal('JP', rfc.homoclave)
24
+ assert_equal('A', rfc.verification_digit)
25
+ assert_equal('AECS211112JPA', rfc.to_s)
26
+
27
+ rfc = RfcFacil::Rfc.new(name: 'MARCO ANTONIO', first_last_name: 'CANO',
28
+ second_last_name: 'BARRAZA', day: 25, month: 1, year: 1982)
29
+
30
+ assert_equal('CABM820125', rfc.ten_digits_code)
31
+ assert_equal('48', rfc.homoclave)
32
+ assert_equal('1', rfc.verification_digit)
33
+ assert_equal('CABM820125481', rfc.to_s)
34
+
35
+ rfc = RfcFacil::Rfc.new(name: 'MA GLORIA', first_last_name: 'NAVARRO',
36
+ second_last_name: 'VILLASANA', day: 29, month: 3, year: 1956)
37
+
38
+ assert_equal('NAVG560329', rfc.ten_digits_code)
39
+ assert_equal('62', rfc.homoclave)
40
+ assert_equal('1', rfc.verification_digit)
41
+ assert_equal('NAVG560329621', rfc.to_s)
10
42
  end
11
43
 
12
44
  def test_rfc_for_a_juristic_person
13
45
  _rfc = RfcFacil::Rfc.new(legal_name: 'Mu Networks S.A.P.I de C.V.', day: 10, month: 07, year: 2014)
14
46
 
15
- # assertThat(rfc.tenDigitsCode, equalTo("SIA-821129"));
16
- # assertThat(rfc.homoclave, equalTo("CK"));
17
- # assertThat(rfc.verificationDigit, equalTo("6"));
18
- # assertThat(rfc.toString(), equalTo("ZATJ870805CK6"));
47
+ # assert_equal('MNE140710', rfc.ten_digits_code)
48
+ # assert_equal('7G', rfc.homoclave)
49
+ # assert_equal('8', rfc.verification_digit)
50
+ # assert_equal('MNE1407107G8', rfc.to_s)
19
51
  end
20
52
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfc_facil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Rangel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: unicode_utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.4'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.4'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.4'
97
- description:
97
+ description:
98
98
  email:
99
99
  - adrian.rangel@gmail.com
100
100
  executables: []
@@ -129,7 +129,7 @@ homepage: https://acrogenesis.com/rfc_facil/
129
129
  licenses:
130
130
  - MIT
131
131
  metadata: {}
132
- post_install_message:
132
+ post_install_message:
133
133
  rdoc_options: []
134
134
  require_paths:
135
135
  - lib
@@ -144,10 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.5.1
149
- signing_key:
147
+ rubygems_version: 3.1.2
148
+ signing_key:
150
149
  specification_version: 4
151
150
  summary: Libreria para calcular el Registro Federal de Contribuyentes en México (RFC).
152
151
  test_files: []
153
- has_rdoc: