sii_chile 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sii_chile/consulta.rb +12 -10
- data/lib/sii_chile/rut.rb +1 -1
- data/lib/sii_chile/version.rb +1 -1
- metadata +3 -3
data/lib/sii_chile/consulta.rb
CHANGED
@@ -26,22 +26,24 @@ module SIIChile
|
|
26
26
|
|
27
27
|
data = Nokogiri::HTML(response.body)
|
28
28
|
|
29
|
+
actividades = data.xpath(XPATH_ACTIVIDADES)[1..-1].map do |node|
|
30
|
+
{
|
31
|
+
:giro => node.xpath('./td[1]/font').text.strip,
|
32
|
+
:codigo => node.xpath('./td[2]/font').text.strip.to_i,
|
33
|
+
:categoria => node.xpath('./td[3]/font').text.strip,
|
34
|
+
:afecta => node.xpath('./td[4]/font').text.strip == 'Si'
|
35
|
+
}
|
36
|
+
end rescue []
|
37
|
+
|
29
38
|
{
|
30
39
|
:rut => @rut.format,
|
31
40
|
:razon_social => data.xpath(XPATH_RAZON_SOCIAL).text.strip,
|
32
|
-
:actividades =>
|
33
|
-
{
|
34
|
-
:giro => node.xpath('./td[1]/font').text.strip,
|
35
|
-
:codigo => node.xpath('./td[2]/font').text.strip.to_i,
|
36
|
-
:categoria => node.xpath('./td[3]/font').text.strip,
|
37
|
-
:afecta => node.xpath('./td[4]/font').text.strip == 'Si'
|
38
|
-
}
|
39
|
-
end
|
41
|
+
:actividades => actividades
|
40
42
|
}
|
41
|
-
rescue
|
43
|
+
rescue StandardError => e
|
42
44
|
{
|
43
45
|
:rut => @rut.format,
|
44
|
-
:error => e.
|
46
|
+
:error => e.message
|
45
47
|
}
|
46
48
|
end
|
47
49
|
end
|
data/lib/sii_chile/rut.rb
CHANGED
data/lib/sii_chile/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sii_chile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash:
|
91
|
+
hash: 668395706914905858
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
segments:
|
99
99
|
- 0
|
100
|
-
hash:
|
100
|
+
hash: 668395706914905858
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
103
|
rubygems_version: 1.8.23
|