@@ -15,15 +15,15 @@ def self.get_subject(xml)
15
15
doc = self . parse_document xml
16
16
17
17
# Basic info
18
- doc . find ( '//dtt:Zakladni_udaje ' ) . each do |node |
18
+ doc . find ( '//D:VBAS ' ) . each do |node |
19
19
attrs = node . children ( )
20
20
21
21
# Attributes of the subject
22
- @status = node . find ( 'dtt:Stav' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Stav' ) == 0
23
- @updated_at = node . find ( 'dtt:Datum_zmeny ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Datum_zmeny ' ) . to_a . size == 0
24
- @ic = node . find ( 'dtt:ICO ' ) . to_a [ 0 ] . content
25
- @dic = node . find ( 'dtt:DIC ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:DIC ' ) . to_a . size == 0
26
- @name = node . find ( 'dtt:Obchodni_firma ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Obchodni_firma ' ) . to_a . size == 0
22
+ @status = node . find ( "D:ROR/D:SOR/D:SSU" ) . to_a [ 0 ] . content unless node . find ( 'D:ROR/D:SOR/D:SSU' ) . to_a . size == 0
23
+ @ic = node . find ( 'D:ICO ' ) . to_a [ 0 ] . content unless node . find ( 'D:ICO ' ) . to_a . size == 0
24
+ @dic = node . find ( 'D:DIC ' ) . to_a [ 0 ] . content unless node . find ( 'D:DIC' ) . to_a . size == 0
25
+ @name = node . find ( 'D:OF ' ) . to_a [ 0 ] . content unless node . find ( 'D:OF ' ) . to_a . size == 0
26
+ @legal_form = node . find ( 'D:PF/D:NPF ' ) . to_a [ 0 ] . content unless node . find ( 'D:PF/D:NPF ' ) . to_a . size == 0
27
27
end
28
28
29
29
# Corresponding addresses
@@ -32,28 +32,28 @@ def self.get_subject(xml)
32
32
raise ParseError , "Can't parse the given document."
33
33
end
34
34
35
- if doc . find ( '//dtt:Error ' ) . to_a . size > 0
35
+ if doc . find ( '//D:E ' ) . to_a . size > 0
36
36
raise ARESDatabaseError , 'ARES returned an error.'
37
37
end
38
38
39
39
# Create and return subject
40
- return RubyARES ::Subject . new ( @ic , @dic , @name , @status , @addresses , @updated_at )
40
+ return RubyARES ::Subject . new ( @ic , @dic , @name , @status , @addresses , @updated_at , @legal_form )
41
41
end
42
42
43
43
protected
44
44
45
45
def self . find_addresses ( doc )
46
46
@addresses = [ ]
47
47
48
- doc . find ( '//dtt:Adresa ' ) . each do |node |
49
- id = node . find ( 'dtt:ID_adresy ' ) . to_a [ 0 ] . content
50
- street = node . find ( 'dtt:Nazev_ulice ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Nazev_ulice ' ) . to_a . size == 0
51
- postcode = node . find ( 'dtt :PSC' ) . to_a [ 0 ] . content unless node . find ( 'dtt :PSC' ) . to_a . size == 0
52
- city = node . find ( 'dtt:Nazev_obce ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Nazev_obce ' ) . to_a . size == 0
53
- city_part = node . find ( 'dtt:Nazev_casti_obce ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Nazev_casti_obce ' ) . to_a . size == 0
54
- house_number = node . find ( 'dtt:Cislo_domovni ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Cislo_domovni ' ) . to_a . size == 0
55
- house_number_type = node . find ( 'dtt:Typ_cislo_domovni ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Typ_cislo_domovni ' ) . to_a . size == 0
56
- orientational_number = node . find ( 'dtt:Cislo_orientacni ' ) . to_a [ 0 ] . content unless node . find ( 'dtt:Cislo_orientacni ' ) . to_a . size == 0
48
+ doc . find ( '//D:AA ' ) . each do |node |
49
+ id = node . find ( 'D:IDA ' ) . to_a [ 0 ] . content
50
+ street = node . find ( 'D:NU ' ) . to_a [ 0 ] . content unless node . find ( 'D:NU ' ) . to_a . size == 0
51
+ postcode = node . find ( 'D :PSC' ) . to_a [ 0 ] . content unless node . find ( 'D :PSC' ) . to_a . size == 0
52
+ city = node . find ( 'D:N ' ) . to_a [ 0 ] . content unless node . find ( 'D:N ' ) . to_a . size == 0
53
+ city_part = node . find ( 'D:NCO ' ) . to_a [ 0 ] . content unless node . find ( 'D:NCO ' ) . to_a . size == 0
54
+ house_number = node . find ( 'D:CD ' ) . to_a [ 0 ] . content unless node . find ( 'D:CD ' ) . to_a . size == 0
55
+ house_number_type = node . find ( 'D:TCD ' ) . to_a [ 0 ] . content unless node . find ( 'D:TCD ' ) . to_a . size == 0
56
+ orientational_number = node . find ( 'D:CO ' ) . to_a [ 0 ] . content unless node . find ( 'D:CO ' ) . to_a . size == 0
57
57
58
58
@addresses << RubyARES ::Address . new ( id , street , postcode , city , city_part ,
59
59
house_number , house_number_type , orientational_number )
0 commit comments