Module: Tckimlikdogrulama::InstanceMethods

Defined in:
lib/tckimlikdogrulama.rb

Instance Method Summary collapse

Instance Method Details

#tckimlikno_dogrula(options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tckimlikdogrulama.rb', line 23

def tckimlikno_dogrula(options = {})
  client = Savon::Client.new("https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL") 
  
  if options.present?          
    first_name = eval("self.#{options[:first_name]}")
    last_name = eval("self.#{options[:last_name]}")
    identification_number = eval("self.#{options[:identification_number]}")
    birth_year = eval("self.#{options[:birth_year]}")
    res = client.request(:tc_kimlik_no_dogrula) {soap.body = { "TCKimlikNo" => identification_number, "Ad" => UnicodeUtils.upcase(first_name, :tr) , "Soyad" => UnicodeUtils.upcase(last_name, :tr), "DogumYili" => birth_year}}
  else
    res = client.request(:tc_kimlik_no_dogrula) {soap.body = { "TCKimlikNo" => self.identification_number, "Ad" => UnicodeUtils.upcase(self.first_name, :tr) , "Soyad" => UnicodeUtils.upcase(self.last_name, :tr), "DogumYili" => self.birth_year}}          
  end
  
  unless res.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result]
    false
  else
    true
  end
end