cuculungwa 0.0.48 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cuculungwa.rb +31 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfc1259dfc62bce9af99e434f65700333676ac4a
4
- data.tar.gz: ee495c75482a8fa6f7e45aa2ff8c881296d356aa
3
+ metadata.gz: 9f45bf3c17ffb6579693b551a541e8030c9193f7
4
+ data.tar.gz: 9a4a89d19d083c1db6477dd45ac5b50b3243a26f
5
5
  SHA512:
6
- metadata.gz: 617718c27f0c78165edfceef5c40c6337ead5813d32d2da43837dbe1ba726ba908431c81cbacf05e5f5fe450df014fd45f4488e70cbc3dcd655f546c7d135771
7
- data.tar.gz: 684fe7b6e2f6f80bce7e9d046092bb412c04a4b29b3dbf3da2142a6d3d01d516774e84b63cef45079c9a906d7f1d018a281441a5977854f1d5b82a7fe158edf2
6
+ metadata.gz: 6dec2ebb0f55808b87ddb58240cbcf9380857be75b014f2fb9ba51fd31907001da7a8bb94886cbabd1eff3efc758aa89f7ac36bc3375fc6186307fbab01756ab
7
+ data.tar.gz: d7bb22bc915fdadd579f818681e68e2b32d28c15d44135db81a633e5766a6d4dd7ebd2af4516f8db274743c21d32773eb5c0b4e381ec61a6bae07701e5d520ed
data/lib/cuculungwa.rb CHANGED
@@ -129,6 +129,37 @@ module GenerateData
129
129
  return ""
130
130
  end
131
131
  end
132
+
133
+ def pl_iban_generator(data_type = 'positive_set', bank_prefix = nil, polish_format = false)
134
+ # data_type: if you want correct iban use positive_set, anything else will return 00111122223333444455556666
135
+ # bank_prefix: if you want specify bank prefix (minimum 4 and maximum 8 digits)
136
+ # polish_format: if you want add spaces for readability
137
+ bank_prefix ||= sprintf('%08d', rand(10**8))
138
+ bank_prefix = bank_prefix.to_s.gsub(/\s+/, "")
139
+
140
+ if bank_prefix.length < 4
141
+ raise 'Bank prefix error!'
142
+ end
143
+
144
+ if bank_prefix.length == 4
145
+ bank_prefix << '0001'
146
+ end
147
+
148
+ if (data_type.eql? 'positive_set')
149
+ account_no = sprintf('%016d', rand(10**16))
150
+ num = bank_prefix + account_no + "252100"
151
+ control_digit = sprintf('%02d', 98 - (num.to_i % 97))
152
+ number = control_digit + bank_prefix + account_no
153
+ else
154
+ number = '00111122223333444455556666'
155
+ end
156
+
157
+ if polish_format
158
+ number[0..1] + ' ' + number[2..-1].gsub(/(.{4})/, '\1 ').strip
159
+ else
160
+ number
161
+ end
162
+ end
132
163
  end
133
164
  World(GenerateData)
134
165
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuculungwa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.48
4
+ version: 0.0.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kaftanski
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-05-12 00:00:00.000000000 Z
14
+ date: 2015-05-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: aruba