mernis 0.2.5 → 1.0.1

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: bdeabc60a69fcffcc31eb93c07260bc6400a6099
4
- data.tar.gz: e1fffc5678ae44a44ce34b36f50173c1328fda17
3
+ metadata.gz: 94397bd5ea0255f3584432a8346df5a33876a65e
4
+ data.tar.gz: a08b7869c48d961ad0a72d1818a3b48319b54596
5
5
  SHA512:
6
- metadata.gz: e14b3dadcbc81915c897e76df71cc02799686d1e91a82bf3a43a65a9cc36ac7d408ca1276ebf300a8ef3cdadc7fb648e3a6ce7194615f767d8ccfbcfc999904f
7
- data.tar.gz: c4cb05085548f54f6a61ad73c39b16afad6a96922f0a8b4ad77c32bab0d2fba85e5af133cd895fe24ef541dc6bf5ed9e50d094d8b801a711f4aad94da3847488
6
+ metadata.gz: 61264c09e30901bc6a5947ac73ca7df4976586976669be62ac9c85f6ef5f580fab5bdd47cf60c6cf97f2e9b88a2f8d8088e518d17347324acf57eec22c80134b
7
+ data.tar.gz: d83a060e577229e155f3b596491830932d7697fd465698a4458242d607654adfb446ee23050260760c42289809e908c8e89db833c290cc3a277e30fd45ba9b42
@@ -0,0 +1,9 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore GEM files.
8
+ *.gem
9
+ *.rbc
@@ -0,0 +1 @@
1
+ 2.4.1
@@ -0,0 +1,8 @@
1
+ # https://github.com/travis-ci/travis-ci/wiki/.travis.yml-options
2
+
3
+ language: "ruby"
4
+ script: "bundle exec rake --trace"
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,75 @@
1
+ # MERNİS (KPS)
2
+
3
+ SOAP client for KPS (The Identity Information Sharing System) services provided by Ministry of the Interior, Turkey
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/mernis.svg)](http://badge.fury.io/rb/mernis)
6
+ [![Code Climate](https://codeclimate.com/github/msdundar/mernis/badges/gpa.svg)](https://codeclimate.com/github/msdundar/mernis)
7
+
8
+ ## Setup
9
+
10
+ ```
11
+ $ gem install 'mernis'
12
+ ```
13
+
14
+ ## Usage Examples
15
+
16
+ ```ruby
17
+ require 'mernis'
18
+
19
+ # Most basic usage:
20
+ mernis = Mernis.sorgula("11223344556", "john", "doe", "1990")
21
+
22
+ # With parameter names (required only):
23
+ mernis = Mernis.sorgula(id_number="11223344556", first_name="john", last_name="doe", birth_year="1990")
24
+
25
+ # With parameter names (required + extras):
26
+ mernis = Mernis.sorgula(id_number="11223344556", first_name="john", last_name="doe", birth_year="1990", version = 2, log = false)
27
+
28
+ # With all parameters:
29
+ mernis = Mernis.sorgula(id_number="11223344556", first_name="john", last_name="doe", birth_year="1990", version = 2, open_timeout = 60, read_timeout = 60, log = false, wsdl = "https://somecustomwsdl.com" )
30
+
31
+ ```
32
+
33
+ ## Parameters
34
+
35
+ ```ruby
36
+ mernis = Mernis.sorgula(
37
+ id_number = "12345", # identity number
38
+ first_name = "john", # first name
39
+ last_name = "doe", # last name
40
+ birth_year = "1990", # year of birth
41
+ version = 2, # soap version. should be 1 or 2.
42
+ open_timeout = 60, # timeout duration until SOAP server opens the connection. in seconds.
43
+ read_timeout = 60, # timeout duration until SOAP server returns response. in seconds.
44
+ log = false, # logging
45
+ wsdl = "https://somecustomwsdl.com" # wsdl uri
46
+ )
47
+ ```
48
+
49
+ ## Response
50
+
51
+ Returns true if the identity number can be validated and false if not. Both returning values are string!
52
+
53
+ ## Contributing
54
+
55
+ 1. `fork` the repo ( https://github.com/msdundar/mernis/fork )
56
+ 2. Create a branch (git checkout -b cool-feature)
57
+ 3. Commit the changes (git commit -am 'My cool features')
58
+ 4. Push the branch (git push origin cool-feature)
59
+ 5. Make a pull request
60
+
61
+ # Build
62
+
63
+ ```ruby
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"
68
+ git push --tags
69
+ ```
70
+
71
+ ## Questions
72
+
73
+ ```
74
+ msdundars@gmail.com
75
+ ```
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.test_files = FileList['test/*_test.rb']
6
+ end
7
+
8
+ task :default => :test
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'mernis/version'
4
+
3
5
  class Mernis
4
6
  # Most basic usage:
5
7
  # Mernis.sorgula("12345", "John", "Doe", "1990")
@@ -18,5 +20,3 @@ class Mernis
18
20
  response.sorgula
19
21
  end
20
22
  end
21
-
22
- require 'mernis/request'
@@ -29,8 +29,8 @@ class Request
29
29
  # Create message pattern
30
30
  message = {
31
31
  "TCKimlikNo" => @id_number.to_s,
32
- "Ad" => @first_name,
33
- "Soyad" => @last_name,
32
+ "Ad" => @first_name.tr('ı', 'I').tr('i', 'İ').upcase,
33
+ "Soyad" => @last_name.tr('ı', 'I').tr('i', 'İ').upcase,
34
34
  "DogumYili" => @birth_year.to_s
35
35
  }
36
36
 
@@ -0,0 +1,3 @@
1
+ class Mernis
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mernis/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "mernis"
8
+ s.version = "1.0.1"
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"]
18
+
19
+ s.files = `git ls-files -z`.split("\x0")
20
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
+ s.require_paths = ["lib"]
23
+
24
+ s.add_dependency "savon", "~> 2.11"
25
+ s.required_ruby_version = '>= 2.2.0'
26
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+ require 'savon'
3
+ require 'mernis'
4
+
5
+ describe 'Request' do
6
+ before(:each) do
7
+ @client = Savon.client(
8
+ wsdl: 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL',
9
+ soap_version: 2,
10
+ open_timeout: 60,
11
+ read_timeout: 60,
12
+ log: false
13
+ )
14
+ end
15
+
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"
22
+ })
23
+ bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
24
+ expect(bool_value).to equal(true)
25
+ end
26
+
27
+ 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"
33
+ })
34
+ bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
35
+ expect(bool_value).to equal(true)
36
+ end
37
+
38
+ 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"
44
+ })
45
+ bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
46
+ expect(bool_value).to equal(true)
47
+ end
48
+
49
+ 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"
55
+ })
56
+ bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
57
+ expect(bool_value).to equal(false)
58
+ end
59
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ require 'pry' if ENV['APP_ENV'] == 'debug' # add `binding.pry` to debug
4
+ require 'mernis'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mernis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mustafa Serhat Dündar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.7'
19
+ version: '2.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.7'
26
+ version: '2.11'
27
27
  description: SOAP client for KPS (The Identity Information Sharing System) services
28
28
  provided by Ministry of the Interior, Turkey
29
29
  email: msdundars@gmail.com
@@ -31,8 +31,18 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".gitignore"
35
+ - ".ruby-version"
36
+ - ".travis.yml"
37
+ - Gemfile
38
+ - README.md
39
+ - Rakefile
34
40
  - lib/mernis.rb
35
41
  - lib/mernis/request.rb
42
+ - lib/mernis/version.rb
43
+ - mernis.gemspec
44
+ - spec/mernis/request_spec.rb
45
+ - spec/spec_helper.rb
36
46
  homepage: https://github.com/msdundar/mernis
37
47
  licenses:
38
48
  - MIT
@@ -45,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
55
  requirements:
46
56
  - - ">="
47
57
  - !ruby/object:Gem::Version
48
- version: 1.8.6
58
+ version: 2.2.0
49
59
  required_rubygems_version: !ruby/object:Gem::Requirement
50
60
  requirements:
51
61
  - - ">="
@@ -53,8 +63,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
63
  version: '0'
54
64
  requirements: []
55
65
  rubyforge_project:
56
- rubygems_version: 2.4.5.1
66
+ rubygems_version: 2.6.11
57
67
  signing_key:
58
68
  specification_version: 4
59
- summary: SOAP client for KPS services.
60
- test_files: []
69
+ summary: SOAP client for KPS [MERNIS] services.
70
+ test_files:
71
+ - spec/mernis/request_spec.rb
72
+ - spec/spec_helper.rb