mxn_banks 0.1.4 → 0.1.5

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: 6664301549097899dddac52742d96c6673b6649f
4
- data.tar.gz: 6bc4a27ca4b272271ecb460036c0918ab2db029f
3
+ metadata.gz: b060b7b302269b73e42c7fce7e8515dcf814fa14
4
+ data.tar.gz: e4949a102809f5996f4a76ecd0652a0cfe2901e1
5
5
  SHA512:
6
- metadata.gz: c3d1e3bfda70db2f7b03703dcbc285e6ab00246ad06ed436b624b754613d234d867d0bdc78c4fea79177b9a843c6029b00953ca20a99ed8449bcc11e95091eeb
7
- data.tar.gz: 292e8f1d4707e4fecb11e22fa623ab68215b868315ff978c218a44383125b2e86d7b87e759c672884fd6e16e38cd532c82cb3ad627328088d2b728671bf18d7b
6
+ metadata.gz: 0b72871668775bde8303e868e2c85ba1dfbd1a3a92f844579ce650e7029fe6c0c34736b944e31b7678b98c350cdced9d80fb38c001d9f2ab85b41f96b13d5038
7
+ data.tar.gz: 8a4ff4a55aba83cd9b6520d15b6708d2b869142c2c82900331712ffa615e957751095e111eec61423830f3973709108c0b1d449cfca7d26f3225e25503c440ef
@@ -10,6 +10,12 @@ Metrics/LineLength:
10
10
  Style/Documentation:
11
11
  Enabled: false
12
12
 
13
+ Metrics/AbcSize:
14
+ Max: 16
15
+
16
+ Style/SignalException:
17
+ EnforcedStyle: semantic
18
+
13
19
  Metrics/BlockLength:
14
20
  Exclude:
15
21
  - '*.gemspec'
@@ -2,186 +2,191 @@
2
2
  {
3
3
  "number": "012",
4
4
  "name": "BBVA Bancomer, S.A.",
5
- "abreviate": "BBVA BANCOMER"
5
+ "abbreviate": "BBVA BANCOMER"
6
6
  },
7
7
  {
8
8
  "number": "014",
9
9
  "name": "Banco Santander, S.A.",
10
- "abreviate": "SANTANDER"
10
+ "abbreviate": "SANTANDER"
11
11
  },
12
12
  {
13
13
  "number": "019",
14
14
  "name": "Banco Nacional del Ejército, Fuerza Aérea y Armada, S.N.C.",
15
- "abreviate": "BANJERCITO"
15
+ "abbreviate": "BANJERCITO"
16
16
  },
17
17
  {
18
18
  "number": "002",
19
19
  "name": "Banco Nacional de México, S.A.",
20
- "abreviate": "BANAMEX"
20
+ "abbreviate": "BANAMEX"
21
21
  },
22
22
  {
23
23
  "number": "021",
24
24
  "name": "HSBC México, S.A.",
25
- "abreviate": "HSBC"
25
+ "abbreviate": "HSBC"
26
26
  },
27
27
  {
28
28
  "number": "022",
29
29
  "name": "GE Money Bank, S.A.",
30
- "abreviate": "GE MONEY"
30
+ "abbreviate": "GE MONEY"
31
31
  },
32
32
  {
33
33
  "number": "030",
34
34
  "name": "Banco del Bajío, S.A.",
35
- "abreviate": "BAJÍO"
35
+ "abbreviate": "BAJÍO"
36
36
  },
37
37
  {
38
38
  "number": "032",
39
39
  "name": "IXE Banco, S.A.",
40
- "abreviate": "IXE"
40
+ "abbreviate": "IXE"
41
41
  },
42
42
  {
43
43
  "number": "036",
44
44
  "name": "Banco Inbursa, S.A.",
45
- "abreviate": "INBURSA"
45
+ "abbreviate": "INBURSA"
46
46
  },
47
47
  {
48
48
  "number": "037",
49
49
  "name": "Banco Interacciones, S.A.",
50
- "abreviate": "INTERACCIONES"
50
+ "abbreviate": "INTERACCIONES"
51
51
  },
52
52
  {
53
53
  "number": "042",
54
54
  "name": "Banca Mifel, S.A.",
55
- "abreviate": "MIFEL"
55
+ "abbreviate": "MIFEL"
56
56
  },
57
57
  {
58
58
  "number": "044",
59
59
  "name": "Scotiabank Inverlat, S.A.",
60
- "abreviate": "SCOTIABANK"
60
+ "abbreviate": "SCOTIABANK"
61
61
  },
62
62
  {
63
63
  "number": "058",
64
64
  "name": "Banco Regional de Monterrey, S.A.",
65
- "abreviate": "BANREGIO"
65
+ "abbreviate": "BANREGIO"
66
66
  },
67
67
  {
68
68
  "number": "059",
69
69
  "name": "Banco Invex, S.A.",
70
- "abreviate": "INVEX"
70
+ "abbreviate": "INVEX"
71
71
  },
72
72
  {
73
73
  "number": "060",
74
74
  "name": "Bansi, S.A.",
75
- "abreviate": "BANSI"
75
+ "abbreviate": "BANSI"
76
76
  },
77
77
  {
78
78
  "number": "062",
79
79
  "name": "Banca Afirme, S.A.",
80
- "abreviate": "AFIRME"
80
+ "abbreviate": "AFIRME"
81
81
  },
82
82
  {
83
83
  "number": "072",
84
84
  "name": "Banco Mercantil del Norte, S.A.",
85
- "abreviate": "BANORTE"
85
+ "abbreviate": "BANORTE"
86
86
  },
87
87
  {
88
88
  "number": "103",
89
89
  "name": "American Express Bank (México), S.A.",
90
- "abreviate": "AMERICAN EXPRESS"
90
+ "abbreviate": "AMERICAN EXPRESS"
91
91
  },
92
92
  {
93
93
  "number": "112",
94
94
  "name": "Banco Monex, S.A.",
95
- "abreviate": "BMONEX"
95
+ "abbreviate": "BMONEX"
96
96
  },
97
97
  {
98
98
  "number": "113",
99
99
  "name": "Banco Ve por Mas, S.A.",
100
- "abreviate": "VE POR MAS"
100
+ "abbreviate": "VE POR MAS"
101
101
  },
102
102
  {
103
103
  "number": "127",
104
104
  "name": "Banco Azteca, S.A.",
105
- "abreviate": "AZTECA"
105
+ "abbreviate": "AZTECA"
106
106
  },
107
107
  {
108
108
  "number": "128",
109
109
  "name": "Banco Autofin México, S.A.",
110
- "abreviate": "AUTOFIN"
110
+ "abbreviate": "AUTOFIN"
111
111
  },
112
112
  {
113
113
  "number": "130",
114
114
  "name": "Banco Compartamos, S.A.",
115
- "abreviate": "COMPARTAMOS"
115
+ "abbreviate": "COMPARTAMOS"
116
116
  },
117
117
  {
118
118
  "number": "131",
119
119
  "name": "Banco Ahorro Famsa, S.A.",
120
- "abreviate": "FAMSA"
120
+ "abbreviate": "FAMSA"
121
121
  },
122
122
  {
123
123
  "number": "132",
124
124
  "name": "Banco Multiva, S.A.",
125
- "abreviate": "BMULTIVA"
125
+ "abbreviate": "BMULTIVA"
126
126
  },
127
127
  {
128
128
  "number": "134",
129
129
  "name": "Banco Wal Mart de México Adelante, S.A.",
130
- "abreviate": "WAL-MART"
130
+ "abbreviate": "WAL-MART"
131
131
  },
132
132
  {
133
133
  "number": "135",
134
134
  "name": "Nacional Financiera, S.N.C.",
135
- "abreviate": "NAFIN"
135
+ "abbreviate": "NAFIN"
136
136
  },
137
137
  {
138
138
  "number": "136",
139
139
  "name": "Banco Regional, S.A.",
140
- "abreviate": "REGIONAL"
140
+ "abbreviate": "REGIONAL"
141
141
  },
142
142
  {
143
143
  "number": "137",
144
144
  "name": "BanCoppel, S.A.",
145
- "abreviate": "BANCOPPEL"
145
+ "abbreviate": "BANCOPPEL"
146
146
  },
147
147
  {
148
148
  "number": "138",
149
149
  "name": "Banco Amigo, S.A.",
150
- "abreviate": "AMIGO"
150
+ "abbreviate": "AMIGO"
151
151
  },
152
152
  {
153
153
  "number": "139",
154
154
  "name": "UBS Banco, S.A.",
155
- "abreviate": "UBS BANK"
155
+ "abbreviate": "UBS BANK"
156
156
  },
157
157
  {
158
158
  "number": "140",
159
159
  "name": "Banco Fácil, S.A.",
160
- "abreviate": "FÁCIL"
160
+ "abbreviate": "FÁCIL"
161
161
  },
162
162
  {
163
163
  "number": "143",
164
164
  "name": "Consultoría Internacional Banco, S.A.",
165
- "abreviate": "CIBanco"
165
+ "abbreviate": "CIBanco"
166
166
  },
167
167
  {
168
168
  "number": "145",
169
169
  "name": "Banco BASE, S.A. de I.B.M.",
170
- "abreviate": "BBASE"
170
+ "abbreviate": "BBASE"
171
171
  },
172
172
  {
173
173
  "number": "147",
174
174
  "name": "Bankaool, S.A., Institución de Banca Múltiple",
175
- "abreviate": "BANKAOOL"
175
+ "abbreviate": "BANKAOOL"
176
176
  },
177
177
  {
178
178
  "number": "150",
179
179
  "name": "Banco Inmobiliario Mexicano, S.A., Institución de Banca Múltiple",
180
- "abreviate": "BIM"
180
+ "abbreviate": "BIM"
181
+ },
182
+ {
183
+ "number": "156",
184
+ "name": "Banco Sabadell, S.A., Institución de Banca Múltiple",
185
+ "abbreviate": "SABADELL"
181
186
  },
182
187
  {
183
188
  "number": "166",
184
189
  "name": "Banco del Ahorro Nacional y Servicios Financieros, S.N.C.",
185
- "abreviate": "BANSEFI"
190
+ "abbreviate": "BANSEFI"
186
191
  }
187
192
  ]
@@ -2,9 +2,10 @@ require 'mxn_banks/version'
2
2
 
3
3
  module MxnBanks
4
4
  autoload :Bank, 'mxn_banks/bank'
5
+
5
6
  def self.from_iban(num)
6
7
  a = to_hash.select { |b| b[:number] == num.slice(0, 3) }
7
- fail ArgumentError,'Invalid bank code' if a.empty?
8
+ fail ArgumentError, 'Invalid bank code' if a.empty?
8
9
  Bank.new(a.first)
9
10
  end
10
11
 
@@ -15,21 +16,19 @@ module MxnBanks
15
16
 
16
17
  def self.valid?(clabe)
17
18
  return false if clabe.length < 18
18
- sliced_clabe = clabe.slice(0,17).split('')
19
+ sliced_clabe = clabe.slice(0, 17).split('')
19
20
  w_factor = weight(sliced_clabe)
20
- module_ten = sliced_clabe.map.with_index { |n, i| (n.to_i * w_factor[i]).modulo(10) }
21
+ module_ten = sliced_clabe.map.with_index { |n, i| (n.to_i * w_factor[i]).modulo(10) }
21
22
  clabe.slice(-1).to_i == current_control_digit(module_ten)
22
23
  end
23
24
 
24
- private
25
-
26
- def self.weight(clabe)
27
- w_factor = { 0 => 3, 1 => 7, 2 => 1 }
28
- clabe.map.with_index { |n, i| w_factor[i.to_i.modulo(3)] }
29
- end
25
+ def self.weight(clabe)
26
+ w_factor = { 0 => 3, 1 => 7, 2 => 1 }
27
+ clabe.map.with_index { |_n, i| w_factor[i.to_i.modulo(3)] }
28
+ end
30
29
 
31
- def self.current_control_digit(arr)
32
- module_sum = arr.reduce { |sum, n| sum + n }
33
- (10 - module_sum.modulo(10)).modulo(10)
34
- end
30
+ def self.current_control_digit(arr)
31
+ module_sum = arr.reduce { |a, e| a + e }
32
+ (10 - module_sum.modulo(10)).modulo(10)
33
+ end
35
34
  end
@@ -1,11 +1,11 @@
1
1
  module MxnBanks
2
2
  class Bank
3
- attr_reader :name, :number, :abreviate
3
+ attr_reader :name, :number, :abbreviate
4
4
 
5
5
  def initialize(args)
6
6
  @name = args[:name]
7
7
  @number = args[:number]
8
- @abreviate = args[:abreviate]
8
+ @abbreviate = args[:abbreviate]
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module MxnBanks
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['aldosolorzanop@gmail.com']
12
12
 
13
13
  spec.summary = 'Get mexican banks from IBAN'
14
- spec.homepage = 'https://github.com/aldosolorzano/mxn_banks'
14
+ spec.homepage = 'https://github.com/coincovemx/mxn-banks'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mxn_banks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - aldosolorzano
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-04 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
+ - ".rubocop.yml"
92
93
  - ".travis.yml"
93
94
  - Gemfile
94
95
  - LICENSE.txt
@@ -101,8 +102,7 @@ files:
101
102
  - lib/mxn_banks/bank.rb
102
103
  - lib/mxn_banks/version.rb
103
104
  - mxn_banks.gemspec
104
- - rubocop.yml
105
- homepage: https://github.com/aldosolorzano/mxn_banks
105
+ homepage: https://github.com/coincovemx/mxn-banks
106
106
  licenses:
107
107
  - MIT
108
108
  metadata: {}
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.4.8
125
+ rubygems_version: 2.2.2
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Get mexican banks from IBAN