nuban 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb88f1194e1785b1cd03c7f7b3e37a97b415063411bc9e2f420a0ad52f576058
4
+ data.tar.gz: 1003622e5c791780aa157596fb47c7a3763c04ecf07c04c87c26b68ba6d99a2e
5
+ SHA512:
6
+ metadata.gz: f730bd61ed4328df7f131d12619af5bbfca600e52c42236268923481398a0fe0809455cc36e5a2d59c402e93c6180f4f70079a65cf51abe70bb25c766003e9eb
7
+ data.tar.gz: 588d59aea41af6fb5648ae7086e46b90165d2d704b50cef1e8be9d3ac4ffa010464679754b895c00cc9fd9e59056ce50c9f65f06ad1e775b85cdaed620f27494
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 samuel52
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.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Nuban
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nuban`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'nuban'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install nuban
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nuban.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/lib/nuban.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "nuban/version"
2
+ require "nuban/core.rb"
3
+
4
+ module Nigerian
5
+ class Nuban
6
+ def self.generate_nuban(bankcode, serial)
7
+ Core.decode(bankcode, serial)
8
+ end
9
+ end
10
+ end
data/lib/nuban/core.rb ADDED
@@ -0,0 +1,25 @@
1
+ module Core
2
+ def self.decode(bankcode, serial)
3
+ bankCode = bankcode
4
+ bankCodeSplit = bankCode.to_s.split('').map(&:to_i)
5
+ serialNuber = serial
6
+
7
+ serialNuberSplit = serialNuber.to_s.split('').map(&:to_i)
8
+ calculateNuban = (bankCodeSplit[0]*3+bankCodeSplit[2]*7+bankCodeSplit[2]*3+serialNuberSplit[0]*3+serialNuberSplit[1]*7+serialNuberSplit[2]*3+serialNuberSplit[3]*3+serialNuberSplit[4]*7+serialNuberSplit[5]*3+serialNuberSplit[6]*3+serialNuberSplit[7]*7+serialNuberSplit[8]*3)
9
+ standardNumber = 10
10
+
11
+ makeModulos = calculateNuban %= standardNumber
12
+
13
+ checkDigit = makeModulos - standardNumber
14
+ completedNuban = "#{serialNuber}#{checkDigit}"
15
+
16
+ # spinner loader
17
+ loading = 0.step(100, 5) do |i|
18
+ printf("\rGenerating: [%-20s]", "=" * (i/5))
19
+ sleep(0.10)
20
+ end
21
+ puts loading
22
+ puts "Voila! here's your NUBAN"
23
+ return completedNuban
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Nuban
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nuban
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - samuel52
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-05-24 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.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Used for geanrating NUBAN via ruby API
56
+ email:
57
+ - samuelsadiq52@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE.txt
63
+ - README.md
64
+ - lib/nuban.rb
65
+ - lib/nuban/core.rb
66
+ - lib/nuban/version.rb
67
+ homepage: https://github.com/samuel52/nigeria-nuban-number.git
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.7.9
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Nigerian Uniform Bank Account Number Generator
91
+ test_files: []