Class: Experian::CreditReport
- Inherits:
-
Report
- Object
- Report
- Experian::CreditReport
show all
- Defined in:
- lib/experian/credit_report.rb
Instance Attribute Summary
Attributes inherited from Report
#raw_xml, #response, #url, #xml
Instance Method Summary
collapse
Methods inherited from Report
#initialize
Instance Method Details
#address ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/experian/credit_report.rb', line 18
def address
if (address_xml = data["DomicilioComercial"])
OpenStruct.new(
line: address_xml["Domicilio"],
city: address_xml["Poblacion"],
province: address_xml["Provincia"],
postal_code: address_xml["CodigoPostal"],
municipality: address_xml["Municipio"],
)
end
end
|
#cnae ⇒ Object
48
49
50
|
# File 'lib/experian/credit_report.rb', line 48
def cnae
data.dig("ActividadComercial", "Cnae")&.first&.dig("Codigo")&.to_i
end
|
#constitution_date ⇒ Object
52
53
54
55
|
# File 'lib/experian/credit_report.rb', line 52
def constitution_date
date = data.dig("DatosConstitutivos", "FechaConstitucion")
date && Date.parse(date)
end
|
#id ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/experian/credit_report.rb', line 6
def id
if (id_xml = data["DatosIdentificativos"])
OpenStruct.new(
cif: id_xml["Cif"],
name: id_xml["Nombre"],
infotel_code: id_xml["CodigoInfotel"],
incorporation_date: Date.parse(id_xml["FechaFundacion"]),
social_form: id_xml["FormaSocial"]["__content__"],
)
end
end
|
#number_of_employees ⇒ Object
Number of employees in the last recorded excercise
31
32
33
|
# File 'lib/experian/credit_report.rb', line 31
def number_of_employees
data.dig("ListaAnualEmpleados", "Empleado")&.first&.dig("EmpleadoFijo")&.to_i
end
|
#rating ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/experian/credit_report.rb', line 35
def rating
if (rating_xml = data["Rating"])
return unless rating_xml["RatingAxesorDef"]
OpenStruct.new(
score: rating_xml["RatingAxesorDef"]&.strip&.to_i,
default_probability: rating_xml["ProbImpago"]&.to_f,
risk: rating_xml["GrupoRiesgo"],
size: rating_xml["Tamaño"],
)
end
end
|