class ViewModel::SapSchema102::Rdsap

Public Instance Methods

construction_age_band() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 8
def construction_age_band
  xpath(%w[Construction-Year])
end
energy_tariff() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 61
def energy_tariff
  xpath(%w[Meter-Type])
end
floor_height() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 53
def floor_height
  @xml_doc.search("Room-Height").map(&:content)
end
glazed_area() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 33
def glazed_area
  xpath(%w[Glazed-Area])
end
habitable_room_count() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 37
def habitable_room_count
  xpath(%w[Habitable-Room-Count])
end
has_cylinder_thermostat() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 65
def has_cylinder_thermostat
  xpath(%w[Cylinder-Thermostat])
end
heated_room_count() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 41
def heated_room_count
  xpath(%w[Heated-Room-Count])
end
main_dwelling_construction_age_band_or_year() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 17
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_ventilation() click to toggle source

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

# File lib/view_model/sap_schema_102/rdsap.rb, line 13
def mechanical_ventilation
  xpath(%w[Mechanical-Ventliation])
end
photovoltaic_roof_area_percent() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 45
def photovoltaic_roof_area_percent
  xpath(%w[Photovoltaic-Supply])
end
property_age_band() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 4
def property_age_band
  nil
end
solar_water_heating_flag() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 49
def solar_water_heating_flag
  xpath(%w[Solar-Water-Heating])
end
storey_count() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 57
def storey_count
  xpath(%w[Storey-Count])
end
water_heating_fuel() click to toggle source
# File lib/view_model/sap_schema_102/rdsap.rb, line 69
def water_heating_fuel
  xpath(%w[Water-Heating-Fuel])
end