Sha256: fdc6fdf0a9b36ff3a3be57ee3724e270688d35727d57d736e88bda380ab41e21

Contents?: true

Size: 1.67 KB

Versions: 37

Compression:

Stored size: 1.67 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])
      end

      def heated_room_count
        xpath(%w[Heated-Room-Count])
      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])
      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

37 entries across 37 versions & 1 rubygems

Version Path
epb_view_models-1.0.20 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.19 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.18 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.17 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.16 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.15 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.14 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.13 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.12 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.11 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.10 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.9 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.8 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.7 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.6 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.5 lib/view_model/sap_schema_102/rdsap.rb
epb_view_models-1.0.4 lib/view_model/sap_schema_102/rdsap.rb