cra.ge 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,4 +16,7 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
 
19
- *.pem
19
+ *.pfx
20
+ *.exe
21
+ spec/spec_helper_private.rb
22
+ .DS_Store
data/bin/compile.sh ADDED
@@ -0,0 +1 @@
1
+ gmcs bin/cra.cs -reference:System.Security
data/bin/cra.cs ADDED
@@ -0,0 +1,45 @@
1
+ using System;
2
+ using System.Xml;
3
+ using System.Security.Cryptography.X509Certificates;
4
+ using System.Security.Cryptography;
5
+
6
+ using System.Security.Cryptography.Xml;
7
+ using Mono.Security;
8
+
9
+ class Program
10
+ {
11
+ static void Main(string[] args) {
12
+ if (args.Length != 4) {
13
+ Console.WriteLine("Usage: cra.exe cert-file cert-password input-path output-path");
14
+ return;
15
+ }
16
+
17
+ String certFile = args[0];
18
+ String password = args[1];
19
+ String input = args[2];
20
+ String output = args[3];
21
+
22
+ X509Certificate2 cert = new X509Certificate2(certFile, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
23
+
24
+ XmlDocument xmlDoc = new XmlDocument();
25
+ xmlDoc.Load(input);
26
+
27
+ var XmlToSign = new XmlDocument();
28
+ XmlToSign.LoadXml(xmlDoc.DocumentElement["Body"].OuterXml);
29
+
30
+ SignedXml signedXml = new SignedXml(XmlToSign);
31
+ signedXml.SigningKey = cert.PrivateKey;
32
+
33
+ Reference reference = new Reference();
34
+ reference.Uri = "";
35
+
36
+ XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
37
+ reference.AddTransform(env);
38
+
39
+ signedXml.AddReference(reference);
40
+ signedXml.ComputeSignature();
41
+ XmlElement xmlDigitalSignature = signedXml.GetXml();
42
+ xmlDoc.DocumentElement["Body"].AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true));
43
+ xmlDoc.Save(output);
44
+ }
45
+ }
data/bin/cra.exe ADDED
Binary file
data/cra.gemspec CHANGED
@@ -13,10 +13,14 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = "http://github.com/dimakura/cra.ge"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ # gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.executables << 'cra.exe'
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
19
20
 
20
21
  gem.add_development_dependency 'rspec', '~> 2.11'
21
- gem.add_runtime_dependency 'savon', '~> 1.2'
22
+ gem.add_runtime_dependency 'activesupport', '~> 3.2'
23
+ gem.add_runtime_dependency 'rest-client', '~> 1.6'
24
+ gem.add_runtime_dependency 'builder', '~> 3.0'
25
+ gem.add_runtime_dependency 'bundler', '~> 1.2'
22
26
  end
@@ -0,0 +1,18 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CRA::Address
3
+ attr_accessor :id, :name, :old_name, :active
4
+
5
+ def self.list_from_hash(hash)
6
+ addresses = []
7
+ hash.each do |res|
8
+ address = CRA::Address.new
9
+ address.id = res['ID'].to_i
10
+ address.name = res['Name']
11
+ address.old_name = res['OldName']
12
+ address.active = res['Status'] == 'true'
13
+ addresses << address
14
+ end
15
+ addresses
16
+ end
17
+
18
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CRA::AddressInfo
3
+ attr_accessor :id, :address, :path, :region_id, :region_name
4
+
5
+ def self.init_from_hash(hash)
6
+ address = CRA::AddressInfo.new
7
+ address.id = hash['ID'].to_i
8
+ address.address = hash['Name']
9
+ address.path = hash['Path'].split('|').map{ |p| p.to_i }
10
+ address.region_id = hash['RegionID'].to_i
11
+ address.region_name = hash['RegionName']
12
+ address
13
+ end
14
+
15
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CRA::AddressNode
3
+ attr_accessor :id, :description, :description_full, :address
4
+ attr_accessor :identificator, :identificator_text
5
+ attr_accessor :identificator_type, :identificator_type_text
6
+ attr_accessor :active
7
+
8
+ def self.list_from_hash(hash)
9
+ nodes = []
10
+ hash.each do |res|
11
+ node = CRA::AddressNode.new
12
+ node.id = res['ID'].to_i
13
+ node.description = res['Description']
14
+ node.description_full = res['FullDescription']
15
+ node.identificator = res['Identificator'].to_i
16
+ node.identificator_text = res['IdentificatorStr']
17
+ node.identificator_type = res['IdentificatorType'].to_i
18
+ node.identificator_type_text = res['IdentificatorTypeStr']
19
+ node.address = res['NodeAdress']
20
+ node.active = res['Status'].to_i == 1
21
+ nodes << node
22
+ end
23
+ nodes
24
+ end
25
+
26
+ end
data/lib/cra/base.rb ADDED
@@ -0,0 +1,118 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'builder'
3
+ require 'bundler/cli'
4
+
5
+ class CRA::Base
6
+ attr_accessor :last_action, :last_request, :last_response
7
+
8
+ def tokenize_service(service)
9
+ case service
10
+ when 'GetDataUsingCriteriaParameter'
11
+ 'ძებნა სახელით და დაბ. დღით'
12
+ when 'GetDataUsingPrivateNumberAndIdCardParameter'
13
+ 'ძებნა პირადობის მოწმობით'
14
+ when 'FetchPersonInfoByPassportNumberUsingCriteriaParameter'
15
+ 'ძებნა პასპორტით'
16
+ else
17
+ service
18
+ end
19
+ end
20
+
21
+ def gov_talk_request(options)
22
+ self.last_action = tokenize_service(options[:service])
23
+ self.last_request = options[:params]
24
+ # create xml
25
+ xml = xml_generation(options)
26
+ file1 = gen_filename
27
+ file2 = gen_filename
28
+ begin
29
+ # make signature
30
+ File.open(file1, 'w') do |f|
31
+ f.write(xml)
32
+ end
33
+ if File.exists?('bin/cra.exe')
34
+ path_to_exe = 'bin/cra.exe'
35
+ else
36
+ path_to_exe = "#{Bundler::CLI.new.send(:locate_gem, 'cra.ge')}/bin/cra.exe"
37
+ end
38
+ %x[ mono #{path_to_exe} '#{CRA.config.cert_file}' '#{CRA.config.cert_password}' '#{file1}' '#{file2}' ]
39
+ # send request
40
+ xml2 = File.read(file2)
41
+ response = RestClient.post CRA.config.url, xml2, :content_type => :xml
42
+ hash = Hash.from_xml(response.body)
43
+ # manage response
44
+ if hash['GovTalkMessage']['Header']['MessageDetails']['Qualifier'] == 'error'
45
+ ex_root = hash['GovTalkMessage']['GovTalkDetails']['GovTalkErrors']['Error']
46
+ ex_text = "#{ex_root['Type'].upcase}-#{ex_root['Number']}: #{ex_root['Text']}"
47
+ self.last_response = ex_text
48
+ raise CRA::ServiceException, ex_text
49
+ elsif hash['GovTalkMessage']['Body']['ErrorResult']
50
+ ex_root = hash['GovTalkMessage']['Body']['ErrorResult']
51
+ ex_text = "#{ex_root['Message']}"
52
+ self.last_response = ex_text
53
+ raise CRA::ServiceException, ex_text
54
+ end
55
+ hash['GovTalkMessage']['Body']
56
+ self.last_response = hash['GovTalkMessage']['Body']
57
+ ensure
58
+ FileUtils.rm(file1)
59
+ FileUtils.rm(file2)
60
+ end
61
+ end
62
+
63
+ private
64
+
65
+ def xml_generation(options)
66
+ service_name = options[:service]
67
+ class_name = options[:class]
68
+ message_name = options[:message]
69
+ params = options[:params]
70
+ xml = Builder::XmlMarkup.new( :indent => 2 )
71
+ xml.instruct! :xml, :encoding => 'utf-8'
72
+ xml.GovTalkMessage(xmlns: 'http://www.govtalk.gov.uk/CM/envelope') do |xml|
73
+ xml.EnvelopeVersion '2.0'
74
+ xml.Header do |xml|
75
+ xml.MessageDetails do |xml|
76
+ xml.Class class_name
77
+ xml.Qualifier 'request'
78
+ xml.Function 'submit'
79
+ end
80
+ xml.SenderDetails do |xml|
81
+ xml.IDAuthentication do |xml|
82
+ xml.SenderID CRA.config.user
83
+ xml.Authentication do |xml|
84
+ xml.Method 'clear'
85
+ xml.Value CRA.config.password
86
+ end
87
+ end
88
+ end
89
+ end
90
+ xml.Body do |xml|
91
+ xml.Message(xmlns: "urn:g3.ge:cra:call:#{message_name}:v1") do |xml|
92
+ xml.Data do |xml|
93
+ xml.Request do |xml|
94
+ if params.size < 2
95
+ params.each do |k, v|
96
+ xml.tag!(k, v)
97
+ end
98
+ else
99
+ xml.tag! service_name do |xml|
100
+ params.each do |k, v|
101
+ xml.tag!(k, v)
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ xml.Thumbprint CRA.config.cert_trace
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ def gen_filename
114
+ FileUtils.mkdir_p('tmp')
115
+ "tmp/#{Digest::MD5.hexdigest "#{Time.now}#{rand(100)}"}.xml"
116
+ end
117
+
118
+ end
data/lib/cra/config.rb CHANGED
@@ -5,7 +5,10 @@ module CRA
5
5
 
6
6
  class Config
7
7
  include Singleton
8
- attr_accessor :pem_file
8
+ attr_accessor :user, :password, :test_mode, :cert_file, :cert_password, :cert_trace
9
+ def url
10
+ self.test_mode ? 'https://test.submission.e-government.ge/submission' : 'https://submission.e-government.ge/submission'
11
+ end
9
12
  end
10
13
 
11
14
  class << self
@@ -0,0 +1,115 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'base64'
3
+
4
+ class CRA::PassportInfo
5
+ DATE_FORMAT = '%Y-%m-%dT%H:%M:%S'
6
+
7
+ attr_accessor :doc_id, :doc_type, :doc_description, :doc_status, :doc_status_text
8
+ attr_accessor :is_id_card, :id_card_serial, :id_card_number, :id_card_issuer, :id_card_issue_date, :id_card_valid_date
9
+ attr_accessor :passport_number, :passport_issuer, :passport_issue_date, :passport_valid_date
10
+ attr_accessor :person_id, :social_id, :private_number
11
+ attr_accessor :first_name, :last_name, :middle_name
12
+ attr_accessor :birth_date, :birth_place
13
+ attr_accessor :gender
14
+ attr_accessor :citizenship, :citizenship_code, :second_citizenship, :second_citizenship_code
15
+ attr_accessor :living_place_id, :living_place, :living_place_registration, :living_place_registration_end, :actual_living_place
16
+ attr_accessor :region_id, :region_name
17
+ attr_accessor :response_id, :response_code
18
+ attr_accessor :is_person_dead, :is_document_lost
19
+ attr_accessor :photos
20
+
21
+ def self.extract_date(text)
22
+ DateTime.strptime(text.to_s, DATE_FORMAT)
23
+ rescue Exception => ex
24
+ end
25
+
26
+ def self.eval_hash(hash)
27
+ if hash['PersonInfo']
28
+ CRA::PassportInfo.init_with_hash(hash)
29
+ elsif hash['ArrayOfPersonInfo']
30
+ CRA::PassportInfo.list_with_hash(hash)
31
+ end
32
+ end
33
+
34
+ def self.init_with_hash(hash)
35
+ hash = hash['PersonInfo'] || hash
36
+ passport = CRA::PassportInfo.new
37
+ passport.doc_id = hash['DocumentID'].to_i
38
+ passport.doc_type = hash['DocumentTypeID'].to_i
39
+ passport.doc_description = hash['DocumentDescription']
40
+ passport.doc_status = hash['DocumentStatusEnum']
41
+ passport.doc_status_text = hash['DocumentStatusStr']
42
+ passport.is_id_card = hash['IsIdCard'].downcase == 'true'
43
+ passport.id_card_serial = hash['IdCardSerial']
44
+ passport.id_card_number = hash['IdCardNumber']
45
+ passport.id_card_issuer = hash['IdCardIssuer']
46
+ passport.id_card_issue_date = extract_date(hash['IdCardIssueDate'])
47
+ passport.id_card_valid_date = extract_date(hash['IdCardValidDate'])
48
+ passport.passport_number = hash['PaspNumber'].strip if hash['PaspNumber']
49
+ passport.passport_issuer = hash['PaspIssuer'].strip if hash['PaspIssuer']
50
+ passport.passport_issue_date = extract_date(hash['PaspIssueDate'])
51
+ passport.passport_valid_date = extract_date(hash['PaspValidDate'])
52
+ passport.person_id = hash['PersonID'].to_i
53
+ # passport.social_id = hash[:social_id].to_i
54
+ passport.private_number = hash['PrivateNumber']
55
+ passport.first_name = hash['FirstName']
56
+ passport.last_name = hash['LastName']
57
+ passport.middle_name = hash['MiddleName']
58
+ passport.birth_date = extract_date(hash['BirthDate'])
59
+ passport.birth_place = hash['BirthPlace']
60
+ passport.gender = hash['Gender'].to_i
61
+ passport.citizenship = hash['Citizenship']
62
+ passport.citizenship_code = hash['CitizenshipCode']
63
+ passport.second_citizenship = hash['DoubleCitizenship'].strip if hash['DoubleCitizenship']
64
+ passport.second_citizenship_code = hash['DoubleCitizenshipCode']
65
+ passport.living_place_id = hash['LivingPlaceID'].to_i rescue nil
66
+ passport.living_place = hash['LivingPlace']
67
+ passport.actual_living_place = hash['FaLivingPlace'].strip if hash['FaLivingPlace']
68
+ passport.living_place = passport.living_place.split(' ').join(' ') if passport.living_place
69
+ passport.actual_living_place = passport.actual_living_place.split(' ').join(' ') if passport.actual_living_place
70
+ passport.living_place_registration = extract_date(hash['LivingPlaceRegDate'])
71
+ passport.living_place_registration_end = extract_date(hash['LivingPlaceRegEndDate'])
72
+ passport.region_id = hash['RegionID'].to_i
73
+ passport.region_name = hash['RegionStr']
74
+ passport.response_id = hash['ResponseID'].to_i
75
+ passport.is_person_dead = hash['IsPersonDead'] == 'true'
76
+ passport.is_document_lost = hash['IsDocumentLost'] == 'true'
77
+ passport.photos = []
78
+ if hash['Photos'] and hash['Photos'].is_a?(Array)
79
+ hash['Photos'].each do |photo|
80
+ passport.photos.push(photo['base64Binary'])
81
+ end
82
+ elsif hash['Photos']
83
+ passport.photos.push(hash['Photos']['base64Binary'])
84
+ end
85
+ passport
86
+ end
87
+
88
+ def self.list_with_hash(hash)
89
+ documents = []
90
+ hash['ArrayOfPersonInfo']['PersonInfo'].each do |row|
91
+ documents << CRA::PassportInfo.init_with_hash(row)
92
+ end
93
+ documents
94
+ end
95
+
96
+ def full_name(opts = {})
97
+ if opts[:with_middle_name]
98
+ "#{first_name} #{last_name} #{middle_name}"
99
+ else
100
+ "#{first_name} #{last_name}"
101
+ end
102
+ end
103
+
104
+ # Returns binary content of the photo.
105
+ def binary(index)
106
+ Base64.decode64(self.photos[index])
107
+ end
108
+
109
+ def write_photo(index, file = nil)
110
+ File.open(file || 'photo', 'wb') do |file|
111
+ file.write self.binary(index)
112
+ end
113
+ end
114
+
115
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CRA::PersonAtAddress
3
+ attr_accessor :first_name, :last_name, :birth_date, :active, :status_text, :gender, :address, :private_number
4
+
5
+ def self.extract_date(text)
6
+ DateTime.strptime(text.to_s, '%d/%m/%Y')
7
+ #rescue Exception => ex
8
+ end
9
+
10
+ def self.init_with_hash(hash)
11
+ hash = hash['PersonsAtAddress'] || hash
12
+ person = CRA::PersonAtAddress.new
13
+ person.first_name = hash['MD_FIRST']
14
+ person.last_name = hash['MD_LAST']
15
+ person.birth_date = CRA::PersonAtAddress.extract_date(hash['MD_BIRTH_DATE'])
16
+ person.status_text = hash['APPD_STATUS_DESCRIPTION']
17
+ person.active = person.status_text == 'აქტიური'
18
+ person.gender = hash['MD_GENDER_STR']
19
+ person.address = hash['OA_RP_FULL_ADDRESS']
20
+ person.private_number = hash['PN_PRIVATE_NUMBER']
21
+ person
22
+ end
23
+
24
+ def self.list_from_hash(hash)
25
+ persons = []
26
+ hash = hash['PersonsAtAddress']
27
+ if hash.is_a? Array
28
+ hash.each do |row|
29
+ persons << CRA::PersonAtAddress.init_with_hash(row)
30
+ end
31
+ else
32
+ persons << CRA::PersonAtAddress.init_with_hash(hash)
33
+ end
34
+ persons
35
+ end
36
+
37
+ end
data/lib/cra/services.rb CHANGED
@@ -1,50 +1,123 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'singleton'
3
+ require 'rest_client'
4
+ require 'active_support/core_ext/hash/conversions'
3
5
 
4
6
  module CRA
7
+ ROOT_ID = 0
8
+ GEORGIA_ID = 1
9
+ TBILISI_ID = 4
5
10
 
6
11
  class Services < CRA::Base
7
12
  include Singleton
8
13
 
9
- # Get service consumer UPN.
10
- def my_upn
11
- process_request('GetMyUPN', {})
12
- end
13
-
14
- # Getting personal information by personal number.
15
- def by_personal_id(personal_number)
16
- raise ArgumentError('personal_number required') if personal_number.blank?
17
- response = process_request('GetDataUsingPrivateNumber', { 'privateNumber' => personal_number })
18
- CRA::PasportInfo.init_with_hash(response)
19
- end
20
-
21
- # Getting personal information by ID card information.
22
- def by_id_card(serial, number)
23
- raise ArgumentError('id card serial required') if serial.blank?
24
- raise ArgumentError('id card number required') if serial.blank?
25
- response = process_request('PersonInfoByDocumentNumber', { 'idCardSerial' => serial, 'idCardNumber' => number })
26
- CRA::PasportInfo.init_with_hash(response)
27
- end
28
-
29
- # Getting documents by name and date of birth.
30
- def list_by_name_and_dob(last_name, first_name, year, month, day)
31
- raise ArgumentError('first_name required') if first_name.blank?
32
- raise ArgumentError('last_name required') if last_name.blank?
33
- raise ArgumentError('year required') if year.blank?
34
- raise ArgumentError('month required') if month.blank?
35
- raise ArgumentError('day required') if day.blank?
36
- response = process_request('GetDataUsingCriteria', { 'lastName' => last_name, 'firstName' => first_name, 'year' => year, 'month' => month, 'day' => day })
37
- CRA::PasportInfo.list_with_hash(response)
38
- end
39
-
40
- def test_service
41
- action_name = 'AddrGetRootNode'
42
- soap_action = self.soap_action(action_name)
43
- response = get_client.request action_name do
44
- http.headers['SOAPAction'] = soap_action
45
- #soap.body = { 'idCardSerial' => 'გ', 'idCardNumber' => '1355876' }
46
- end
47
- puts response.to_hash
14
+ public
15
+
16
+ # Returns array of passports.
17
+ def by_name_and_dob(lname, fname, year, month, day)
18
+ body = self.gov_talk_request({
19
+ service: 'GetDataUsingCriteriaParameter',
20
+ message: 'CRAGetDataUsingCriteria',
21
+ class: 'CRAGetDataUsingCriteria',
22
+ params: {
23
+ LastName: lname,
24
+ FirstName: fname,
25
+ Year: year,
26
+ Month: month,
27
+ Day: day,
28
+ }
29
+ })
30
+ CRA::PassportInfo.list_with_hash(body)
31
+ end
32
+
33
+ # Returns ID card information.
34
+ def by_id_card(private_number, id_card_serial, id_card_numb)
35
+ body = self.gov_talk_request({
36
+ service: 'GetDataUsingPrivateNumberAndIdCardParameter',
37
+ message: 'GetDataUsingPrivateNumberAndCard',
38
+ class: 'GetDataUsingPrivateNumberAndCard',
39
+ params: {
40
+ PrivateNumber: private_number,
41
+ IdCardSerial: id_card_serial,
42
+ IdCardNumber: id_card_numb,
43
+ }
44
+ })
45
+ CRA::PassportInfo.init_with_hash(body)
46
+ end
47
+
48
+ # Returns passport information.
49
+ def by_passport(private_number, passport)
50
+ body = self.gov_talk_request({
51
+ service: 'FetchPersonInfoByPassportNumberUsingCriteriaParameter',
52
+ message: 'CRA_FetchInfoByPassportCriteria',
53
+ class: 'CRA_FetchInfoByPassportCriteria',
54
+ params: {
55
+ PrivateNumber: private_number,
56
+ Number: passport
57
+ }
58
+ })
59
+ CRA::PassportInfo.init_with_hash(body)
60
+ end
61
+
62
+ # Returns array of addresses.
63
+ def address_by_name(parent_id, name)
64
+ body = self.gov_talk_request({
65
+ service: 'AddrFindeAddressByNameParameter',
66
+ message: 'CRA_AddrFindeAddressByName',
67
+ class: 'CRA_AddrFindeAddressByName',
68
+ params: {
69
+ Id: parent_id,
70
+ Word: name,
71
+ }
72
+ })
73
+ CRA::Address.list_from_hash(body['ArrayOfResults']['Results'])
74
+ end
75
+
76
+ # Getting address root.
77
+ def address_root
78
+ body = self.gov_talk_request({
79
+ message: 'CRA_AddrGetRootNode',
80
+ class: 'CRA_AddrGetRootNode',
81
+ params: {}
82
+ })
83
+ CRA::AddressNode.list_from_hash(body['ArrayOfNodeInfo']['NodeInfo'])
84
+ end
85
+
86
+ # Returns array of address nodes.
87
+ def address_by_parent(parent_id)
88
+ body = self.gov_talk_request({
89
+ message: 'CRA_AddrGetNodesByParentID',
90
+ class: 'CRA_AddrGetNodesByParentID',
91
+ params: {
92
+ long: parent_id,
93
+ }
94
+ })
95
+ CRA::AddressNode.list_from_hash(body['ArrayOfNodeInfo']['NodeInfo'])
96
+ end
97
+
98
+ # Get address info by it's id.
99
+ def address_info(id)
100
+ body = self.gov_talk_request({
101
+ message: 'CRA_AddrGetAddressInfoByID',
102
+ class: 'CRA_AddrGetAddressInfoByID',
103
+ params: {
104
+ long: id,
105
+ }
106
+ })
107
+ # puts body.to_s
108
+ CRA::AddressInfo.init_from_hash(body['AddressInfo'])
109
+ end
110
+
111
+ # Get persons array at the given address.
112
+ def persons_at_address(address_id)
113
+ body = self.gov_talk_request({
114
+ message: 'CRA_GetPersonsAtAddress',
115
+ class: 'CRA_GetPersonsAtAddress',
116
+ params: {
117
+ long: address_id,
118
+ }
119
+ })
120
+ CRA::PersonAtAddress.list_from_hash(body['ArrayOfPersonsAtAddress'])
48
121
  end
49
122
 
50
123
  end
data/lib/cra/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module CRA
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
data/lib/cra.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'savon'
3
2
  require 'cra/version'
4
-
5
3
  require 'cra/config'
6
4
 
7
5
  class String
@@ -15,41 +13,19 @@ class String
15
13
  end
16
14
 
17
15
  module CRA
18
- BASE_URL = 'http://stateinstitution.cra.ge'
19
- WSDL_URL = 'https://stateinstitutions.cra.ge/Service.asmx?WSDL'
20
-
21
16
  MALE = 1
22
17
  FEMALE = 2
23
18
 
24
- class Base
25
- attr_accessor :last_request, :last_response, :last_action
26
-
27
- def process_request(action, request)
28
- soap_action = self.soap_action(action)
29
- response = get_client.request action do
30
- http.headers['SOAPAction'] = soap_action
31
- soap.body = request
32
- end
33
- @last_action = action
34
- @last_request = request
35
- @last_response = response["#{action.underscore}_response".to_sym]["#{action.underscore}_result".to_sym]
36
- end
37
-
38
- def get_client
39
- Savon::Client.new WSDL_URL do
40
- http.auth.ssl.cert_file = CRA.config.pem_file
41
- http.auth.ssl.cert_key_file = CRA.config.pem_file
42
- http.auth.ssl.verify_mode = :peer
43
- end
44
- end
45
-
46
- def soap_action(name)
47
- "#{BASE_URL}/#{name}"
48
- end
49
-
19
+ class ServiceException < Exception
50
20
  end
51
21
 
52
22
  end
53
23
 
54
- require 'cra/pasport_info'
24
+ require 'cra/address'
25
+ require 'cra/address_node'
26
+ require 'cra/address_info'
27
+ require 'cra/passport_info'
28
+ require 'cra/person_at_address'
29
+
30
+ require 'cra/base'
55
31
  require 'cra/services'
@@ -0,0 +1,131 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe 'Find address by name' do
5
+ before(:all) do
6
+ @addresses = CRA.serv.address_by_name(CRA::TBILISI_ID, 'ტაბიძე')
7
+ end
8
+ context do
9
+ subject { @addresses }
10
+ it { should_not be_nil }
11
+ it { should_not be_empty }
12
+ its(:size) { should == 2 }
13
+ end
14
+ context do
15
+ subject { @addresses.first }
16
+ its(:id) { should == 988572 }
17
+ its(:name) { should == 'საქართველო/თბილისი/კრწანისი/გ.ტაბიძე-შ.დადიანის/' }
18
+ its(:old_name) { should be_nil }
19
+ its(:active) { should == true }
20
+ end
21
+ context do
22
+ subject { @addresses.last }
23
+ its(:id) { should == 1989533 }
24
+ its(:name) { should == 'საქართველო/თბილისი/მთაწმინდა/კიკეთი/გ. ტაბიძე/' }
25
+ its(:old_name) { should be_nil }
26
+ its(:active) { should == true }
27
+ end
28
+ end
29
+
30
+ describe 'Getting root node' do
31
+ before(:all) do
32
+ @nodes = CRA.serv.address_root
33
+ end
34
+ context do
35
+ subject { @nodes }
36
+ it { should_not be_nil }
37
+ it { should_not be_empty }
38
+ its(:size) { should == 3 }
39
+ end
40
+ context do
41
+ subject { @nodes.first }
42
+ its(:id) { should == 1 }
43
+ its(:description) { should == 'საქართველო' }
44
+ its(:description_full) { should == 'საქართველო' }
45
+ its(:identificator) { should == 1 }
46
+ its(:identificator_text) { should == 'ჩვენი ქვეყანა' }
47
+ its(:identificator_type) { should == 1 }
48
+ its(:identificator_type_text) { should == 'ჩვეულებრივი' }
49
+ its(:address) { should be_nil }
50
+ its(:active) { should == true }
51
+ end
52
+ end
53
+
54
+ describe 'Find address by parent id' do
55
+ before(:all) do
56
+ @nodes = CRA.serv.address_by_parent(CRA::TBILISI_ID)
57
+ end
58
+ context do
59
+ subject { @nodes }
60
+ it { should_not be_nil }
61
+ it { should_not be_empty }
62
+ its(:size) { should == 11 }
63
+ end
64
+ context do
65
+ subject { @nodes.first }
66
+ its(:id) { should == 191 }
67
+ its(:description) { should == 'გლდანი' }
68
+ its(:description_full) { should == 'გლდანი' }
69
+ its(:identificator) { should == 32 }
70
+ its(:identificator_text) { should == 'ქალაქის რაიონი' }
71
+ its(:identificator_type) { should == 1 }
72
+ its(:identificator_type_text) { should == 'ჩვეულებრივი' }
73
+ its(:address) { should == 'თბილისი' }
74
+ its(:active) { should == true }
75
+ end
76
+ end
77
+
78
+ describe 'Get address info' do
79
+ before(:all) do
80
+ @info = CRA.serv.address_info(1990702)
81
+ end
82
+ subject { @info }
83
+ it { should_not be_nil }
84
+ its(:id) { should == 1990702 }
85
+ its(:path) { should == [1, 4, 190, 10891, 1989533, 1990702] }
86
+ its(:address) { should == 'თბილისი ს. კიკეთი გ. ტაბიძე ქ. N 1' }
87
+ its(:region_id) { should == 190 }
88
+ its(:region_name) { should == 'თბილისი/მთაწმინდა' }
89
+ end
90
+
91
+ describe 'Get persons at address' do
92
+ before(:all) do
93
+ @persons = CRA.serv.persons_at_address(1982180)
94
+ end
95
+ context do
96
+ subject { @persons }
97
+ it { should_not be_nil }
98
+ it { should_not be_empty }
99
+ its(:size) { should == 1 }
100
+ end
101
+ context do
102
+ subject { @persons.first }
103
+ its(:first_name) { should == 'ირაკლი' }
104
+ its(:last_name) { should == 'ცქიტიშვილი' }
105
+ its(:birth_date) { should == Date.new(1982, 1, 23) }
106
+ its(:active) { should == true }
107
+ its(:status_text) { should == 'აქტიური' }
108
+ its(:private_number) { should == '18001008167' }
109
+ end
110
+ end
111
+
112
+ describe 'Get address with multiple persons' do
113
+ before(:all) do
114
+ @persons = CRA.serv.persons_at_address(576056)
115
+ end
116
+ context do
117
+ subject { @persons }
118
+ it { should_not be_nil }
119
+ it { should_not be_empty }
120
+ its(:size) { should == 4}
121
+ end
122
+ context do
123
+ subject { @persons.first }
124
+ its(:first_name) { should == 'ნათია' }
125
+ its(:last_name) { should == 'ბოდოკია' }
126
+ its(:birth_date) { should == Date.new(1984, 5, 7) }
127
+ its(:active) { should == true }
128
+ its(:status_text) { should == 'აქტიური' }
129
+ its(:private_number) { should == '01010013915' }
130
+ end
131
+ end
data/spec/config_spec.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe 'configure CRA gem' do
5
- specify { CRA.config.pem_file.should == 'spec/data/telasi.pem' }
4
+ describe CRA.config do
5
+ its(:user) { should_not be_nil }
6
+ its(:password) { should_not be_nil }
7
+ its(:test_mode) { should == true }
8
+ its(:cert_file) { should_not be_nil }
9
+ its(:cert_password) { should_not be_nil }
6
10
  end
@@ -0,0 +1,90 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe 'get person info by id card' do
5
+ before(:all) do
6
+ @person_info = CRA.serv.by_id_card('02001000490', 'გ', '1355876')
7
+ end
8
+ context 'person information' do
9
+ subject { @person_info }
10
+ it { should_not be_nil }
11
+ its(:doc_id) { should > 0 }
12
+ its(:doc_type) { should == 1 }
13
+ its(:doc_description) { should == 'პირადობის მოწმობა' }
14
+ its(:doc_status) { should == 'Active' }
15
+ its(:doc_status_text) { should == 'აქტიური' }
16
+ its(:is_id_card) { should == true }
17
+ its(:id_card_serial) { should == 'გ' }
18
+ its(:id_card_number) { should == '1355876' }
19
+ its(:id_card_issuer) { should == 'სამოქალაქო რეესტრის სააგენტოს მთაწმინდა-კრწანისის სამსახური' }
20
+ its(:id_card_issue_date) { should_not be_nil }
21
+ its(:id_card_valid_date) { should_not be_nil }
22
+ its(:passport_number) { should be_blank }
23
+ its(:passport_issuer) { should be_blank }
24
+ its(:passport_issue_date) { should be_nil }
25
+ its(:person_id) { should == 969036 }
26
+ its(:private_number) { should == '02001000490' }
27
+ its(:first_name) { should == 'დიმიტრი' }
28
+ its(:last_name) { should == 'ყურაშვილი' }
29
+ its(:middle_name) { should == 'ალბერტი' }
30
+ its(:birth_date) { should_not be_nil }
31
+ its(:birth_place) { should == 'საქართველო, აბაშა' }
32
+ its(:gender) { should == CRA::MALE }
33
+ its(:citizenship) { should == 'საქართველო' }
34
+ its(:citizenship_code) { should == 'GEO' }
35
+ its(:second_citizenship) { should be_blank }
36
+ its(:second_citizenship_code) { should be_blank }
37
+ its(:living_place_id) { should == 920434 }
38
+ its(:living_place) { should == 'თბილისი მისამართის გარეშე' }
39
+ its(:living_place_registration) { should_not be_nil }
40
+ its(:living_place_registration_end) { should be_nil }
41
+ its(:actual_living_place) { should == 'თბილისი აკ.ხორავას ჩიხი N 8' }
42
+ its(:is_person_dead) { should == false }
43
+ its(:is_document_lost) { should == false }
44
+ its(:photos) { should_not be_empty }
45
+ specify { subject.photos.size.should == 1 }
46
+ specify { subject.photos.first.should_not be_blank }
47
+ end
48
+ context 'last response' do
49
+ specify { CRA.serv.last_action.should == 'ძებნა პირადობის მოწმობით' }
50
+ specify { CRA.serv.last_request.is_a?(Hash).should == true }
51
+ specify { CRA.serv.last_response.is_a?(Hash).should == true }
52
+ end
53
+ end
54
+
55
+ describe 'get person info by name and date' do
56
+ before(:all) do
57
+ @person_info = CRA.serv.by_name_and_dob('ყურაშვილი', 'დიმიტრი', 1979, 4, 4)
58
+ end
59
+ context 'documents list' do
60
+ subject { @person_info }
61
+ it { should_not be_nil }
62
+ it { should_not be_empty }
63
+ its(:size) { should == 5 }
64
+ end
65
+ context 'last response' do
66
+ specify { CRA.serv.last_action.should == 'ძებნა სახელით და დაბ. დღით' }
67
+ specify { CRA.serv.last_request.is_a?(Hash).should == true }
68
+ specify { CRA.serv.last_response.is_a?(Hash).should == true }
69
+ end
70
+ end
71
+
72
+ describe 'get person info by passport' do
73
+ before(:all) do
74
+ @person_info = CRA.serv.by_passport('01008017948', '07PB00777')
75
+ end
76
+ context 'passport info' do
77
+ subject { @person_info }
78
+ it { should_not be_nil }
79
+ its(:first_name) { should == 'დავით' }
80
+ its(:last_name) { should == 'ფრუიძე' }
81
+ its(:private_number) { should == '01008017948' }
82
+ its(:passport_number) { should == '07PB00777' }
83
+ its(:is_id_card) { should == false }
84
+ end
85
+ context 'last response' do
86
+ specify { CRA.serv.last_action.should == 'ძებნა პასპორტით' }
87
+ specify { CRA.serv.last_request.is_a?(Hash).should == true }
88
+ specify { CRA.serv.last_response.is_a?(Hash).should == true }
89
+ end
90
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,14 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- # Savon
4
-
5
- require 'savon'
6
-
7
- HTTPI.log = false
8
- Savon.configure do |config|
9
- config.log = false
10
- end
11
-
12
3
  # RSpec
13
4
 
14
5
  require 'rspec'
@@ -20,5 +11,4 @@ end
20
11
  # Test options.
21
12
 
22
13
  require 'cra'
23
-
24
- CRA.config.pem_file = 'spec/data/telasi.pem'
14
+ require 'spec_helper_private'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cra.ge
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dimitri Kurashvili
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-10-29 00:00:00 Z
13
+ date: 2012-12-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -24,21 +24,54 @@ dependencies:
24
24
  type: :development
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
27
- name: savon
27
+ name: activesupport
28
28
  prerelease: false
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: "1.2"
34
+ version: "3.2"
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rest-client
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: "1.6"
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: builder
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: "3.0"
57
+ type: :runtime
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: bundler
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: "1.2"
68
+ type: :runtime
69
+ version_requirements: *id005
37
70
  description: CRA services
38
71
  email:
39
72
  - dimitri@c12.ge
40
- executables: []
41
-
73
+ executables:
74
+ - cra.exe
42
75
  extensions: []
43
76
 
44
77
  extra_rdoc_files: []
@@ -51,16 +84,24 @@ files:
51
84
  - LICENSE.txt
52
85
  - README.md
53
86
  - Rakefile
87
+ - bin/compile.sh
88
+ - bin/cra.cs
54
89
  - cra.gemspec
55
90
  - lib/cra.rb
91
+ - lib/cra/address.rb
92
+ - lib/cra/address_info.rb
93
+ - lib/cra/address_node.rb
94
+ - lib/cra/base.rb
56
95
  - lib/cra/config.rb
57
- - lib/cra/pasport_info.rb
96
+ - lib/cra/passport_info.rb
97
+ - lib/cra/person_at_address.rb
58
98
  - lib/cra/services.rb
59
99
  - lib/cra/version.rb
100
+ - spec/address_spec.rb
60
101
  - spec/config_spec.rb
61
- - spec/experimental_spec.rb
62
- - spec/service_spec.rb
102
+ - spec/passport_spec.rb
63
103
  - spec/spec_helper.rb
104
+ - bin/cra.exe
64
105
  homepage: http://github.com/dimakura/cra.ge
65
106
  licenses: []
66
107
 
@@ -89,7 +130,7 @@ signing_key:
89
130
  specification_version: 3
90
131
  summary: Ruby client for C(ivil)R(egistry)A(gency) services
91
132
  test_files:
133
+ - spec/address_spec.rb
92
134
  - spec/config_spec.rb
93
- - spec/experimental_spec.rb
94
- - spec/service_spec.rb
135
+ - spec/passport_spec.rb
95
136
  - spec/spec_helper.rb
@@ -1,100 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'base64'
3
-
4
- class CRA::PasportInfo
5
-
6
- attr_accessor :doc_id, :doc_type, :doc_description, :doc_status, :doc_status_text
7
- attr_accessor :is_id_card, :id_card_serial, :id_card_number, :id_card_issuer, :id_card_issue_date, :id_card_valid_date
8
- attr_accessor :pasport_number, :passport_issuer, :passport_issue_date, :passport_valid_date
9
- attr_accessor :person_id, :social_id, :private_number
10
- attr_accessor :first_name, :last_name, :middle_name
11
- attr_accessor :birth_date, :birth_place
12
- attr_accessor :gender
13
- attr_accessor :citizenship, :citizenship_code, :second_citizenship, :second_citizenship_code
14
- attr_accessor :living_place_id, :living_place, :living_place_registration, :living_place_registration_end, :actual_living_place
15
- attr_accessor :region_id, :region_name
16
- attr_accessor :response_id, :response_code
17
- attr_accessor :is_person_dead, :is_document_lost
18
- attr_accessor :photos
19
-
20
- def self.init_with_hash(hash)
21
- passport = CRA::PasportInfo.new
22
- passport.doc_id = hash[:document_id].to_i
23
- passport.doc_type = hash[:document_type_id].to_i
24
- passport.doc_description = hash[:document_description]
25
- passport.doc_status = hash[:document_status_enum]
26
- passport.doc_status_text = hash[:document_status_str]
27
- passport.is_id_card = hash[:is_id_card]
28
- passport.id_card_serial = hash[:id_card_serial]
29
- passport.id_card_number = hash[:id_card_number]
30
- passport.id_card_issuer = hash[:id_card_issuer]
31
- passport.id_card_issue_date = hash[:id_card_issue_date]
32
- passport.id_card_valid_date = hash[:id_card_valid_date]
33
- passport.pasport_number = hash[:pasport_number]
34
- passport.passport_issuer = hash[:passport_issuer]
35
- passport.passport_issue_date = hash[:passport_issue_date]
36
- passport.passport_valid_date = hash[:passport_valid_date]
37
- passport.person_id = hash[:person_id].to_i
38
- passport.social_id = hash[:social_id].to_i
39
- passport.private_number = hash[:private_number]
40
- passport.first_name = hash[:first_name]
41
- passport.last_name = hash[:last_name]
42
- passport.middle_name = hash[:middle_name]
43
- passport.birth_date = hash[:birth_date]
44
- passport.birth_place = hash[:birth_place]
45
- passport.gender = hash[:gender].to_i
46
- passport.citizenship = hash[:citizenship]
47
- passport.citizenship_code = hash[:citizenship_code]
48
- passport.second_citizenship = hash[:double_citizenship]
49
- passport.second_citizenship_code = hash[:double_citizenship_code]
50
- passport.living_place_id = hash[:living_place_id].to_i
51
- passport.living_place = hash[:living_place]
52
- passport.actual_living_place = hash[:fa_living_place]
53
- passport.living_place = passport.living_place.split(' ').join(' ') if passport.living_place
54
- passport.actual_living_place = passport.actual_living_place.split(' ').join(' ') if passport.actual_living_place
55
- passport.living_place_registration = hash[:living_place_reg_date]
56
- passport.living_place_registration_end = hash[:living_place_reg_end_date]
57
- passport.region_id = hash[:region_id].to_i
58
- passport.region_name = hash[:region_str_]
59
- passport.response_id = hash[:response_id].to_i
60
- passport.is_person_dead = hash[:is_person_dead]
61
- passport.is_document_lost = hash[:is_document_lost]
62
- passport.photos = []
63
- if hash[:photos] and hash[:photos].is_a?(Array)
64
- hash[:photos].each do |photo|
65
- passport.photos.push(photo[:base64_binary])
66
- end
67
- elsif hash[:photos]
68
- passport.photos.push(hash[:photos][:base64_binary])
69
- end
70
- passport
71
- end
72
-
73
- def self.list_with_hash(hash)
74
- documents = []
75
- hash[:person_info].each do |row|
76
- documents << CRA::PasportInfo.init_with_hash(row)
77
- end
78
- documents
79
- end
80
-
81
- def full_name(opts = {})
82
- if opts[:with_middle_name]
83
- "#{first_name} #{last_name} #{middle_name}"
84
- else
85
- "#{first_name} #{last_name}"
86
- end
87
- end
88
-
89
- # Returns binary content of the photo.
90
- def binary(index)
91
- Base64.decode64(self.photos[index])
92
- end
93
-
94
- def write_photo(index, file = nil)
95
- File.open(file || 'photo', 'wb') do |file|
96
- file.write self.binary(index)
97
- end
98
- end
99
-
100
- end
@@ -1,11 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
- require 'cra'
4
-
5
- describe 'test' do
6
- before(:all) do
7
- CRA.serv.test_service
8
- end
9
- subject { true }
10
- it { should == true }
11
- end
data/spec/service_spec.rb DELETED
@@ -1,87 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
- require 'cra'
4
-
5
- describe 'my UPN' do
6
- before(:all) do
7
- @upn = CRA.serv.my_upn
8
- end
9
- context do
10
- subject { @upn }
11
- it { should == 'CRA\telasi' }
12
- end
13
- context do
14
- subject { CRA.serv }
15
- its(:last_request) { should == {} }
16
- its(:last_response) { should == 'CRA\telasi' }
17
- its(:last_action) { should == 'GetMyUPN' }
18
- end
19
- end
20
-
21
- describe 'get person info by id' do
22
- before(:all) do
23
- @person_info = CRA.serv.by_personal_id('02001000490')
24
- end
25
- subject { @person_info }
26
- its(:doc_id) { should > 0 }
27
- its(:doc_type) { should == 1 }
28
- its(:doc_description) { should == 'პირადობის მოწმობა' }
29
- its(:doc_status) { should == 'Active' }
30
- its(:doc_status_text) { should == 'აქტიური' }
31
- its(:is_id_card) { should == true }
32
- its(:id_card_serial) { should == 'გ' }
33
- its(:id_card_number) { should == '1355876' }
34
- its(:id_card_issuer) { should == 'სამოქალაქო რეესტრის სააგენტოს მთაწმინდა-კრწანისის სამსახური' }
35
- its(:id_card_issue_date) { should_not be_nil }
36
- its(:id_card_valid_date) { should_not be_nil }
37
- its(:pasport_number) { should be_nil }
38
- its(:passport_issuer) { should be_nil }
39
- its(:passport_issue_date) { should be_nil }
40
- its(:passport_valid_date) { should be_nil }
41
- its(:person_id) { should == 969036 }
42
- its(:private_number) { should == '02001000490' }
43
- its(:first_name) { should == 'დიმიტრი' }
44
- its(:last_name) { should == 'ყურაშვილი' }
45
- its(:middle_name) { should == 'ალბერტი' }
46
- its(:birth_date) { should_not be_nil }
47
- its(:birth_place) { should == 'საქართველო, აბაშა' }
48
- its(:gender) { should == CRA::MALE }
49
- its(:citizenship) { should == 'საქართველო' }
50
- its(:citizenship_code) { should == 'GEO' }
51
- its(:second_citizenship) { should be_nil }
52
- its(:second_citizenship_code) { should be_nil }
53
- its(:living_place_id) { should == 920434 }
54
- its(:living_place) { should == 'თბილისი მისამართის გარეშე' }
55
- its(:living_place_registration) { should_not be_nil }
56
- its(:living_place_registration_end) { should be_nil }
57
- its(:actual_living_place) { should == 'თბილისი აკ.ხორავას ჩიხი N 8' }
58
- its(:is_person_dead) { should == false }
59
- its(:is_document_lost) { should == false }
60
- its(:photos) { should_not be_empty }
61
- end
62
-
63
- describe 'get person info by id card' do
64
- before(:all) do
65
- @person_info = CRA.serv.by_id_card('გ', '1355876')
66
- end
67
- subject { @person_info }
68
- its(:doc_id) { should > 0 }
69
- its(:first_name) { should == 'დიმიტრი' }
70
- its(:last_name) { should == 'ყურაშვილი' }
71
- its(:private_number) { should == '02001000490' }
72
- end
73
-
74
- describe 'find person documents by name and dob' do
75
- before(:all) do
76
- @documents = CRA.serv.list_by_name_and_dob('ყურაშვილი', 'დიმიტრი', 1979, 4, 4)
77
- end
78
- context do
79
- subject { @documents }
80
- its(:size) { should == 5 }
81
- end
82
- context do
83
- subject { @documents.first }
84
- its(:person_id) { should == 969036 }
85
- its(:private_number) { should == '02001000490' }
86
- end
87
- end