egov_utils 1.5.0.alpha11 → 1.5.0.alpha12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/egov_utils/iszr/find_address_by_ico.rb +59 -61
- data/lib/egov_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '078ff51d228a6daa3256634531da7ab192c702e4b50983b47efea4f697d0cd04'
|
4
|
+
data.tar.gz: c767737919a144419c646aaa436c60eab238922329703996e266b82284894bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 920fb3ef3d111b29f64ab3310e91eeda3fed4d2932510f11dbfdd8b8f007bdb37edbbc6e2c271bbf7f5b5f7313bf43be802d56691dcae94d5d3094c44ec220d6
|
7
|
+
data.tar.gz: cbe7ce9f4a893a5623dbcd5699d9fb5fc7012e1071c58e338fd3a2f3b95fde5e3f24a1dcc9a8a75cf19e4261f293e3417b090e2059ce3175d6a3202701d57195
|
@@ -1,77 +1,75 @@
|
|
1
1
|
module EgovUtils
|
2
2
|
module Iszr
|
3
|
-
|
4
|
-
|
5
|
-
string :remote_id
|
3
|
+
class FindAddressByIco < Request
|
4
|
+
string :remote_id
|
6
5
|
|
7
|
-
|
6
|
+
private
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
def handle_response!
|
9
|
+
EgovUtils::Address.new(
|
10
|
+
street:
|
11
|
+
response_body.xpath('//UliceNazev').text.presence || response_body.xpath('//CastObceNazev').text,
|
12
|
+
house_number: response_body.xpath('//CisloDomovni').text,
|
13
|
+
orientation_number: response_body.xpath('//CisloOrientacni').text,
|
14
|
+
city: response_body.xpath('//ObecNazev').text,
|
15
|
+
postcode: response_body.xpath('//PostaKod').text,
|
16
|
+
egov_identifier: response_body.xpath('//AdresniMistoKod').text,
|
17
|
+
country: 203,
|
18
|
+
district: district.name,
|
19
|
+
region: region.name
|
20
|
+
)
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
23
|
+
def body
|
24
|
+
Nokogiri::XML::Builder.new do |xml|
|
25
|
+
xml['e256'].RosCtiIco2(
|
26
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
27
|
+
'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1 IszrRosCtiIco2.xsd',
|
28
|
+
'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
|
29
|
+
'xmlns:e256' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1',
|
30
|
+
'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
|
31
|
+
'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
|
32
|
+
) {
|
33
|
+
xml['abs'].ZadostInfo {
|
34
|
+
xml['reg'].CasZadosti Time.current.iso8601
|
35
|
+
xml['reg'].Agenda EgovUtils::Settings['iszr']['agenda']
|
36
|
+
xml['reg'].AgendovaRole EgovUtils::Settings['iszr']['agendova_role']
|
37
|
+
xml['reg'].Ovm '00025429'
|
38
|
+
xml['reg'].Ais EgovUtils::Settings['iszr']['ais']
|
39
|
+
xml['reg'].Subjekt '00025429'
|
40
|
+
xml['reg'].Uzivatel 'Administrator'
|
41
|
+
xml['reg'].DuvodUcel 'ztotozneni'
|
42
|
+
xml['reg'].AgendaZadostId SecureRandom.uuid
|
43
|
+
}
|
44
|
+
xml['abs'].AutorizaceInfo {
|
45
|
+
xml['abs'].SeznamUdaju 'ObchodniNazev AdresaSidla ROBCti ROSCti RUIANCti'
|
46
|
+
}
|
47
|
+
xml['e256'].Zadost {
|
48
|
+
xml['e256'].RosCtiIco2Data {
|
49
|
+
xml['ros'].Ico remote_id
|
52
50
|
}
|
53
51
|
}
|
54
|
-
|
52
|
+
}
|
55
53
|
end
|
54
|
+
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
def response_error_code
|
57
|
+
@response_error_code ||=
|
58
|
+
response_body.xpath('//VysledekSubKod').last&.text&.presence
|
59
|
+
end
|
61
60
|
|
62
|
-
|
63
|
-
|
61
|
+
def internal_error_code
|
62
|
+
return unless response_error_code
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
64
|
+
if response_error_code == 'ZAZNAM NENALEZEN'
|
65
|
+
"not_found"
|
66
|
+
elsif response_error_code == 'PREKROCEN POCET'
|
67
|
+
"multiple_records_found"
|
70
68
|
end
|
69
|
+
end
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
end
|
71
|
+
def service_id
|
72
|
+
'E256'
|
75
73
|
end
|
76
74
|
end
|
77
75
|
end
|
data/lib/egov_utils/version.rb
CHANGED