Sha256: 2d519a1a3c18a4fccb8eedf6ba995c3e80f9f280f25af23f7a23eaef4f337664

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

module ViewModel
  module SapSchema110
    class Sap < ViewModel::SapSchema110::CommonSchema
      def property_age_band
        construction_year
      end

      def construction_year
        xpath(%w[Construction-Year])
      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|
          construction_year = sap_building_part.at("Construction-Year")
          if construction_year&.content
            return sap_building_part.at_xpath("Construction-Year")&.content
          end
        end
        nil
      end

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

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

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epb_view_models-1.0.3 lib/view_model/sap_schema_110/sap.rb