Class: ViewModel::SapSchema142::Sap

Inherits:
CommonSchema show all
Defined in:
lib/view_model/sap_schema_142/sap.rb

Instance Method Summary collapse

Methods inherited from CommonSchema

#address_id, #address_line1, #address_line2, #address_line3, #address_line4, #all_floor_descriptions, #all_floor_energy_efficiency_rating, #all_floor_env_energy_efficiency_rating, #all_main_heating_controls_descriptions, #all_main_heating_controls_energy_efficiency, #all_main_heating_controls_environmental_efficiency, #all_main_heating_descriptions, #all_main_heating_energy_efficiency, #all_main_heating_environmental_efficiency, #all_roof_descriptions, #all_roof_energy_efficiency_rating, #all_roof_env_energy_efficiency_rating, #all_wall_descriptions, #all_wall_energy_efficiency_rating, #all_wall_env_energy_efficiency_rating, #assessment_id, #assessor_email, #assessor_name, #assessor_telephone, #built_form, #co2_emissions_current_per_floor_area, #country_code, #current_carbon_emission, #current_energy_rating, #current_space_heating_demand, #current_water_heating_demand, #date_of_assessment, #date_of_expiry, #date_of_registration, #dwelling_type, #energy_consumption_potential, #energy_tariff, #environmental_impact_current, #environmental_impact_potential, #estimated_energy_cost, #extensions_count, #fixed_lighting_outlets_count, #floor_height, #floor_level, #heat_loss_corridor, #heating_cost_current, #heating_cost_potential, #hot_water_cost_current, #hot_water_cost_potential, #hot_water_description, #hot_water_energy_efficiency_rating, #hot_water_environmental_efficiency_rating, #impact_of_cavity_insulation, #impact_of_loft_insulation, #impact_of_solid_wall_insulation, #improvements, #level, #lighting_cost_current, #lighting_cost_potential, #lighting_description, #lighting_energy_efficiency_rating, #lighting_environmental_efficiency_rating, #low_energy_fixed_lighting_outlets_count, #low_energy_lighting, #main_dwelling_construction_age_band_or_year, #main_fuel_type, #main_heating_controls, #multiple_glazed_proportion, #open_fireplaces_count, #postcode, #potential_carbon_emission, #potential_energy_rating, #potential_energy_saving, #primary_energy_use, #property_summary, #recommendations_for_report, #related_party_disclosure_number, #related_party_disclosure_text, #report_type, #scheme_assessor_id, #secondary_fuel_type, #secondary_heating_description, #secondary_heating_energy_efficiency_rating, #secondary_heating_environmental_efficiency_rating, #top_storey, #total_floor_area, #town, #transaction_type, #type_of_assessment, #unheated_corridor_length, #wind_turbine_count, #window_description, #window_energy_efficiency_rating, #window_environmental_efficiency_rating

Methods inherited from DomesticEpcViewModel

#addendum, #has_hot_water_cylinder, #improvement_title, #lzc_energy_sources, #main_heating_category, #multi_glazing_type, #property_type, #status, #water_heating_code

Methods inherited from BaseViewModel

#initialize, #xpath

Constructor Details

This class inherits a constructor from ViewModel::BaseViewModel

Instance Method Details

#construction_yearObject



8
9
10
# File 'lib/view_model/sap_schema_142/sap.rb', line 8

def construction_year
  xpath(%w[Construction-Year])
end

#cylinder_insul_thicknessObject



12
13
14
# File 'lib/view_model/sap_schema_142/sap.rb', line 12

def cylinder_insul_thickness
  xpath(%w[Hot-Water-Store-Insulation-Thickness])
end

#cylinder_insulation_typeObject



16
17
18
# File 'lib/view_model/sap_schema_142/sap.rb', line 16

def cylinder_insulation_type
  xpath(%w[Hot-Water-Store-Insulation-Type])
end

#cylinder_sizeObject



20
21
22
# File 'lib/view_model/sap_schema_142/sap.rb', line 20

def cylinder_size
  xpath(%w[Hot-Water-Store-Size])
end

#has_cylinder_thermostatObject



24
25
26
# File 'lib/view_model/sap_schema_142/sap.rb', line 24

def has_cylinder_thermostat
  xpath(%w[Has-Cylinder-Thermostat])
end

#mech_vent_sys_index_numberObject



28
29
30
# File 'lib/view_model/sap_schema_142/sap.rb', line 28

def mech_vent_sys_index_number
  xpath(%w[Mechanical-Vent-System-Index-Number])&.to_i
end

#mechanical_vent_data_sourceObject



32
33
34
# File 'lib/view_model/sap_schema_142/sap.rb', line 32

def mechanical_vent_data_source
  xpath(%w[Mechanical-Ventilation-Data-Source])
end

#property_age_bandObject



4
5
6
# File 'lib/view_model/sap_schema_142/sap.rb', line 4

def property_age_band
  construction_year
end

#thermal_storeObject



36
37
38
# File 'lib/view_model/sap_schema_142/sap.rb', line 36

def thermal_store
  xpath(%w[Thermal-Store])
end

#total_roof_areaObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/view_model/sap_schema_142/sap.rb', line 48

def total_roof_area
  roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
  return nil if roofs.count.zero?

  total_roof_area = 0
  roofs.each do |roof|
    roof_area = roof.at("Total-Roof-Area")&.content.to_i
    total_roof_area += roof_area
  end
  total_roof_area
end

#ventilation_typeObject



40
41
42
# File 'lib/view_model/sap_schema_142/sap.rb', line 40

def ventilation_type
  xpath(%w[Ventilation-Type])
end

#water_heating_fuelObject



44
45
46
# File 'lib/view_model/sap_schema_142/sap.rb', line 44

def water_heating_fuel
  xpath(%w[Water-Fuel-Type])
end