Sha256: 5868b5ddcca10eaf78fde5622e81a81c4accc2732f70245b6aa230e2705f9fff

Contents?: true

Size: 1.68 KB

Versions: 6

Compression:

Stored size: 1.68 KB

Contents

module ViewModel
  module SapSchema102
    class Rdsap < ViewModel::SapSchema102::CommonSchema
      def property_age_band
        nil
      end

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

      # DO NOT CORRECT - this typo is present in the schema XML pre 12.0
      def mechanical_ventilation
        xpath(%w[Mechanical-Ventliation])
      end

      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

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

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

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

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

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

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

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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
epb_view_models-2.0.5 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-2.0.4 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-2.0.3 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-2.0.2 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-2.0.1 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-2.0.0 lib/view_model/sap_schema_102/rdsap.rb