Class: Experian::TradeReport
- Defined in:
- lib/experian/trade_report.rb
Instance Attribute Summary
Attributes inherited from Report
#raw_xml, #response, #url, #xml
Instance Method Summary collapse
- #address ⇒ Object
- #cnae ⇒ Object
- #constitution_date ⇒ Object
- #model_200(period: last_submitted_year) ⇒ Object
- #most_recent_number_of_employees ⇒ Object
- #rating ⇒ Object
Methods inherited from Report
Constructor Details
This class inherits a constructor from Experian::Report
Instance Method Details
#address ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/experian/trade_report.rb', line 46 def address if (address_xml = data.dig("SeccionDatosRegistrales", "DomicilioSocial")) OpenStruct.new( line: address_xml["Domicilio"], city: address_xml["Poblacion"] || address_xml["Provincia"], province: address_xml["Provincia"], postal_code: address_xml["CodigoPostal"], municipality: address_xml["Municipio"], ) end end |
#cnae ⇒ Object
62 63 64 |
# File 'lib/experian/trade_report.rb', line 62 def cnae data.dig("ActividadComercial", "Cnae")&.first&.dig("Codigo")&.to_i end |
#constitution_date ⇒ Object
41 42 43 44 |
# File 'lib/experian/trade_report.rb', line 41 def constitution_date date = data.dig("SeccionDatosRegistrales", "FechaConstitucion") date && Date.parse(date) end |
#model_200(period: last_submitted_year) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/experian/trade_report.rb', line 3 def model_200(period: last_submitted_year) { "00041" => number_of_employees(period:, type: "EmpleadoFijo"), "00042" => number_of_employees(period:, type: "EmpleadoEventual"), # Balance Sheet - Assets "00101" => financial_data("Activo", "11000", period:), # ACTIVO NO CORRIENTE "00102" => financial_data("Activo", "11100", period:), # Inmovilizado intangible "00136" => financial_data("Activo", "12000", period:), # ACTIVO CORRIENTE "00138" => financial_data("Activo", "12200", period:), # Existencias "00149" => financial_data("Activo", "12300", period:), # Deudores comerciales y otras cuentas a cobrar "00177" => financial_data("Activo", "12700", period:), # Efectivo y otros activos líquidos equivalentes "00180" => financial_data("Activo", "10000", period:), # TOTAL ACTIVO # Balance Sheet - Liabilities "00185" => financial_data("Pasivo", "20000", period:), # PATRIMONIO NETO "00210" => financial_data("Pasivo", "31000", period:), # PASIVO NO CORRIENTE "00216" => financial_data("Pasivo", "31200", period:), # Deudas a largo plazo "00228" => financial_data("Pasivo", "32000", period:), # PASIVO CORRIENTE "00231" => financial_data("Pasivo", "32300", period:), # Deudas a corto plazo "00239" => financial_data("Pasivo", "32500", period:), # Acreedores comerciales y otras cuentas a pagar # P&L "00255" => financial_data("PerdidasGanancias", "40100", period:), # Importe neto de la cifra de negocios "00260" => financial_data("PerdidasGanancias", "40400", period:), # Aprovisionamientos "00265" => financial_data("PerdidasGanancias", "40500", period:), # Otros ingresos de explotación "00284" => financial_data("PerdidasGanancias", "40800", period:), # Amortización del inmovilizado "00285" => financial_data("PerdidasGanancias", "40900", period:), # Imputación de subvenciones de inmovilizado no financiero y otras "00286" => financial_data("PerdidasGanancias", "41000", period:), # Excesos de provisiones "00287" => financial_data("PerdidasGanancias", "41100", period:), # Deterioro y resultado por enajenaciones del inmovilizad "00295" => financial_data("PerdidasGanancias", "41300", period:), # Otros resultados "00296" => financial_data("PerdidasGanancias", "49100", period:), # Resultado de explotacion "00305" => financial_data("PerdidasGanancias", "41500", period:), # Gastos Financieros "00326" => financial_data("PerdidasGanancias", "41900", period:), # Impuestos Sobre Beneficios "00327" => financial_data("PerdidasGanancias", "49500", period:), # RESULTADO DEL EJERCICIO PROCEDENTE DE OPERACIONES CONTINUADAS } end |
#most_recent_number_of_employees ⇒ Object
58 59 60 |
# File 'lib/experian/trade_report.rb', line 58 def most_recent_number_of_employees data.dig("ListaAnualEmpleados", "Empleado")&.first&.dig("EmpleadoFijo")&.to_i end |
#rating ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/experian/trade_report.rb', line 66 def if ( = data["Rating"]) return unless ["RatingAxesorDef"] OpenStruct.new( score: ["RatingAxesorDef"]&.strip&.to_i, default_probability: ["ProbImpago"]&.to_f, risk: ["GrupoRiesgo"], size: ["Tamaño"], ) end end |