turkish_id 1.6.0 → 1.8.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/LICENSE.txt +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 -7
- data/.github/workflows/publish.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad8d7ebeb9751bef987b19f7a0e34004402cbe3f56cb56d7d7a394eb2176fc6
|
4
|
+
data.tar.gz: 5a2e0f11470112415783ee601d3379bc44d6b963f0d6b3ce626bfba96500496b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c84a17cf7dda3448b4aa3aff303545ea8bbc92ed3a9e54cfd11715a2e9096cb66a21feee44b23db2b7987114c4fe180c21f3a7d89212a42e4d81a6b50dfe98
|
7
|
+
data.tar.gz: 56c61b35975bef496b92a610f9a883b082cda554695a7161b72a8ad880f6cc2acd2dc0c7314ca3e5e6b80e59d16a94b4666230326b0f1faadcc36c8ebd9e9509
|
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.4.1", "3.3.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-13", "macos-14", "macos-15"]
|
41
|
+
ruby: ["3.4.1", "3.3.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.4.1
|
data/Gemfile
CHANGED
data/LICENSE.txt
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.4.1` (stable)
|
160
|
+
- ✅ `3.3.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-2025 [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,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kerem Bozdas
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-01 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bundler
|
@@ -80,6 +79,20 @@ dependencies:
|
|
80
79
|
- - ">="
|
81
80
|
- !ruby/object:Gem::Version
|
82
81
|
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: standard-rails
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
83
96
|
- !ruby/object:Gem::Dependency
|
84
97
|
name: vcr
|
85
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,10 +143,10 @@ executables:
|
|
130
143
|
extensions: []
|
131
144
|
extra_rdoc_files: []
|
132
145
|
files:
|
133
|
-
- ".github/workflows/publish.yml"
|
134
146
|
- ".github/workflows/test.yml"
|
135
147
|
- ".gitignore"
|
136
148
|
- ".rspec"
|
149
|
+
- ".standard.yml"
|
137
150
|
- ".tool-versions"
|
138
151
|
- Gemfile
|
139
152
|
- LICENSE.txt
|
@@ -149,7 +162,6 @@ homepage: https://github.com/krmbzds/turkish_id
|
|
149
162
|
licenses:
|
150
163
|
- MIT
|
151
164
|
metadata: {}
|
152
|
-
post_install_message:
|
153
165
|
rdoc_options: []
|
154
166
|
require_paths:
|
155
167
|
- lib
|
@@ -165,8 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
177
|
- !ruby/object:Gem::Version
|
166
178
|
version: '0'
|
167
179
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
169
|
-
signing_key:
|
180
|
+
rubygems_version: 3.6.2
|
170
181
|
specification_version: 4
|
171
182
|
summary: Validate Turkish Identification Numbers and More!
|
172
183
|
test_files: []
|
@@ -1,24 +0,0 @@
|
|
1
|
-
name: Publish
|
2
|
-
|
3
|
-
on:
|
4
|
-
release:
|
5
|
-
types: [published]
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
build:
|
9
|
-
name: Publish Packages
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
|
12
|
-
steps:
|
13
|
-
- uses: actions/checkout@v2
|
14
|
-
|
15
|
-
- name: Set up Ruby
|
16
|
-
uses: ruby/setup-ruby@v1
|
17
|
-
with:
|
18
|
-
bundler-cache: true
|
19
|
-
|
20
|
-
- name: Publish to RubyGems
|
21
|
-
uses: dawidd6/action-publish-gem@v1
|
22
|
-
with:
|
23
|
-
api_key: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
24
|
-
|