mernis 1.0.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94397bd5ea0255f3584432a8346df5a33876a65e
4
- data.tar.gz: a08b7869c48d961ad0a72d1818a3b48319b54596
3
+ metadata.gz: 71b408e2842e604384ce3900fd214fdf7709805c
4
+ data.tar.gz: 32ecec460b895bae79be830f91262ee4ab0d2489
5
5
  SHA512:
6
- metadata.gz: 61264c09e30901bc6a5947ac73ca7df4976586976669be62ac9c85f6ef5f580fab5bdd47cf60c6cf97f2e9b88a2f8d8088e518d17347324acf57eec22c80134b
7
- data.tar.gz: d83a060e577229e155f3b596491830932d7697fd465698a4458242d607654adfb446ee23050260760c42289809e908c8e89db833c290cc3a277e30fd45ba9b42
6
+ metadata.gz: 8754779ef890f9e45ccdb6955b3536c6aae908716279ff8950bd0225bf34f4db6f835cc86b8fd53a23aade9d3fe4e2536b3b3bead947cea3b3c5d9fc682c3d15
7
+ data.tar.gz: 4d01d9af7fe228bb21a26b07cc7968e492930fa6e857c771bc9be0b611d1e6af588a292af9a2fe12b018d3ac6597fdbd87459ae7a3c386d38ee5f23eed505540
data/README.md CHANGED
@@ -62,9 +62,9 @@ Returns true if the identity number can be validated and false if not. Both retu
62
62
 
63
63
  ```ruby
64
64
  gem build mernis.gemspec
65
- gem install ./mernis-1.0.1.gem
66
- gem push mernis-1.0.1.gem
67
- git tag -a v1.0.1 -m "Major updates"
65
+ gem install ./mernis-1.0.2.gem
66
+ gem push mernis-1.0.2.gem
67
+ git tag -a v1.0.2 -m "Major updates"
68
68
  git push --tags
69
69
  ```
70
70
 
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new do |t|
5
5
  t.test_files = FileList['test/*_test.rb']
6
6
  end
7
7
 
8
- task :default => :test
8
+ task default: :test
@@ -0,0 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version:
4
+ 2.2.3
5
+ test:
6
+ override:
7
+ - bundle exec rspec
@@ -4,19 +4,21 @@ require 'mernis/version'
4
4
 
5
5
  class Mernis
6
6
  # Most basic usage:
7
- # Mernis.sorgula("12345", "John", "Doe", "1990")
7
+ # Mernis.sorgula("12345", "John", "Doe", "1990")
8
8
  # Advanced usage:
9
- # Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990")
10
- # Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990", version = 2, log = false)
9
+ # Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990",
10
+ # version = 2, log = false)
11
11
  # Full usage:
12
- # Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990",
13
- # version = 2, open_timeout = 60, read_timeout = 60, log = false,
14
- # wsdl: 'https://somecustomwsdl.com' )
12
+ # Mernis.sorgula(id_number="12345", first_name="John", last_name="Doe", birth_year="1990",
13
+ # version = 2, open_timeout = 60, read_timeout = 60, log = false,
14
+ # wsdl: 'https://somecustomwsdl.com' )
15
15
 
16
- def self.sorgula(id_number, first_name, last_name, birth_year,
17
- version = 2, open_timeout = 60, read_timeout = 60, log = true,
18
- wsdl = "https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL")
19
- response = Request.new(id_number, first_name, last_name, birth_year, version, open_timeout, read_timeout, log, wsdl)
16
+ def self.sorgula(id_number, first_name, last_name, birth_year,
17
+ version = 2, open_timeout = 60, read_timeout = 60, log = true,
18
+ wsdl = 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL')
19
+ response = Request.new(
20
+ id_number, first_name, last_name, birth_year, version, open_timeout, read_timeout, log, wsdl
21
+ )
20
22
  response.sorgula
21
23
  end
22
24
  end
@@ -26,15 +26,15 @@ class Request
26
26
  log: @log
27
27
  )
28
28
 
29
- # Create message pattern
29
+ # Create message pattern
30
30
  message = {
31
- "TCKimlikNo" => @id_number.to_s,
32
- "Ad" => @first_name.tr('ı', 'I').tr('i', 'İ').upcase,
33
- "Soyad" => @last_name.tr('ı', 'I').tr('i', 'İ').upcase,
34
- "DogumYili" => @birth_year.to_s
31
+ 'TCKimlikNo' => @id_number.to_s,
32
+ 'Ad' => @first_name.tr('ı', 'I').tr('i', 'İ').upcase,
33
+ 'Soyad' => @last_name.tr('ı', 'I').tr('i', 'İ').upcase,
34
+ 'DogumYili' => @birth_year.to_s
35
35
  }
36
36
 
37
- # Make the SOAP request and handle errors.
37
+ # Make the SOAP request and handle errors.
38
38
  begin
39
39
  response = kps_client.call(:tc_kimlik_no_dogrula, message: message)
40
40
  rescue Savon::SOAPFault => error
@@ -43,14 +43,18 @@ class Request
43
43
  puts "HTTP connection error. Error: #{error}"
44
44
  end
45
45
 
46
- # Get the SOAP response and handle errors.
46
+ # Get the SOAP response and handle errors.
47
47
  begin
48
48
  bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
49
49
  return bool_value
50
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}")
51
+ if response.nil?
52
+ puts "Errors occured. Response is nil! Error: #{error}"
53
+ else
54
+ puts "There is an error with the response. Error: #{error}"
55
+ end
52
56
  rescue Savon::InvalidResponseError => error
53
57
  puts "Not a valid response! Error: #{error}"
54
58
  end
55
59
  end
56
- end
60
+ end
@@ -1,3 +1,3 @@
1
1
  class Mernis
2
- VERSION = "1.0.1"
3
- end
2
+ VERSION = '1.0.2'.freeze
3
+ end
@@ -4,23 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'mernis/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "mernis"
8
- s.version = "1.0.1"
7
+ s.name = 'mernis'
8
+ s.version = '1.0.2'
9
9
  s.platform = Gem::Platform::RUBY
10
- s.date = Time.now.strftime("%Y-%m-%d")
11
- s.summary = "SOAP client for KPS [MERNIS] services."
12
- s.description = "SOAP client for KPS (The Identity Information Sharing System) services provided by Ministry of the Interior, Turkey"
13
- s.author = "Mustafa Serhat Dündar"
14
- s.email = "msdundars@gmail.com"
15
- s.files = ["lib/mernis.rb", "lib/mernis/request.rb"]
16
- s.homepage = "https://github.com/msdundar/mernis"
17
- s.licenses = ["MIT"]
10
+ s.date = Time.now.strftime('%Y-%m-%d')
11
+ s.summary = 'SOAP client for KPS [MERNIS] services.'
12
+ s.description = 'SOAP client for MERNIS services provided by Ministry of the Interior, Turkey'
13
+ s.author = 'Mustafa Serhat Dündar'
14
+ s.email = 'msdundars@gmail.com'
15
+ s.files = ['lib/mernis.rb', 'lib/mernis/request.rb']
16
+ s.homepage = 'https://github.com/msdundar/mernis'
17
+ s.licenses = ['MIT']
18
18
 
19
19
  s.files = `git ls-files -z`.split("\x0")
20
20
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
21
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
- s.require_paths = ["lib"]
22
+ s.require_paths = ['lib']
23
23
 
24
- s.add_dependency "savon", "~> 2.11"
24
+ s.add_dependency "savon", '~> 2.11'
25
25
  s.required_ruby_version = '>= 2.2.0'
26
26
  end
@@ -14,44 +14,48 @@ describe 'Request' do
14
14
  end
15
15
 
16
16
  it 'returns true with correct identity' do
17
- response = @client.call(:tc_kimlik_no_dogrula, message: {
18
- "TCKimlikNo" => "11311152982",
19
- "Ad" => "Kuzey Tüner".tr('ı', 'I').tr('i', 'İ').upcase,
20
- "Soyad" => "Şenkul".tr('ı', 'I').tr('i', 'İ').upcase,
21
- "DogumYili" => "2014"
17
+ response = @client.call(:tc_kimlik_no_dogrula, message:
18
+ {
19
+ 'TCKimlikNo' => '11311152982',
20
+ 'Ad' => 'Kuzey Tüner'.tr('ı', 'I').tr('i', 'İ').upcase,
21
+ 'Soyad' => 'Şenkul'.tr('ı', 'I').tr('i', 'İ').upcase,
22
+ 'DogumYili' => '2014'
22
23
  })
23
24
  bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
24
25
  expect(bool_value).to equal(true)
25
26
  end
26
27
 
27
28
  it 'returns true with downcase characters' do
28
- response = @client.call(:tc_kimlik_no_dogrula, message: {
29
- "TCKimlikNo" => "11311152982",
30
- "Ad" => "kuzey tüner".tr('ı', 'I').tr('i', 'İ').upcase,
31
- "Soyad" => "şenkul".tr('ı', 'I').tr('i', 'İ').upcase,
32
- "DogumYili" => "2014"
29
+ response = @client.call(:tc_kimlik_no_dogrula, message:
30
+ {
31
+ 'TCKimlikNo' => '11311152982',
32
+ 'Ad' => 'kuzey tüner'.tr('ı', 'I').tr('i', 'İ').upcase,
33
+ 'Soyad' => 'şenkul'.tr('ı', 'I').tr('i', 'İ').upcase,
34
+ 'DogumYili' => '2014'
33
35
  })
34
36
  bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
35
37
  expect(bool_value).to equal(true)
36
38
  end
37
39
 
38
40
  it 'returns true with upcase characters' do
39
- response = @client.call(:tc_kimlik_no_dogrula, message: {
40
- "TCKimlikNo" => "11311152982",
41
- "Ad" => "KUZEY TÜNER".tr('ı', 'I').tr('i', 'İ').upcase,
42
- "Soyad" => "ŞENKUL".tr('ı', 'I').tr('i', 'İ').upcase,
43
- "DogumYili" => "2014"
41
+ response = @client.call(:tc_kimlik_no_dogrula, message:
42
+ {
43
+ 'TCKimlikNo' => '11311152982',
44
+ 'Ad' => 'KUZEY TÜNER'.tr('ı', 'I').tr('i', 'İ').upcase,
45
+ 'Soyad' => 'ŞENKUL'.tr('ı', 'I').tr('i', 'İ').upcase,
46
+ 'DogumYili' => '2014'
44
47
  })
45
48
  bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
46
49
  expect(bool_value).to equal(true)
47
50
  end
48
51
 
49
52
  it 'returns false with incorrect identity' do
50
- response = @client.call(:tc_kimlik_no_dogrula, message: {
51
- "TCKimlikNo" => "11311152982",
52
- "Ad" => "Kuzey".tr('ı', 'I').tr('i', 'İ').upcase,
53
- "Soyad" => "Şenkul".tr('ı', 'I').tr('i', 'İ').upcase,
54
- "DogumYili" => "2014"
53
+ response = @client.call(:tc_kimlik_no_dogrula, message:
54
+ {
55
+ 'TCKimlikNo' => '11311152982',
56
+ 'Ad' => 'Kuzey'.tr('ı', 'I').tr('i', 'İ').upcase,
57
+ 'Soyad' => 'Şenkul'.tr('ı', 'I').tr('i', 'İ').upcase,
58
+ 'DogumYili' => '2014'
55
59
  })
56
60
  bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
57
61
  expect(bool_value).to equal(false)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mernis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mustafa Serhat Dündar
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.11'
27
- description: SOAP client for KPS (The Identity Information Sharing System) services
28
- provided by Ministry of the Interior, Turkey
27
+ description: SOAP client for MERNIS services provided by Ministry of the Interior,
28
+ Turkey
29
29
  email: msdundars@gmail.com
30
30
  executables: []
31
31
  extensions: []
@@ -37,6 +37,7 @@ files:
37
37
  - Gemfile
38
38
  - README.md
39
39
  - Rakefile
40
+ - circle.yml
40
41
  - lib/mernis.rb
41
42
  - lib/mernis/request.rb
42
43
  - lib/mernis/version.rb