thai_id_utils 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/thai_id_utils/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6475eea4d79e998ecd38cddabe1fde552506a8be42ebe49c8bb9e53537078ee1
|
|
4
|
+
data.tar.gz: e8c623b974cbc84d7e7ae989db53ad4fb1a7db0cf1795be20b75204ec070a904
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41f37e9ed4760dc95d0fba9f271e66bce6b1e05b7a0a6e00425953517b45c2c41c8f4974857faf5f6880157252bb89980ee4ecb11829ba57c67c1d14b6a5ce71
|
|
7
|
+
data.tar.gz: 2a685abb6f8e64bd9a45d0796390e0e9389d65b6e0fc0e1d913ccc5c8274109836175c73074de3bb8a90adc380bb25b4604e90f24fce587d9ddf600a11f9ccb3
|
data/README.md
CHANGED
|
@@ -11,23 +11,24 @@ require "thai_id_utils"
|
|
|
11
11
|
|
|
12
12
|
id = "3012304567082"
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# Validate checksum / ตรวจสอบความถูกต้องของ checksum
|
|
15
15
|
if ThaiIdUtils.valid?(id)
|
|
16
16
|
puts "Valid!"
|
|
17
17
|
else
|
|
18
18
|
puts "Invalid ID"
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# Decode components / ถอดรหัสส่วนประกอบ
|
|
22
22
|
info = ThaiIdUtils.decode(id)
|
|
23
23
|
# => { category: 1, office_code: "6099", district_code: "99", sequence: "00257" }
|
|
24
24
|
puts info.inspect
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# Get category description / คำอธิบายประเภท
|
|
27
27
|
desc = ThaiIdUtils.category_description(info[:category])
|
|
28
28
|
# => "Thai nationals who were born after 1 January 1984 and had their birth notified within the given deadline (15 days)."
|
|
29
29
|
puts desc
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# Generate a new random valid ID / สร้างหมายเลขบัตรประชาชนใหม่แบบสุ่มที่ถูกต้อง
|
|
32
32
|
new_id = ThaiIdUtils.generate
|
|
33
33
|
puts new_id # => e.g. "3601205234518"
|
|
34
|
+
```
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thai_id_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chayut Orapinpatipat
|
|
@@ -41,10 +41,11 @@ files:
|
|
|
41
41
|
- Rakefile
|
|
42
42
|
- lib/thai_id_utils.rb
|
|
43
43
|
- lib/thai_id_utils/version.rb
|
|
44
|
-
homepage: https://github.com/chayuto/
|
|
44
|
+
homepage: https://github.com/chayuto/thai_id_utils
|
|
45
45
|
licenses:
|
|
46
46
|
- MIT
|
|
47
|
-
metadata:
|
|
47
|
+
metadata:
|
|
48
|
+
documentation_uri: https://github.com/chayuto/thai_id_utils#readme
|
|
48
49
|
post_install_message:
|
|
49
50
|
rdoc_options: []
|
|
50
51
|
require_paths:
|