egov_utils 1.4.2 → 1.5.0.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/egov_utils/iszr_controller.rb +37 -0
  3. data/app/controllers/egov_utils/passwords_controller.rb +1 -1
  4. data/app/models/concerns/types.rb +3 -0
  5. data/app/models/egov_utils/abstract_person.rb +0 -2
  6. data/app/models/egov_utils/natural_person.rb +1 -1
  7. data/app/models/egov_utils/person.rb +46 -1
  8. data/app/models/egov_utils/services/iszr/legal_people.rb +11 -0
  9. data/app/models/egov_utils/services/iszr/natural_people.rb +13 -0
  10. data/app/modules/envelope.rb +22 -0
  11. data/app/services/egov_utils/archive_users.rb +2 -1
  12. data/app/services/egov_utils/iszr/addresses/fetch.rb +27 -0
  13. data/app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb +31 -0
  14. data/app/services/egov_utils/iszr/addresses/fetch_for_legal_person.rb +23 -0
  15. data/app/services/egov_utils/iszr/addresses/fetch_for_natural_person/from_sample_data.rb +31 -0
  16. data/app/services/egov_utils/iszr/addresses/fetch_for_natural_person.rb +23 -0
  17. data/app/services/egov_utils/iszr/legal_people/create_request.rb +48 -0
  18. data/app/services/egov_utils/iszr/legal_people/dev_search.rb +39 -0
  19. data/app/services/egov_utils/iszr/legal_people/prod_search.rb +47 -0
  20. data/app/services/egov_utils/iszr/legal_people/search.rb +30 -0
  21. data/app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb +39 -0
  22. data/app/services/egov_utils/iszr/natural_people/create_request.rb +97 -0
  23. data/app/services/egov_utils/iszr/natural_people/dev_search.rb +87 -0
  24. data/app/services/egov_utils/iszr/natural_people/prod_search.rb +91 -0
  25. data/app/services/egov_utils/iszr/natural_people/search.rb +31 -0
  26. data/app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb +39 -0
  27. data/app/services/egov_utils/iszr/request.rb +36 -0
  28. data/app/services/egov_utils/registration_requests/check_auto_accept.rb +1 -1
  29. data/app/views/egov_utils/people/_new_form.html.haml +127 -0
  30. data/config/locales/cs.yml +8 -0
  31. data/config/locales/en.yml +7 -0
  32. data/config/routes.rb +1 -1
  33. data/lib/egov_utils/engine.rb +3 -0
  34. data/lib/egov_utils/iszr/e05_osoby_response.xml +87 -0
  35. data/lib/egov_utils/iszr/e20_ico_response.xml +70 -0
  36. data/lib/egov_utils/iszr/lp_addresses.json +112 -0
  37. data/lib/egov_utils/iszr/lp_results.json +52 -0
  38. data/lib/egov_utils/iszr/np_addresses.json +90 -0
  39. data/lib/egov_utils/iszr/np_results.json +58 -0
  40. data/lib/egov_utils/version.rb +1 -1
  41. metadata +102 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c706bd457517726ec2f3e6aadfce8541fa03218e62eef83a41107dc348b86665
4
- data.tar.gz: 2c37f8daad4ab35dbba9b0b4780d3a5faa243715bc5107e9ef0d039dea473ce0
3
+ metadata.gz: 384310a12059528ba862ec6c1a189be9364c574abe7a6ee45e1f4e3f4c834953
4
+ data.tar.gz: 522ebbeb6eda313036fb5d3b1bfc02d93a0da6999aa0ba4d239fac7cd096c777
5
5
  SHA512:
6
- metadata.gz: 90ea9f93593b1614d3c57da82a79edbfc07ebd8afb449e39b0bf2e0d9f37485712d93a7ca6767bb42cc101706a3f4eab0238435a5986b81fbd0186799a10e423
7
- data.tar.gz: c823c3827673872f8a108b30b6ebefe3816b7a0e996b87f80eb344c5ae7bbf19b472134f3a833f2444d501277df4671980a56ea3b74388336a893bbc63a703c5
6
+ metadata.gz: 8fcf5da8cbda7a3cd0a18d8ae71725c1dbd5e37b2e76b9ab17960557d7a0d85694db83b0524063a97b504e826a3616cfe1a6b3f75d2b4d95a070de97ca7f40c3
7
+ data.tar.gz: e9169cc2d9fd27d705fd4e844762e0bbfb48adb15d8ecd1be17f00d3f66a60f84d4fa78e08a7fb5129b809ae0631e3e1f58b3524fa6a5e0dc9218f1ae0d0341f
@@ -0,0 +1,37 @@
1
+ module EgovUtils
2
+ class IszrController < ApplicationController
3
+
4
+ def search
5
+ if params.dig(:search, :ico).present?
6
+ @legal_person = EgovUtils::Iszr::LegalPeople::Search.run(search_params)
7
+
8
+ if @legal_person.valid?
9
+ render json: @legal_person.result
10
+ else
11
+ render json: @legal_person.errors.details, status: :unprocessable_entity
12
+ end
13
+ else
14
+ @natural_person = EgovUtils::Iszr::NaturalPeople::Search.run(
15
+ search_params
16
+ )
17
+ if @natural_person.valid?
18
+ render json: @natural_person.result
19
+ else
20
+ render json: @natural_person.errors.details, status: :unprocessable_entity
21
+ end
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def search_params
28
+ params.require(:search).permit(
29
+ :ico,
30
+ :firstname,
31
+ :lastname,
32
+ :birth_date,
33
+ :birth_place
34
+ )
35
+ end
36
+ end
37
+ end
@@ -19,7 +19,7 @@ module EgovUtils
19
19
  @token = @user.generate_reset_password_token
20
20
  EgovUtils::UserMailer.with(host: mailer_host).password_reset(@user, @token).deliver_later if @user.save
21
21
  flash[:notice] = t('notice_reset_email_sent')
22
- elsif !@user.password_change_possible?
22
+ elsif @user && !@user.password_change_possible?
23
23
  flash[:error] = t('notice_pw_reset_not_possible')
24
24
  end
25
25
  redirect_to egov_utils.reset_passwords_path
@@ -0,0 +1,3 @@
1
+ module Types
2
+ include Dry.Types()
3
+ end
@@ -1,7 +1,5 @@
1
1
  module EgovUtils
2
2
  class AbstractPerson < ApplicationRecord
3
-
4
3
  self.abstract_class = true
5
-
6
4
  end
7
5
  end
@@ -4,7 +4,7 @@ module EgovUtils
4
4
  belongs_to :person, class_name: 'EgovUtils::Person'
5
5
 
6
6
  validates :firstname, :lastname, :birth_date, presence: true
7
- validates :birth_date, uniqueness: { scope: [:firstname, :lastname] }, birthday: true
7
+ validates :birth_date, birthday: true
8
8
 
9
9
  def fullname
10
10
  firstname.to_s + ' ' + lastname.to_s
@@ -11,11 +11,22 @@ module EgovUtils
11
11
  enum person_type: { natural: 1, legal: 16 }
12
12
 
13
13
  validates :person_entity, presence: true
14
+ before_validation :set_residence_from_remote_id
14
15
 
15
16
  accepts_nested_attributes_for :residence, :natural_person, :legal_person
16
17
 
17
18
  delegate :fullname, :fullname=, to: :person_entity
18
19
 
20
+ attr_accessor :remote_id
21
+
22
+ def initialize(attributes = {})
23
+ if attributes&.fetch(:remote_id, nil).present?
24
+ super(attributes.slice(:remote_id, :person_type))
25
+ else
26
+ super
27
+ end
28
+ end
29
+
19
30
  def person_entity
20
31
  case person_type
21
32
  when 'natural'
@@ -25,8 +36,19 @@ module EgovUtils
25
36
  end
26
37
  end
27
38
 
39
+ def person_entity=(entity)
40
+ case person_type
41
+ when 'natural'
42
+ self.natural_person = entity
43
+ self.legal_person = nil
44
+ when 'legal'
45
+ self.legal_person = entity
46
+ self.natural_person = nil
47
+ end
48
+ end
49
+
28
50
  def residence
29
- addresses.order(created_at: :desc).first
51
+ addresses.last
30
52
  end
31
53
 
32
54
  def residence=(address)
@@ -37,5 +59,28 @@ module EgovUtils
37
59
  person_entity.to_s
38
60
  end
39
61
 
62
+ private
63
+
64
+ def set_residence_from_remote_id
65
+ return unless remote_id.present?
66
+
67
+ # binding.pry
68
+ attributes =
69
+ if person_type == 'natural'
70
+ Iszr::NaturalPeople::SearchByRemoteId.run!(remote_id:)
71
+ else
72
+ Iszr::LegalPeople::SearchByRemoteId.run!(remote_id:)
73
+ end.to_h
74
+
75
+ self.person_entity =
76
+ if person_type == 'natural'
77
+ NaturalPerson.find_or_initialize_by(attributes.except(:remote_id))
78
+ else
79
+ LegalPerson.find_or_initialize_by(attributes.except(:remote_id))
80
+ end
81
+
82
+ self.residence =
83
+ EgovUtils::Iszr::Addresses::Fetch.run!(remote_id:, person_type:)
84
+ end
40
85
  end
41
86
  end
@@ -0,0 +1,11 @@
1
+ module EgovUtils
2
+ module Services
3
+ module Iszr
4
+ class LegalPeople < Dry::Struct
5
+ attribute :name, Types::String
6
+ attribute :ico, Types::String
7
+ attribute :remote_id, Types::String
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module EgovUtils
2
+ module Services
3
+ module Iszr
4
+ class NaturalPeople < Dry::Struct
5
+ attribute :firstname, Types::String
6
+ attribute :lastname, Types::String
7
+ attribute :birth_date, Types::Params::Date
8
+ attribute :birth_place, Types::String.optional
9
+ attribute :remote_id, Types::String
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ module Envelope
2
+ def self.build_envelope(mode, service, encoded_body)
3
+ Nokogiri::XML::Builder.new do |xml|
4
+ xml.GateMessage {
5
+ xml.Version '2.0'
6
+ xml.Header {
7
+ xml.MessageDetails(type: 'request') {
8
+ xml.Class(mode: mode) {
9
+ xml.text service
10
+ }
11
+ }
12
+ xml.SenderDetails {
13
+ xml.Authentication(type: 'clear') {
14
+ xml.ISId '124'
15
+ }
16
+ }
17
+ }
18
+ xml.Body encoded_body
19
+ }
20
+ end
21
+ end
22
+ end
@@ -3,7 +3,8 @@ module EgovUtils
3
3
  def call
4
4
  EgovUtils::User
5
5
  .where.not(days_before_archive: nil, active: true).each do |user|
6
- next if user.last_login_at > Time.now - user.days_before_archive.days
6
+ date_to_compare = user.last_login_at || user.created_at
7
+ next if date_to_compare > Time.now - user.days_before_archive.days
7
8
 
8
9
  user.destroy
9
10
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module Addresses
6
+ class Fetch < ActiveInteraction::Base
7
+ string :remote_id
8
+ string :person_type
9
+
10
+ def execute
11
+ strategy_class.run!(remote_id: remote_id)
12
+ end
13
+
14
+ private
15
+
16
+ def strategy_class
17
+ case person_type
18
+ when 'legal'
19
+ EgovUtils::Iszr::Addresses::FetchForLegalPerson
20
+ when 'natural'
21
+ EgovUtils::Iszr::Addresses::FetchForNaturalPerson
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module Addresses
6
+ class FetchForLegalPerson
7
+ class FromSampleData < ActiveInteraction::Base
8
+ string :remote_id
9
+
10
+ def execute
11
+ attrs = sample_results.detect do |address|
12
+ address['remote_id'] == remote_id
13
+ end
14
+
15
+ EgovUtils::Address.new(attrs.except('remote_id'))
16
+ end
17
+
18
+ private
19
+
20
+ def sample_results
21
+ results = File.read(
22
+ EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_addresses.json')
23
+ )
24
+
25
+ JSON.parse(results)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module Addresses
6
+ class FetchForLegalPerson < ActiveInteraction::Base
7
+ string :remote_id
8
+
9
+ def execute
10
+ strategy_class.run!(remote_id:)
11
+ end
12
+
13
+ def strategy_class
14
+ if Rails.env.production?
15
+ EgovUtils::Iszr::Addresses::FetchForLegalPerson::FromRemoteReposiory
16
+ else
17
+ EgovUtils::Iszr::Addresses::FetchForLegalPerson::FromSampleData
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module Addresses
6
+ class FetchForNaturalPerson
7
+ class FromSampleData < ActiveInteraction::Base
8
+ string :remote_id
9
+
10
+ def execute
11
+ attrs = sample_results.detect do |address|
12
+ address['remote_id'] == remote_id
13
+ end
14
+
15
+ EgovUtils::Address.new(attrs.except('remote_id'))
16
+ end
17
+
18
+ private
19
+
20
+ def sample_results
21
+ results = File.read(
22
+ EgovUtils::Engine.root.join('lib/egov_utils/iszr/np_addresses.json')
23
+ )
24
+
25
+ JSON.parse(results)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module Addresses
6
+ class FetchForNaturalPerson < ActiveInteraction::Base
7
+ string :remote_id
8
+
9
+ def execute
10
+ strategy_class.run!(remote_id:)
11
+ end
12
+
13
+ def strategy_class
14
+ if Rails.env.production?
15
+ EgovUtils::Iszr::Addresses::FetchForNaturalPerson::FromRemoteReposiory
16
+ else
17
+ EgovUtils::Iszr::Addresses::FetchForNaturalPerson::FromSampleData
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,48 @@
1
+ module EgovUtils
2
+ module Iszr
3
+ module LegalPeople
4
+ class CreateRequest < Request
5
+ string :ico
6
+
7
+ private
8
+
9
+ def body
10
+ Nokogiri::XML::Builder.new do |xml|
11
+ xml['e20'].RosCtiIco(
12
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
13
+ 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco:v1 IszrRosCtiIco.xsd',
14
+ 'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
15
+ 'xmlns:e20' => 'urn:cz:isvs:iszr:schemas:IszrRosCtiIco:v1',
16
+ 'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
17
+ 'xmlns:ros' => 'urn:cz:isvs:ros:schemas:RosDotazyData:v2'
18
+ ) {
19
+ xml['abs'].ZadostInfo {
20
+ xml['reg'].CasZadosti Time.current
21
+ xml['reg'].Agenda 'A482'
22
+ xml['reg'].AgendovaRole 'CTENAR'
23
+ xml['reg'].Ovm '00025429'
24
+ xml['reg'].Ais '124'
25
+ xml['reg'].Uzivatel 'Uzivatel156'
26
+ xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
27
+ }
28
+ xml['abs'].AutorizaceInfo {
29
+ xml['abs'].SeznamUdaju 'DatovaSchrankaROS ObchodniNazev PravniForma PravniStav
30
+ FyzickaOsoba AdresaSidla Provozovny StatutarniOrgany DatumVznikuOpravneni DatumZanikuOpravneni
31
+ Ico Jmeno Prijmeni AdresaPobytu AdresaUradu ROBCti ROSCti RUIANCti'
32
+ }
33
+ xml['e20'].Zadost {
34
+ xml['e20'].RosCtiIcoData {
35
+ xml['ros'].Ico ico
36
+ }
37
+ }
38
+ }
39
+ end
40
+ end
41
+
42
+ def service_id
43
+ 'E20'
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,39 @@
1
+ module EgovUtils
2
+ module Iszr
3
+ module LegalPeople
4
+ class DevSearch < ActiveInteraction::Base
5
+ string :ico
6
+
7
+ validates :ico, presence: true
8
+
9
+ MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
10
+
11
+ def execute
12
+ legal_person = initialize_person.detect { |person| person.ico == ico }
13
+
14
+ if legal_person.nil?
15
+ errors.add(:base, I18n.t('errors.messages.legal_person.not_found'))
16
+ else
17
+ legal_person
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def sample_results
24
+ EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_results.json')
25
+ end
26
+
27
+ def initialize_person
28
+ response = File.read(sample_results)
29
+
30
+ body = JSON.parse(response)
31
+
32
+ body.map do
33
+ MAPPING_CLASS.new(_1.deep_symbolize_keys!)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,47 @@
1
+ module EgovUtils
2
+ module Iszr
3
+ module LegalPeople
4
+ class ProdSearch < ActiveInteraction::Base
5
+ string :ico
6
+
7
+ validates :ico, presence: true
8
+
9
+ MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
10
+
11
+ def execute
12
+ find_person
13
+ end
14
+
15
+ private
16
+
17
+ def request
18
+ result = EgovUtils::Iszr::LegalPeople::CreateRequest.run(ico:)
19
+ # make some call to API with result
20
+ end
21
+
22
+ def find_person
23
+ # Request will contain provided ICO on which the response will be based
24
+
25
+ response = File.read(sample_results)
26
+
27
+ body = Nokogiri::XML(response)
28
+
29
+ person = MAPPING_CLASS.new(
30
+ ico: body.at('//dot:Ico').text,
31
+ name: body.at('//dot:NazevOsoby').text,
32
+ remote_id: body.at('//ros:Aifo').text
33
+ )
34
+ if person.nil?
35
+ errors.add(:base, I18n.t('errors.messages.legal_person.not_found'))
36
+ else
37
+ person
38
+ end
39
+ end
40
+
41
+ def sample_results
42
+ 'lib/egov_utils/iszr/e20_ico_response.xml'
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,30 @@
1
+ module EgovUtils
2
+ module Iszr
3
+ module LegalPeople
4
+ class Search < ActiveInteraction::Base
5
+ string :ico
6
+
7
+ validates :ico, presence: true
8
+
9
+ def execute
10
+ person = find_person_service.run(ico:)
11
+ if person.valid?
12
+ person.result
13
+ else
14
+ errors.merge!(person.errors)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def find_person_service
21
+ if Rails.env.development?
22
+ EgovUtils::Iszr::LegalPeople::DevSearch
23
+ else
24
+ EgovUtils::Iszr::LegalPeople::ProdSearch
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module LegalPeople
6
+ class SearchByRemoteId < ActiveInteraction::Base
7
+ MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople
8
+
9
+ string :remote_id
10
+
11
+ def execute
12
+ find_person
13
+ end
14
+
15
+ private
16
+
17
+ def find_person
18
+ initialize_person.find do |person|
19
+ person.remote_id == remote_id
20
+ end
21
+ end
22
+
23
+ def sample_results
24
+ EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_results.json')
25
+ end
26
+
27
+ def initialize_person
28
+ response = File.read(sample_results)
29
+
30
+ body = JSON.parse(response)
31
+
32
+ body.map do
33
+ MAPPING_CLASS.new(_1.deep_symbolize_keys!)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EgovUtils
4
+ module Iszr
5
+ module NaturalPeople
6
+ class CreateRequest < Request
7
+ string :firstname
8
+ string :lastname
9
+ string :birth_date
10
+ string :birth_place, default: nil
11
+
12
+ private
13
+
14
+ def body
15
+ if birth_place.present?
16
+ search_stage_two
17
+ else
18
+ search_stage_one
19
+ end
20
+ end
21
+
22
+ def search_stage_one
23
+ Nokogiri::XML::Builder.new do |xml|
24
+ xml['e05'].RobCtiPodleUdaju(
25
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
26
+ 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1 IszrRobCtiPodleUdaju.xsd',
27
+ 'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
28
+ 'xmlns:e05' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1',
29
+ 'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
30
+ 'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
31
+ 'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
32
+ ) {
33
+ xml['abs'].ZadostInfo {
34
+ xml['reg'].CasZadosti Time.current
35
+ xml['reg'].Agenda 'A482'
36
+ xml['reg'].AgendovaRole 'CTENAR'
37
+ xml['reg'].Ovm '00025429'
38
+ xml['reg'].Ais '124'
39
+ xml['reg'].Uzivatel 'Uzivatel156'
40
+ xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
41
+ }
42
+ xml['abs'].AutorizaceInfo {
43
+ xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno AdresaPobytu DorucovaciAdresa DatumNarozeni MistoNarozeni DatumUmrti DatumPravniMociUmrti MistoUmrti DatovaSchrankaROB Doklad Obcanstvi'
44
+ }
45
+ xml['e05'].Zadost {
46
+ xml['e05'].RobCtiPodleUdajuData {
47
+ xml['rod'].DatumNarozeni birth_date
48
+ xml['rod'].Jmeno firstname
49
+ xml['rod'].Prijmeni lastname
50
+ }
51
+ }
52
+ }
53
+ end
54
+ end
55
+
56
+ def search_stage_two
57
+ Nokogiri::XML::Builder.new do |xml|
58
+ xml['e05'].RobCtiPodleUdaju(
59
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
60
+ 'xsi:schemaLocation' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1 IszrRobCtiPodleUdaju.xsd',
61
+ 'xmlns:abs' => 'urn:cz:isvs:iszr:schemas:IszrAbstract:v1',
62
+ 'xmlns:e05' => 'urn:cz:isvs:iszr:schemas:IszrRobCtiPodleUdaju:v1',
63
+ 'xmlns:reg' => 'urn:cz:isvs:reg:schemas:RegTypy:v1',
64
+ 'xmlns:rod' => 'urn:cz:isvs:rob:schemas:RobDotazyData:v1',
65
+ 'xmlns:rob' => 'urn:cz:isvs:rob:schemas:RobTypy:v1'
66
+ ) {
67
+ xml['abs'].ZadostInfo {
68
+ xml['reg'].CasZadosti Time.current
69
+ xml['reg'].Agenda 'A482'
70
+ xml['reg'].AgendovaRole 'CTENAR'
71
+ xml['reg'].Ovm '00025429'
72
+ xml['reg'].Ais '124'
73
+ xml['reg'].Uzivatel 'Uzivatel156'
74
+ xml['reg'].AgendaZadostId '5a7b9af0-f759-4632-ab96-7bb06df1b98c'
75
+ }
76
+ xml['abs'].AutorizaceInfo {
77
+ xml['abs'].SeznamUdaju 'Aifo Prijmeni Jmeno AdresaPobytu DorucovaciAdresa DatumNarozeni MistoNarozeni DatumUmrti DatumPravniMociUmrti MistoUmrti DatovaSchrankaROB Doklad Obcanstvi'
78
+ }
79
+ xml['e05'].Zadost {
80
+ xml['e05'].RobCtiPodleUdajuData {
81
+ xml['rod'].MistoNarozeni birth_place
82
+ xml['rod'].DatumNarozeni birth_date
83
+ xml['rod'].Jmeno firstname
84
+ xml['rod'].Prijmeni lastname
85
+ }
86
+ }
87
+ }
88
+ end
89
+ end
90
+
91
+ def service_id
92
+ 'E05'
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end