Class: ViewModel::SapSchema110::Rdsap

Inherits:
CommonSchema show all
Defined in:
lib/view_model/sap_schema_110/rdsap.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, #assessment_id, #assessor_email, #assessor_name, #assessor_telephone, #built_form, #co2_emissions_current_per_floor_area, #construction_age_band, #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, #environmental_impact_current, #environmental_impact_potential, #estimated_energy_cost, #extensions_count, #fixed_lighting_outlets_count, #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_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_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, #type_of_assessment, #unheated_corridor_length, #wind_turbine_count

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

#all_wall_descriptionsObject



45
46
47
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 45

def all_wall_descriptions
  @xml_doc.search("Wall/Description").map(&:content)
end

#all_wall_energy_efficiency_ratingObject



49
50
51
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 49

def all_wall_energy_efficiency_rating
  @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
end

#all_wall_env_energy_efficiency_ratingObject



53
54
55
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 53

def all_wall_env_energy_efficiency_rating
  @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
end

#cylinder_insul_thicknessObject



85
86
87
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 85

def cylinder_insul_thickness
  xpath(%w[Cylinder-Insulation-Thickness])
end

#cylinder_insulation_typeObject



89
90
91
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 89

def cylinder_insulation_type
  xpath(%w[Cylinder-Insulation-Type])
end

#cylinder_sizeObject



93
94
95
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 93

def cylinder_size
  xpath(%w[Cylinder-Size])
end

#energy_tariffObject



81
82
83
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 81

def energy_tariff
  xpath(%w[Meter-Type])
end

#floor_heightObject



73
74
75
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 73

def floor_height
  @xml_doc.search("Room-Height").map(&:content)
end

#glazed_areaObject



29
30
31
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 29

def glazed_area
  xpath(%w[Glazed-Area])
end

#habitable_room_countObject



57
58
59
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 57

def habitable_room_count
  xpath(%w[Habitable-Room-Count])&.to_i
end

#has_cylinder_thermostatObject



97
98
99
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 97

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

#heated_room_countObject



61
62
63
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 61

def heated_room_count
  xpath(%w[Heated-Room-Count])&.to_i
end

#main_dwelling_construction_age_band_or_yearObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 13

def main_dwelling_construction_age_band_or_year
  sap_building_parts =
    @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
  sap_building_parts.each do |sap_building_part|
    identifier = sap_building_part.at("Identifier")
    if identifier&.content == "Main Dwelling"
      return(
        sap_building_part.at_xpath(
          "Construction-Age-Band | Construction-Year",
        )&.content
      )
    end
  end
  nil
end

#mechanical_ventilationObject

DO NOT CORRECT - this typo is present in the schema XML pre 12.0



9
10
11
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 9

def mechanical_ventilation
  xpath(%w[Mechanical-Ventliation])
end

#photovoltaic_roof_area_percentObject



65
66
67
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 65

def photovoltaic_roof_area_percent
  xpath(%w[Photovoltaic-Supply])
end

#property_age_bandObject



4
5
6
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 4

def property_age_band
  nil
end

#solar_water_heating_flagObject



69
70
71
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 69

def solar_water_heating_flag
  xpath(%w[Solar-Water-Heating])
end

#storey_countObject



77
78
79
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 77

def storey_count
  xpath(%w[Storey-Count])&.to_i
end

#water_heating_fuelObject



101
102
103
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 101

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

#window_descriptionObject



33
34
35
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 33

def window_description
  xpath(%w[Window Description])
end

#window_energy_efficiency_ratingObject



37
38
39
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 37

def window_energy_efficiency_rating
  xpath(%w[Window Energy-Efficiency-Rating])
end

#window_environmental_efficiency_ratingObject



41
42
43
# File 'lib/view_model/sap_schema_110/rdsap.rb', line 41

def window_environmental_efficiency_rating
  xpath(%w[Window Environmental-Efficiency-Rating])
end