Sha256: f2a6f2837b66af78fff0208fa106a5fc16f4a4b7c7c495f9694fa6642b349940
Contents?: true
Size: 1.57 KB
Versions: 8
Compression:
Stored size: 1.57 KB
Contents
module ViewModel module Cepc70 class AcCert < ViewModel::Cepc70::CommonSchema def xpath(queries, node = @xml_doc) queries.each do |query| if node node = node.at query else return nil end end node ? node.content : nil end def building_complexity xpath(%w[Building-Complexity]) end def f_gas_compliant_date xpath(%w[Air-Conditioning-Inspection-Certificate F-Gas-Compliant-Date]) end def ac_rated_output xpath(%w[AC-Rated-Output AC-kW-Rating])&.to_i end def random_sampling xpath(%w[Air-Conditioning-Inspection-Certificate Random-Sampling-Flag]) end def treated_floor_area xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])&.to_i end def ac_system_metered xpath( %w[Air-Conditioning-Inspection-Certificate AC-System-Metered-Flag], ) end def refrigerant_charge xpath( %w[Air-Conditioning-Inspection-Certificate Refrigerant-Charge-Total], )&.to_i end def related_rrn xpath(%w[Related-RRN]) end def subsystems @xml_doc.search("AC-Sub-System").select(&:element?).map { |node| { number: xpath(%w[Sub-System-Number], node), description: xpath(%w[Sub-System-Description], node), age: xpath(%w[Sub-System-Age], node), refrigerantType: xpath(%w[Refrigerant-Type], node), } }.compact end end end end
Version data entries
8 entries across 8 versions & 1 rubygems