padron 0.1.8 → 0.2.2
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.
- checksums.yaml +4 -4
- data/lib/padron/call.rb +30 -17
- data/lib/padron/id_persona.rb +1 -1
- data/lib/padron/version.rb +1 -1
- data/padron.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1519e9d1a247324df5289058c622b33040dd15b8c1ff42636b52eec65dce79da
|
4
|
+
data.tar.gz: 3a8749a449403ed4ef2d13f94d953dd52d2607a4d8a6d9c2b17ae1fb8e320894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cbee03ad7175af89b4bb20a80f24c72623ddd027a47e9658c9c5514c15de992f79f6309a8283ca44ff8c5dc4617aa7d6cf54a0f3d970e1c418d5ce41ddde23b
|
7
|
+
data.tar.gz: fdf2c3a9459009639cfef0c4b77a7371abf0abcdc248dc052b207e684ce282c7c4e4126b71561f245320df61944effaf031389dbbbcc31c88730105655f73331
|
data/lib/padron/call.rb
CHANGED
@@ -49,11 +49,11 @@ module Padron
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def set_body
|
52
|
-
ids = Padron::IdPersona.new(id).return_cuits
|
52
|
+
ids = id.is_a?(Array) ? id : Padron::IdPersona.new(id).return_cuits
|
53
53
|
body = Padron.auth_hash
|
54
54
|
id_personas = []
|
55
55
|
ids.map do |cuit|
|
56
|
-
id_personas << cuit
|
56
|
+
id_personas << cuit.tr('^0-9', '')
|
57
57
|
end
|
58
58
|
@body = body.merge({"idPersona" => id_personas})
|
59
59
|
end
|
@@ -64,24 +64,37 @@ module Padron
|
|
64
64
|
|
65
65
|
def set_data
|
66
66
|
personas = data.body[:get_persona_list_response][:persona_list_return][:persona]
|
67
|
-
personas.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
:city => Padron::PROVINCIAS[persona[:datos_generales].try(:[],:domicilio_fiscal).try(:[], :id_provincia)],
|
79
|
-
:locality => persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :localidad)}
|
80
|
-
end
|
81
|
-
end
|
67
|
+
if personas.is_a? Array
|
68
|
+
set_multiple(personas)
|
69
|
+
else
|
70
|
+
set_single(personas)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
def set_multiple(personas)
|
76
|
+
personas.map do |persona|
|
77
|
+
set_single(persona)
|
82
78
|
end
|
83
79
|
end
|
84
80
|
|
81
|
+
def set_single(persona)
|
82
|
+
unless persona[:error_constancia] && persona[:error_constancia].try(:[],:apellido).nil?
|
83
|
+
if !persona[:error_constancia].nil?
|
84
|
+
{:name => set_name(persona[:error_constancia]),
|
85
|
+
:cuit => persona[:error_constancia][:id_persona]}
|
86
|
+
else
|
87
|
+
{:name => set_name(persona[:datos_generales]),
|
88
|
+
:cuit => persona[:datos_generales][:id_persona],
|
89
|
+
:cp => persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :cod_postal),
|
90
|
+
:address => persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :direccion),
|
91
|
+
:city_id => persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :id_provincia),
|
92
|
+
:city => Padron::PROVINCIAS[persona[:datos_generales].try(:[],:domicilio_fiscal).try(:[], :id_provincia)],
|
93
|
+
:locality => persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :localidad)}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
85
98
|
def set_name(persona)
|
86
99
|
return "#{persona.try(:[], :nombre)} #{persona.try(:[], :apellido)}"
|
87
100
|
end
|
data/lib/padron/id_persona.rb
CHANGED
data/lib/padron/version.rb
CHANGED
data/padron.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_dependency "savon", "~> 2.
|
30
|
+
spec.add_dependency "savon", "~> 2.11.0"
|
31
31
|
spec.add_dependency "httpi", "~> 2.3"
|
32
32
|
spec.add_dependency "nokogiri", "~> 1.10.4"
|
33
33
|
spec.add_development_dependency "bundler", "~> 2.1"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facundo Diaz Martinez
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.11.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: httpi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|