Sha256: ff9e5fd6108c03a08b72276b9a8ad80fa6f8eaf87f89938691845c16c0a9d7d9

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

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

      def construction_year
        xpath(%w[Construction-Year])
      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

      def total_roof_area
        roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
        return nil if roofs.count.zero?

        total_roof_area = 0
        roofs.each do |roof|
          roof_area = roof.at("Total-Roof-Area")&.content.to_i
          total_roof_area += roof_area
        end
        total_roof_area
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
epb_view_models-1.2.3 lib/view_model/sap_schema_120/sap.rb
epb_view_models-1.2.2 lib/view_model/sap_schema_120/sap.rb
epb_view_models-1.2.1 lib/view_model/sap_schema_120/sap.rb
epb_view_models-1.2.0 lib/view_model/sap_schema_120/sap.rb
epb_view_models-1.1.6 lib/view_model/sap_schema_120/sap.rb