egov_utils 1.5.0.alpha12 → 1.5.0.alpha14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '078ff51d228a6daa3256634531da7ab192c702e4b50983b47efea4f697d0cd04'
4
- data.tar.gz: c767737919a144419c646aaa436c60eab238922329703996e266b82284894bdd
3
+ metadata.gz: d363c163c061946ca1a51e7b8469a635e0242a74ec2078ef18323e790ecbffa9
4
+ data.tar.gz: 7dd47263f0000350ae2379869ae3d124f793e54ba4c8c784e7f65c1ccd59e978
5
5
  SHA512:
6
- metadata.gz: 920fb3ef3d111b29f64ab3310e91eeda3fed4d2932510f11dbfdd8b8f007bdb37edbbc6e2c271bbf7f5b5f7313bf43be802d56691dcae94d5d3094c44ec220d6
7
- data.tar.gz: cbe7ce9f4a893a5623dbcd5699d9fb5fc7012e1071c58e338fd3a2f3b95fde5e3f24a1dcc9a8a75cf19e4261f293e3417b090e2059ce3175d6a3202701d57195
6
+ metadata.gz: f176f92bbffb1bc961d5203c23b718ce15a563a0ee0785381e0e7970f2267652f0f0afaf59b5514a27b2d23880ceafceeae52f8085470f682ca07b066b2417de
7
+ data.tar.gz: cebe41d86d4bb9f41f663dbef1f2cb62784641e1db593ae30c48ad449d3777ef3b77ab524a423a33d68fa859d78159a70fdd910e6828a58fc6e0091d2e178765
@@ -20,6 +20,22 @@ module EgovUtils
20
20
  )
21
21
  end
22
22
 
23
+ def district
24
+ @district ||= begin
25
+ district =
26
+ EgovUtils::Address.towns.find do
27
+ _1.id == response_body.xpath('//ObecKod').text
28
+ end.district_name
29
+
30
+ EgovUtils::Address.districts.find { _1.name == district }
31
+ end
32
+ end
33
+
34
+ def region
35
+ @region ||=
36
+ EgovUtils::Address.regions.find { _1.id == district.region_id }
37
+ end
38
+
23
39
  def body
24
40
  Nokogiri::XML::Builder.new do |xml|
25
41
  xml['e256'].RosCtiIco2(
@@ -1,8 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
1
  module EgovUtils
4
2
  module Iszr
5
- class FindPersonByAifo < Request
3
+ class FindPersonByIco < Request
6
4
  string :remote_id
7
5
 
8
6
  private
@@ -16,14 +14,13 @@ module EgovUtils
16
14
 
17
15
  def body
18
16
  Nokogiri::XML::Builder.new do |xml|
19
- xml[service_id].RobCtiAifo2(
17
+ xml['e256'].RosCtiIco2(
20
18
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
21
- 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1 IszrRobCtiAifo2.xsd',
19
+ 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1 IszrRosCtiIco2.xsd',
22
20
  'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
23
- 'xmlns:E276' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1',
21
+ 'xmlns:e256' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco2:v1',
24
22
  'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
25
- 'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
26
- 'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
23
+ 'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
27
24
  ) {
28
25
  xml['abs'].ZadostInfo {
29
26
  xml['reg'].CasZadosti Time.current.iso8601
@@ -37,26 +34,34 @@ module EgovUtils
37
34
  xml['reg'].AgendaZadostId SecureRandom.uuid
38
35
  }
39
36
  xml['abs'].AutorizaceInfo {
40
- xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno DatumNarozeni RUIANCti AdresaPobytu MistoNarozeni'
41
- }
42
- xml['abs'].MapaAifo(nacistData: true) {
43
- xml['reg'].PrevodAifo {
44
- xml['reg'].LokalniAifo 1
45
- xml['reg'].GlobalniAifo remote_id
46
- }
37
+ xml['abs'].SeznamUdaju 'ObchodniNazev AdresaSidla ROBCti ROSCti RUIANCti'
47
38
  }
48
- xml[service_id].Zadost {
49
- xml[service_id].RobCtiAifo2Data {
50
- xml['rod'].Aifo 1
51
- xml['rod'].VyuzitiPoskytnuti 'poskytnuti'
39
+ xml['e256'].Zadost {
40
+ xml['e256'].RosCtiIco2Data {
41
+ xml['ros'].Ico remote_id
52
42
  }
53
43
  }
54
44
  }
55
45
  end
56
46
  end
57
47
 
48
+ def response_error_code
49
+ @response_error_code ||=
50
+ response_body.xpath('//VysledekSubKod').last&.text&.presence
51
+ end
52
+
53
+ def internal_error_code
54
+ return unless response_error_code
55
+
56
+ if response_error_code == 'ZAZNAM NENALEZEN'
57
+ "not_found"
58
+ elsif response_error_code == 'PREKROCEN POCET'
59
+ "multiple_records_found"
60
+ end
61
+ end
62
+
58
63
  def service_id
59
- 'E276'
64
+ 'E256'
60
65
  end
61
66
  end
62
67
  end
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.5.0.alpha12'
2
+ VERSION = '1.5.0.alpha14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.alpha12
4
+ version: 1.5.0.alpha14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails