egov_utils 1.5.0.alpha8 → 1.5.0.alpha9

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: b6a2e101cbf4b714b08ce70939e456be732a40ab86d7604353fb38305c0a1279
4
- data.tar.gz: f35085cfd393565d01c9e29ec2cf8fce368a969681bed47fe4764152443b892f
3
+ metadata.gz: cdd3ba5d80c2b78ca123456c6c866cb6bbc82d8555559e2d373606b6598c4a9c
4
+ data.tar.gz: 12288d09e8d4408edf545abb46607bcca029b2ef28ea7d1c4ddbac7649e56ed9
5
5
  SHA512:
6
- metadata.gz: a07adfc98c660f9bb8a109438df3c39c8012358a7185c3378eb273622c8b21aa6195b9a960c34c80955d7b292feaadf8a4fd66134e3b3843152b42049bd2a923
7
- data.tar.gz: c065f9700cfb5fa5cb5da42105c40935018db05cfedec59b138a6e0f33a10bf9581c56eccea52f3f05c7a7b8cc1d2ed84a32826630d0c70b957c788c26d233b8
6
+ metadata.gz: 2d8792b34656d1e1e3b233041515a4b586d3ae2e4b046d740a92dc933d1c7ff6d4731ee817aea591e9f55a1db0b7a61f981d95858853683a3a7b536777b708ff
7
+ data.tar.gz: 126be5c5148fd7200c58d72142a5baade0c0c2cfa1f3d333b90a5a298492aff2240a1ae0c47201b74bebd2c18b8e3527ece516f3dfbe93fb698883f7457889ee
@@ -11,6 +11,8 @@ module EgovUtils
11
11
  enum person_type: { natural: 1, legal: 16 }
12
12
 
13
13
  validates :person_entity, presence: true
14
+
15
+ before_validation :keep_correct_person_type
14
16
  before_validation :set_person_from_remote_id
15
17
 
16
18
  accepts_nested_attributes_for :residence, :natural_person, :legal_person
@@ -79,5 +81,14 @@ module EgovUtils
79
81
  self.residence =
80
82
  EgovUtils::Iszr::Addresses::Fetch.run!(remote_id:, person_type:)
81
83
  end
84
+
85
+ def keep_correct_person_type
86
+ case person_type
87
+ when 'natural'
88
+ self.legal_person = nil
89
+ when 'legal'
90
+ self.natural_person = nil
91
+ end
92
+ end
82
93
  end
83
94
  end
@@ -9,7 +9,8 @@ module EgovUtils
9
9
 
10
10
  def handle_response!
11
11
  EgovUtils::Address.new(
12
- street: response_body.xpath('//UliceNazev').text,
12
+ street:
13
+ response_body.xpath('//UliceNazev').text.presence || response_body.xpath('//CastObceNazev').text,
13
14
  house_number: response_body.xpath('//CisloDomovni').text,
14
15
  orientation_number: response_body.xpath('//CisloOrientacni').text,
15
16
  city: response_body.xpath('//ObecNazev').text,
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.5.0.alpha8'
2
+ VERSION = '1.5.0.alpha9'
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.alpha8
4
+ version: 1.5.0.alpha9
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-17 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails