turkish_id 1.6.0 → 1.7.0
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/.github/workflows/test.yml +8 -8
- data/.standard.yml +2 -0
- data/.tool-versions +1 -1
- data/Gemfile +1 -1
- data/README.md +15 -5
- data/lib/turkish_id/version.rb +1 -1
- data/lib/turkish_id.rb +27 -0
- data/turkish_id.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b8abdc9bb5dc2b2bb721990db44663d403376190b9b9d770d6502c675ae2fb
|
4
|
+
data.tar.gz: ffee10dde194306faa0994f5514967cc5490448614d5851ccf66f4017356f8ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc55bb2c2598b2a6f78d55d3769ac9f68ea4cb92063efe87fc9b04c3049e8f61496be88ef765690f0d58519959314414187b3eabcda642e3411dba1557b1382
|
7
|
+
data.tar.gz: 7c02d3dfa054a5036927cca7428fdd3d42bb2cbe019ef4afa6a8484c579ab5cf7c7a378ed792af5f1bda76d06c90c64dd224cb3fd7e29c6a3735082514e3f700
|
data/.github/workflows/test.yml
CHANGED
@@ -18,35 +18,35 @@ jobs:
|
|
18
18
|
strategy:
|
19
19
|
fail-fast: false
|
20
20
|
matrix:
|
21
|
-
ruby: ["
|
21
|
+
ruby: ["3.3.5", "3.2.6", "3.1.6", "3.0.7"]
|
22
22
|
|
23
23
|
steps:
|
24
|
-
- uses: actions/checkout@
|
24
|
+
- uses: actions/checkout@v4
|
25
25
|
- uses: ruby/setup-ruby@v1
|
26
26
|
with:
|
27
27
|
ruby-version: ${{ matrix.ruby }}
|
28
28
|
bundler-cache: true
|
29
29
|
|
30
30
|
- name: StandardRB
|
31
|
-
continue-on-error: ${{ matrix.experimental }}
|
32
31
|
run: bundle exec standardrb --parallel --format progress
|
33
32
|
|
34
33
|
test:
|
35
34
|
needs: [lint]
|
36
|
-
runs-on:
|
35
|
+
runs-on: ${{ matrix.os }}
|
37
36
|
name: test ${{ matrix.ruby }}
|
38
37
|
strategy:
|
39
38
|
fail-fast: false
|
40
39
|
matrix:
|
41
|
-
|
40
|
+
os: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04", "macos-12", "macos-13", "macos-14"]
|
41
|
+
ruby: ["3.3.5", "3.2.6", "3.1.6", "3.0.7", "ruby-head"]
|
42
42
|
|
43
43
|
steps:
|
44
|
-
- uses: actions/checkout@
|
44
|
+
- uses: actions/checkout@v4
|
45
45
|
- uses: ruby/setup-ruby@v1
|
46
46
|
with:
|
47
47
|
ruby-version: ${{ matrix.ruby }}
|
48
|
+
rubygems: latest
|
48
49
|
bundler-cache: true
|
49
|
-
|
50
50
|
- name: Test
|
51
|
-
continue-on-error: ${{ matrix.
|
51
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
52
52
|
run: bundle exec rake
|
data/.standard.yml
ADDED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.3.5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -56,6 +56,16 @@ Use ```registered?``` method to query the government registry:
|
|
56
56
|
identity_number.registered?("Ahmet", "Yılmaz", 1987) #=> false
|
57
57
|
```
|
58
58
|
|
59
|
+
There is also a convenience method called `not_in_registry?` which is the logical equivalent of `!registered?`.
|
60
|
+
|
61
|
+
Use ```foreigner_registered?``` method to query the foreigner registry:
|
62
|
+
|
63
|
+
```rb
|
64
|
+
identity_number.foreigner_registered?("Yukihiro", "Matsumoto", 14, 4, 1965) #=> false
|
65
|
+
```
|
66
|
+
|
67
|
+
There is also a convenience method called `foreigner_not_in_registry?` which is the logical equivalent of `!foreigner_registered?`.
|
68
|
+
|
59
69
|
### Generating Relatives
|
60
70
|
|
61
71
|
You can generate ID numbers for your younger or elder relatives.
|
@@ -146,10 +156,10 @@ Remember that a valid identification number does not imply the existence of an I
|
|
146
156
|
|
147
157
|
This gem is used in production and tested against the following Ruby versions:
|
148
158
|
|
149
|
-
- ✅ `3.
|
150
|
-
- ✅ `3.
|
151
|
-
- ⏳ `3.
|
152
|
-
- 🪦 `
|
159
|
+
- ✅ `3.3.5` (stable)
|
160
|
+
- ✅ `3.2.6` (stable)
|
161
|
+
- ⏳ `3.1.6` (security maintenance)
|
162
|
+
- 🪦 `3.0.7` (end of life)
|
153
163
|
|
154
164
|
## Development
|
155
165
|
|
@@ -175,7 +185,7 @@ Yes.
|
|
175
185
|
|
176
186
|
## License
|
177
187
|
|
178
|
-
Copyright © 2015-
|
188
|
+
Copyright © 2015-2024 [Kerem Bozdas][Personal Webpage]
|
179
189
|
|
180
190
|
This gem is available under the terms of the [MIT License][License].
|
181
191
|
|
data/lib/turkish_id/version.rb
CHANGED
data/lib/turkish_id.rb
CHANGED
@@ -28,6 +28,14 @@ class TurkishId
|
|
28
28
|
!valid? || !query_government_registry(given_name, surname, year_of_birth)
|
29
29
|
end
|
30
30
|
|
31
|
+
def foreigner_registered?(given_name, surname, year_of_birth, month_of_birth, day_of_birth)
|
32
|
+
valid? && query_foreigner_registry(given_name, surname, year_of_birth, month_of_birth, day_of_birth)
|
33
|
+
end
|
34
|
+
|
35
|
+
def foreigner_not_in_registry?(given_name, surname, day_of_birth, month_of_birth, year_of_birth)
|
36
|
+
!valid? || !query_foreigner_registry(given_name, surname, day_of_birth, month_of_birth, year_of_birth)
|
37
|
+
end
|
38
|
+
|
31
39
|
private
|
32
40
|
|
33
41
|
def calculate_checksum(id_array)
|
@@ -99,4 +107,23 @@ class TurkishId
|
|
99
107
|
rescue TypeError, ArgumentError, NoMethodError
|
100
108
|
false
|
101
109
|
end
|
110
|
+
|
111
|
+
def query_foreigner_registry(given_name, surname, day_of_birth, month_of_birth, year_of_birth)
|
112
|
+
return false unless Integer(day_of_birth).between?(1, 31)
|
113
|
+
return false unless Integer(month_of_birth).between?(1, 12)
|
114
|
+
|
115
|
+
client = Savon.client(wsdl: "https://tckimlik.nvi.gov.tr/Service/KPSPublicYabanciDogrula.asmx?WSDL")
|
116
|
+
response = client.call(:yabanci_kimlik_no_dogrula, message: {
|
117
|
+
"KimlikNo" => join_num(@id_number),
|
118
|
+
"Ad" => given_name.upcase(:turkic),
|
119
|
+
"Soyad" => surname.upcase(:turkic),
|
120
|
+
"DogumGun" => String(Integer(day_of_birth)),
|
121
|
+
"DogumAy" => String(Integer(month_of_birth)),
|
122
|
+
"DogumYil" => String(Date.new(Integer(year_of_birth)).year)
|
123
|
+
})
|
124
|
+
|
125
|
+
response.body.dig(:yabanci_kimlik_no_dogrula_response, :yabanci_kimlik_no_dogrula_result).is_a?(TrueClass)
|
126
|
+
rescue TypeError, ArgumentError, NoMethodError
|
127
|
+
false
|
128
|
+
end
|
102
129
|
end
|
data/turkish_id.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "rspec"
|
27
27
|
spec.add_development_dependency "standard"
|
28
|
+
spec.add_development_dependency "standard-rails"
|
28
29
|
spec.add_development_dependency "vcr"
|
29
30
|
spec.add_development_dependency "webmock"
|
30
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kerem Bozdas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: vcr
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +148,7 @@ files:
|
|
134
148
|
- ".github/workflows/test.yml"
|
135
149
|
- ".gitignore"
|
136
150
|
- ".rspec"
|
151
|
+
- ".standard.yml"
|
137
152
|
- ".tool-versions"
|
138
153
|
- Gemfile
|
139
154
|
- LICENSE.txt
|
@@ -165,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
180
|
- !ruby/object:Gem::Version
|
166
181
|
version: '0'
|
167
182
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
183
|
+
rubygems_version: 3.5.16
|
169
184
|
signing_key:
|
170
185
|
specification_version: 4
|
171
186
|
summary: Validate Turkish Identification Numbers and More!
|