mernis 0.1.3
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 +7 -0
- data/lib/mernis.rb +23 -0
- data/lib/mernis/request.rb +59 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7d21d94e26f037e341d1d06d7e9a838333a19f19
|
4
|
+
data.tar.gz: 29c74820ab4fa8cd2a26fe88549534eee1500121
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f352e30915f05887916e3499ed5a1ef8a10ea340139e6b59b80d4c7bbb281f700bbbe05e6e49ba82b729bd7027228f484435327ecb303927bd1d3c434a28632d
|
7
|
+
data.tar.gz: da9f1574c4012019124b64dba6157977dee26b9c3544856b211617bbb1938637d4d112d9760199c2b6e00a1cd9e7e696a8c4fd9dce6c690e39e1e8804784f140
|
data/lib/mernis.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Mernis
|
4
|
+
|
5
|
+
# Most basic usage:
|
6
|
+
# Mernis.sorgula("12345", "John", "Doe", "1990")
|
7
|
+
# Advanced usage:
|
8
|
+
# Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990")
|
9
|
+
# Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990", version = 2, log = false)
|
10
|
+
# Full usage:
|
11
|
+
# Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990",
|
12
|
+
# version = 2, open_timeout = 60, read_timeout = 60, log = false,
|
13
|
+
# wsdl: 'https://somecustomwsdl.com' )
|
14
|
+
|
15
|
+
def self.sorgula(id_number, first_name, last_name, birth_year,
|
16
|
+
version = 2, open_timeout = 60, read_timeout = 60, log = true,
|
17
|
+
wsdl: 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL')
|
18
|
+
response = Request.new(id_number, first_name, last_name, birth_year, version, open_timeout, read_timeout, log, wsdl)
|
19
|
+
response.sorgula
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'mernis/request'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'savon'
|
4
|
+
|
5
|
+
class Request
|
6
|
+
# Initialize params.
|
7
|
+
def initialize(id_number, first_name, last_name, birth_year, version, open_timeout, read_timeout, log, wsdl)
|
8
|
+
@id_number = id_number
|
9
|
+
@first_name = first_name
|
10
|
+
@last_name = last_name
|
11
|
+
@birth_year = birth_year
|
12
|
+
@version = version
|
13
|
+
@open_timeout = open_timeout
|
14
|
+
@read_timeout = read_timeout
|
15
|
+
@log = log
|
16
|
+
@wsdl = wsdl
|
17
|
+
end
|
18
|
+
|
19
|
+
# Initialize the SOAP client
|
20
|
+
def sorgula
|
21
|
+
kps_client = Savon.client(
|
22
|
+
wsdl: @wsdl,
|
23
|
+
soap_version: @version,
|
24
|
+
open_timeout: @open_timeout,
|
25
|
+
read_timeout: @read_timeout,
|
26
|
+
log: @log
|
27
|
+
)
|
28
|
+
|
29
|
+
# Create message pattern
|
30
|
+
message = {
|
31
|
+
"TCKimlikNo" => @id_number.to_s,
|
32
|
+
"Ad" => @first_name,
|
33
|
+
"Soyad" => @last_name,
|
34
|
+
"DogumYili" => @birth_year.to_s
|
35
|
+
}
|
36
|
+
|
37
|
+
# Make the SOAP request and handle errors.
|
38
|
+
begin
|
39
|
+
response = kps_client.call(:tc_kimlik_no_dogrula, message: message)
|
40
|
+
rescue Savon::SOAPFault => error
|
41
|
+
puts "SOAP fault. Error: #{error}"
|
42
|
+
rescue Savon::HTTPError => error
|
43
|
+
puts "HTTP connection error. Error: #{error}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get the SOAP response and handle errors.
|
47
|
+
begin
|
48
|
+
bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
|
49
|
+
return bool_value
|
50
|
+
rescue NoMethodError => error
|
51
|
+
response.nil? ? (puts "Errors occured. Response is nil! Error: #{error}") : (puts "There is an error with the response. Error: #{error}")
|
52
|
+
rescue Savon::InvalidResponseError => error
|
53
|
+
puts "Not a valid response! Error: #{error}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
## argüman sayısında hata varsa veya veri tipinde hata varsa onuda yakala!
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mernis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mustafa Serhat Dündar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: savon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.7.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.7.2
|
27
|
+
description: SOAP client for KPS (The Identity Information Sharing System) services
|
28
|
+
provided by Ministry of the Interior, Turkey
|
29
|
+
email: msdundars@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/mernis.rb
|
35
|
+
- lib/mernis/request.rb
|
36
|
+
homepage: https://github.com/msdundar/mernis
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 2.2.2
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: SOAP client for KPS services.
|
60
|
+
test_files: []
|