egov_utils 1.5.0.alpha6 → 1.5.0.alpha7

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: e2bc0db722008e17fe249d9f926ef682158347617a2996376e3d49977988e156
4
- data.tar.gz: 79ec1be625f5a89a6c2ff83eb23d90cdacf98aebfc8e5f13b408f7575789bf3d
3
+ metadata.gz: 8d80ce57772376984dc71c64d0decbdd53c4073799b6723342894bc9a3bedca3
4
+ data.tar.gz: e1fc10f642117f82182dee45fc843f8edae595e147ca947282451d98ba3c172b
5
5
  SHA512:
6
- metadata.gz: 5886bc235bf093751ceec0bf69785e7a6f391a24bdb548ba059f0f202f8c8c170b127b9e7f53abb955024aad6ab43d7996672802be88d1dfc4c75ada0587e508
7
- data.tar.gz: ba7c6a6fb1f924e001d33108451d9dfbb97beebe98d9ddd54f454fa435ba7f85d1ea692de9fea720f17c2ae656ba6c435283442ddc9f0662b52a46fbd81f448c
6
+ metadata.gz: bf4f4e4e7c9d410dae945f4ba17277542f7a6e592fbe608dbc8138aaa18d95d231ecc49cbda23956f6656810d55d77c979f68a2fd205f7d4c3df5bb53da94387
7
+ data.tar.gz: 46ae91daba2de27e4eb820b33ff0b88b19e3cbef7872df53532a928eb9e0aef3090477854167674983b749f63fd9ee84907be51896f107e1ba005e1dddd26b30
@@ -10,9 +10,9 @@ module EgovUtils
10
10
  strategy_class.run!(remote_id:)
11
11
  end
12
12
 
13
- def fetch_result
13
+ def strategy_class
14
14
  if Rails.env.production?
15
- EgovUtils::Iszr::FindResultByAifo
15
+ EgovUtils::Iszr::FindAddressByAifo
16
16
  else
17
17
  EgovUtils::Iszr::Addresses::FetchForNaturalPerson::FromSampleData
18
18
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EgovUtils
4
4
  module Iszr
5
- class FindResultByAifo < Request
5
+ class FindAddressByAifo < Request
6
6
  string :remote_id
7
7
 
8
8
  private
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ class FindPersonByAifo < Request
6
+ string :remote_id
7
+
8
+ private
9
+
10
+ def handle_response!
11
+ EgovUtils::NaturalPerson.new(
12
+ firstname: response_body.xpath('//Jmeno').text.capitalize,
13
+ lastname: response_body.xpath('//Prijmeni').text.capitalize,
14
+ birth_date: response_body.xpath('//DatumNarozeni').text,
15
+ birth_place: response_body.xpath('//Lokalita/Nazev').text
16
+ )
17
+ end
18
+
19
+ def body
20
+ Nokogiri::XML::Builder.new do |xml|
21
+ xml[service_id].RobCtiAifo2(
22
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
23
+ 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1 IszrRobCtiAifo2.xsd',
24
+ 'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
25
+ 'xmlns:E276' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiAifo2:v1',
26
+ 'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
27
+ 'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
28
+ 'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
29
+ ) {
30
+ xml['abs'].ZadostInfo {
31
+ xml['reg'].CasZadosti Time.current.iso8601
32
+ xml['reg'].Agenda EgovUtils::Settings['iszr']['agenda']
33
+ xml['reg'].AgendovaRole EgovUtils::Settings['iszr']['agendova_role']
34
+ xml['reg'].Ovm '00025429'
35
+ xml['reg'].Ais EgovUtils::Settings['iszr']['ais']
36
+ xml['reg'].Subjekt '00025429'
37
+ xml['reg'].Uzivatel 'Administrator'
38
+ xml['reg'].DuvodUcel 'ztotozneni'
39
+ xml['reg'].AgendaZadostId SecureRandom.uuid
40
+ }
41
+ xml['abs'].AutorizaceInfo {
42
+ xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno DatumNarozeni RUIANCti AdresaPobytu MistoNarozeni'
43
+ }
44
+ xml['abs'].MapaAifo(nacistData: true) {
45
+ xml['reg'].PrevodAifo {
46
+ xml['reg'].LokalniAifo 1
47
+ xml['reg'].GlobalniAifo remote_id
48
+ }
49
+ }
50
+ xml[service_id].Zadost {
51
+ xml[service_id].RobCtiAifo2Data {
52
+ xml['rod'].Aifo 1
53
+ xml['rod'].VyuzitiPoskytnuti 'poskytnuti'
54
+ }
55
+ }
56
+ }
57
+ end
58
+ end
59
+
60
+ def service_id
61
+ 'E276'
62
+ end
63
+ end
64
+ end
65
+ end
@@ -9,12 +9,20 @@ module EgovUtils
9
9
  string :remote_id
10
10
 
11
11
  def execute
12
- find_person
12
+ if Rails.env.production?
13
+ find_remote_person
14
+ else
15
+ find_local_person
16
+ end
13
17
  end
14
18
 
15
19
  private
16
20
 
17
- def find_person
21
+ def find_remote_person
22
+ EgovUtils::Iszr::FindPersonByAifo.run!(remote_id:)
23
+ end
24
+
25
+ def find_local_person
18
26
  initialize_person.find do |person|
19
27
  person.remote_id == remote_id
20
28
  end
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.5.0.alpha6'
2
+ VERSION = '1.5.0.alpha7'
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.alpha6
4
+ version: 1.5.0.alpha7
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-09-12 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -673,7 +673,8 @@ files:
673
673
  - app/services/egov_utils/iszr/addresses/fetch_for_natural_person.rb
674
674
  - app/services/egov_utils/iszr/addresses/fetch_for_natural_person/from_sample_data.rb
675
675
  - app/services/egov_utils/iszr/client.rb
676
- - app/services/egov_utils/iszr/find_result_by_aifo.rb
676
+ - app/services/egov_utils/iszr/find_address_by_aifo.rb
677
+ - app/services/egov_utils/iszr/find_person_by_aifo.rb
677
678
  - app/services/egov_utils/iszr/legal_people/create_request.rb
678
679
  - app/services/egov_utils/iszr/legal_people/dev_search.rb
679
680
  - app/services/egov_utils/iszr/legal_people/prod_search.rb