clabe_mx 0.1.2 → 0.1.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
2
  SHA256:
3
- metadata.gz: 74415a41de9cd2ada81a3acdc40a7b2b941c646a7d44dc8ac11ae129d106d83f
4
- data.tar.gz: 89d0e366c5c0923abf30957fa5886cc7a1dfa46f2380481358c9280cb2e35cba
3
+ metadata.gz: 46e21dd8e133910ca8c9a5289dc00493e7841e9f8a0095eee18211fa10142c98
4
+ data.tar.gz: 2ee1a9db59ec9d7b1a74758492d0efa651bf6d101bcb40fc2ddcaeeaeac9f5d0
5
5
  SHA512:
6
- metadata.gz: b2dc3867e0e3e37a3545d7b070ee8bcd43083492d150c1a681d840ab0a0a836eb344462fa67dd25c1c8c39cd500348291534ea89af752bd7ae7a86ae8c21c8d7
7
- data.tar.gz: 23e486263d1d596168110d12a608642fefffb34e742e861256356a43e6d92c491c6f3d54a7991285d8372ad846727d31a538278ea7206ca5b2b61c0b8cecf29a
6
+ metadata.gz: 240968143051c0860196a415e9163fa8fa74b5862d54f21c1af061538ee000917e56718ed7bc198b459b0c6ff2277f7f6850939f7fc310c0fe0db32601b6e85e
7
+ data.tar.gz: 7ebc3979797261221965b19353fd2c4a85c2c6690f56879ce5b44b3a454fdea8a569b842d958d4b428941777af7feb88f4ea702bfbcf8de09f96dbc3d949b10e
@@ -0,0 +1,53 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ # Mac
53
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in commons.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ clabe (0.1.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rspec (3.8.0)
11
+ rspec-core (~> 3.8.0)
12
+ rspec-expectations (~> 3.8.0)
13
+ rspec-mocks (~> 3.8.0)
14
+ rspec-core (3.8.2)
15
+ rspec-support (~> 3.8.0)
16
+ rspec-expectations (3.8.4)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-mocks (3.8.1)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-support (3.8.2)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ clabe!
29
+ rspec (~> 3.8)
30
+
31
+ BUNDLED WITH
32
+ 1.17.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Yellowme
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # CLABE validator
2
+
3
+ ## Installation
4
+
5
+ - Add `gem "clabe"` to your application's Gemfile and then execute `bundle`.
6
+ - Or install it yourself as: `gem install clabe`
7
+
8
+ ## Usage
9
+
10
+ #### Validate and serialize
11
+
12
+ Successfully validation
13
+ ```ruby
14
+ CLABE = '002114016003269412'
15
+ Clabe.validate(CLABE)
16
+ # returns { is_valid: true, bank_tag: 'BANAMEX', city: 'Huixtla' }
17
+ ```
18
+
19
+ Invalid validation
20
+ ```ruby
21
+ CLABE = '002010077777777779'
22
+ Clabe.validate(CLABE)
23
+ # returns { is_valid: false, error: 'Must have a valid control digit' }
24
+ ```
25
+
26
+ ## License
27
+
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
29
+
30
+ ## Contributing
31
+
32
+ Bug reports and pull requests are welcome on GitHub at [yellowme/clabe](https://github.com/yellowme/clabe).
33
+
34
+ ## Development
35
+
36
+ After checking out the repo. run `rake spec` to run the tests.
37
+
38
+ ## Extra
39
+
40
+ Strongly based on this JS version [center-key/clabe-validator](https://github.com/center-key/clabe-validator)
41
+
@@ -0,0 +1,7 @@
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
3
+
4
+ # Default directory to look in is `/spec`
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,22 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ # Maintain your gem's version:
4
+ require "clabe/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "clabe_mx"
9
+ spec.version = Clabe::VERSION
10
+ spec.date = '2019-10-10'
11
+ spec.description = "Ruby gem to validate and get details from a CLABE"
12
+ spec.summary = "Validate and get details from a CLABE"
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ spec.authors = ["Yellowme"]
17
+ spec.email = 'hola@yellowme.mx'
18
+ spec.homepage = 'https://rubygems.org/gems/clabe'
19
+ spec.license = 'MIT'
20
+
21
+ spec.add_development_dependency "rspec", "~> 3.8"
22
+ end
@@ -0,0 +1,3 @@
1
+ module Clabe
2
+ VERSION = '0.1.3'
3
+ end
@@ -0,0 +1,33 @@
1
+ require 'clabe'
2
+
3
+ RSpec.describe 'Clabe' do
4
+ DATA_SET = [
5
+ { clabe: '12345678901234567', is_valid: false, bank_tag: nil, city: nil },
6
+ { clabe: '00000000000000000a', is_valid: false, bank_tag: nil, city: nil },
7
+ { clabe: '002010077777777779', is_valid: false, bank_tag: nil, city: nil },
8
+ { clabe: '000000000000000000', is_valid: false, bank_tag: nil, city: nil },
9
+ { clabe: '002114016003269412', is_valid: true, bank_tag: 'BANAMEX', city: 'Huixtla', code: '002' },
10
+ { clabe: '032180000118359719', is_valid: true, bank_tag: 'IXE', city: 'Atizapan, Chalco, Ciudad de México, Coacalco, Cuautitlán, Cuautitlán Izcalli, Ecatepec, Huehuetoca, Huixquilucan, Ixtapaluca, Los Reyes La Paz, Naucalpan, Nezahualcóyotl, Tecamac, Teotihuacán, Texcoco, Tlalnepantla', code: '032' }
11
+ ]
12
+
13
+ it 'validate' do
14
+ DATA_SET.each do |data|
15
+ raw_clabe = data[:clabe]
16
+ expected_validation = data[:is_valid]
17
+ expected_bank_tag = data[:bank_tag]
18
+ expected_city = data[:city]
19
+ expected_code = data[:code]
20
+
21
+ clabe_validation = Clabe.validate(raw_clabe)
22
+ actual_validation = clabe_validation.is_valid?
23
+ actual_bank_tag = clabe_validation.bank_tag
24
+ actual_city = clabe_validation.city
25
+ actual_code = clabe_validation.bank_code
26
+
27
+ expect(actual_validation).to eq(expected_validation)
28
+ expect(actual_bank_tag).to eq(expected_bank_tag)
29
+ expect(actual_city).to eq(expected_city)
30
+ expect(actual_code).to eq(expected_code)
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clabe_mx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yellowme
@@ -30,7 +30,16 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - ".gitignore"
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - clabe_mx.gemspec
33
40
  - lib/clabe.rb
41
+ - lib/clabe/version.rb
42
+ - spec/clabe_spec.rb
34
43
  homepage: https://rubygems.org/gems/clabe
35
44
  licenses:
36
45
  - MIT
@@ -55,4 +64,5 @@ rubygems_version: 2.7.6
55
64
  signing_key:
56
65
  specification_version: 4
57
66
  summary: Validate and get details from a CLABE
58
- test_files: []
67
+ test_files:
68
+ - spec/clabe_spec.rb