Sha256: 93e6be4b29084b97e71067cc634ebe36c83a055ae06efac481a72f26233814dd

Contents?: true

Size: 1.58 KB

Versions: 30

Compression:

Stored size: 1.58 KB

Contents

module ViewModel
  module SapSchema112
    class Sap < ViewModel::SapSchema112::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|
          building_part_number = sap_building_part.at("Building-Part-Number")

          # Identifies the Main Dwelling
          if building_part_number&.content == "1"
            return(
              sap_building_part.at_xpath(
                "Construction-Age-Band | 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

      def ventilation_type
        xpath(%w[Ventilation-Type])
      end

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
epb_view_models-1.1.3 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.1.2 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.1.1 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.1.0 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.29 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.28 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.27 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.26 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.25 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.24 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.23 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.22 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.21 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.20 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.19 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.18 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.17 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.16 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.15 lib/view_model/sap_schema_112/sap.rb
epb_view_models-1.0.14 lib/view_model/sap_schema_112/sap.rb