Class: ViewModel::SapSchema110::CommonSchema
- Inherits:
-
DomesticEpcViewModel
- Object
- BaseViewModel
- DomesticEpcViewModel
- ViewModel::SapSchema110::CommonSchema
- Defined in:
- lib/view_model/sap_schema_110/common_schema.rb
Instance Method Summary collapse
- #address_id ⇒ Object
- #address_line1 ⇒ Object
- #address_line2 ⇒ Object
- #address_line3 ⇒ Object
- #address_line4 ⇒ Object
- #all_floor_descriptions ⇒ Object
- #all_floor_energy_efficiency_rating ⇒ Object
- #all_floor_env_energy_efficiency_rating ⇒ Object
- #all_main_heating_controls_descriptions ⇒ Object
- #all_main_heating_controls_energy_efficiency ⇒ Object
- #all_main_heating_controls_environmental_efficiency ⇒ Object
- #all_main_heating_descriptions ⇒ Object
- #all_main_heating_energy_efficiency ⇒ Object
- #all_main_heating_environmental_efficiency ⇒ Object
- #all_roof_descriptions ⇒ Object
- #all_roof_energy_efficiency_rating ⇒ Object
- #all_roof_env_energy_efficiency_rating ⇒ Object
- #all_wall_descriptions ⇒ Object
- #all_wall_energy_efficiency_rating ⇒ Object
- #all_wall_env_energy_efficiency_rating ⇒ Object
- #assessment_id ⇒ Object
- #assessor_email ⇒ Object
- #assessor_name ⇒ Object
- #assessor_telephone ⇒ Object
- #built_form ⇒ Object
- #co2_emissions_current_per_floor_area ⇒ Object
- #construction_age_band ⇒ Object
- #country_code ⇒ Object
- #current_carbon_emission ⇒ Object
- #current_energy_rating ⇒ Object
- #current_space_heating_demand ⇒ Object
- #current_water_heating_demand ⇒ Object
- #date_of_assessment ⇒ Object
- #date_of_expiry ⇒ Object
- #date_of_registration ⇒ Object
- #dwelling_type ⇒ Object
- #energy_consumption_potential ⇒ Object
- #energy_tariff ⇒ Object
- #environmental_impact_current ⇒ Object
- #environmental_impact_potential ⇒ Object
- #estimated_energy_cost ⇒ Object
- #extensions_count ⇒ Object
- #fixed_lighting_outlets_count ⇒ Object
- #floor_height ⇒ Object
- #floor_level ⇒ Object
- #glazed_area ⇒ Object
- #habitable_room_count ⇒ Object
- #heat_loss_corridor ⇒ Object
- #heated_room_count ⇒ Object
- #heating_cost_current ⇒ Object
- #heating_cost_potential ⇒ Object
- #hot_water_cost_current ⇒ Object
- #hot_water_cost_potential ⇒ Object
- #hot_water_description ⇒ Object
- #hot_water_energy_efficiency_rating ⇒ Object
- #hot_water_environmental_efficiency_rating ⇒ Object
- #impact_of_cavity_insulation ⇒ Object
- #impact_of_loft_insulation ⇒ Object
- #impact_of_solid_wall_insulation ⇒ Object
- #improvements ⇒ Object
- #level ⇒ Object
- #lighting_cost_current ⇒ Object
- #lighting_cost_potential ⇒ Object
- #lighting_description ⇒ Object
- #lighting_energy_efficiency_rating ⇒ Object
- #lighting_environmental_efficiency_rating ⇒ Object
- #low_energy_fixed_lighting_outlets_count ⇒ Object
- #low_energy_lighting ⇒ Object
- #main_fuel_type ⇒ Object
- #main_heating_controls ⇒ Object
- #mains_gas ⇒ Object
- #mechanical_ventilation ⇒ Object
- #multiple_glazed_proportion ⇒ Object
- #open_fireplaces_count ⇒ Object
- #photovoltaic_roof_area_percent ⇒ Object
- #postcode ⇒ Object
- #potential_carbon_emission ⇒ Object
- #potential_energy_rating ⇒ Object
- #potential_energy_saving ⇒ Object
- #primary_energy_use ⇒ Object
- #property_age_band ⇒ Object
- #property_summary ⇒ Object
- #recommendations_for_report ⇒ Object
- #related_party_disclosure_number ⇒ Object
- #related_party_disclosure_text ⇒ Object
- #report_type ⇒ Object
- #scheme_assessor_id ⇒ Object
- #secondary_fuel_type ⇒ Object
- #secondary_heating_description ⇒ Object
- #secondary_heating_energy_efficiency_rating ⇒ Object
- #secondary_heating_environmental_efficiency_rating ⇒ Object
- #solar_water_heating_flag ⇒ Object
- #storey_count ⇒ Object
- #tenure ⇒ Object
- #top_storey ⇒ Object
- #total_floor_area ⇒ Object
- #town ⇒ Object
- #transaction_type ⇒ Object
- #type_of_assessment ⇒ Object
- #unheated_corridor_length ⇒ Object
- #water_heating_fuel ⇒ Object
- #wind_turbine_count ⇒ Object
- #window_description ⇒ Object
- #window_energy_efficiency_rating ⇒ Object
- #window_environmental_efficiency_rating ⇒ Object
Methods inherited from DomesticEpcViewModel
#addendum, #improvement_title, #lzc_energy_sources, #multi_glazing_type, #property_type, #status
Methods inherited from BaseViewModel
Constructor Details
This class inherits a constructor from ViewModel::BaseViewModel
Instance Method Details
#address_id ⇒ Object
61 62 63 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 61 def address_id "LPRN-#{xpath(%w[UPRN])}" end |
#address_line1 ⇒ Object
8 9 10 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 8 def address_line1 xpath(%w[Property Address Address-Line-1]) end |
#address_line2 ⇒ Object
12 13 14 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 12 def address_line2 xpath(%w[Property Address Address-Line-2]).to_s end |
#address_line3 ⇒ Object
16 17 18 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 16 def address_line3 xpath(%w[Property Address Address-Line-3]).to_s end |
#address_line4 ⇒ Object
20 21 22 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 20 def address_line4 xpath(%w[Property Address Address-Line-4]).to_s end |
#all_floor_descriptions ⇒ Object
460 461 462 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 460 def all_floor_descriptions @xml_doc.search("Property-Summary/Floor/Description").map(&:content) end |
#all_floor_energy_efficiency_rating ⇒ Object
464 465 466 467 468 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 464 def @xml_doc .search("Property-Summary/Floor/Energy-Efficiency-Rating") .map(&:content) end |
#all_floor_env_energy_efficiency_rating ⇒ Object
470 471 472 473 474 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 470 def @xml_doc .search("Property-Summary/Floor/Environmental-Efficiency-Rating") .map(&:content) end |
#all_main_heating_controls_descriptions ⇒ Object
408 409 410 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 408 def all_main_heating_controls_descriptions @xml_doc.search("Main-Heating-Controls/Description").map(&:content) end |
#all_main_heating_controls_energy_efficiency ⇒ Object
480 481 482 483 484 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 480 def all_main_heating_controls_energy_efficiency @xml_doc .search("Main-Heating-Controls/Energy-Efficiency-Rating") .map(&:content) end |
#all_main_heating_controls_environmental_efficiency ⇒ Object
486 487 488 489 490 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 486 def all_main_heating_controls_environmental_efficiency @xml_doc .search("Main-Heating-Controls/Environmental-Efficiency-Rating") .map(&:content) end |
#all_main_heating_descriptions ⇒ Object
400 401 402 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 400 def all_main_heating_descriptions @xml_doc.search("Main-Heating/Description").map(&:content) end |
#all_main_heating_energy_efficiency ⇒ Object
476 477 478 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 476 def all_main_heating_energy_efficiency @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content) end |
#all_main_heating_environmental_efficiency ⇒ Object
492 493 494 495 496 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 492 def all_main_heating_environmental_efficiency @xml_doc .search("Main-Heating/Environmental-Efficiency-Rating") .map(&:content) end |
#all_roof_descriptions ⇒ Object
416 417 418 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 416 def all_roof_descriptions @xml_doc.search("Roof/Description").map(&:content) end |
#all_roof_energy_efficiency_rating ⇒ Object
420 421 422 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 420 def @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content) end |
#all_roof_env_energy_efficiency_rating ⇒ Object
424 425 426 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 424 def @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content) end |
#all_wall_descriptions ⇒ Object
428 429 430 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 428 def all_wall_descriptions @xml_doc.search("Walls/Description").map(&:content) end |
#all_wall_energy_efficiency_rating ⇒ Object
432 433 434 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 432 def @xml_doc.search("Walls/Energy-Efficiency-Rating").map(&:content) end |
#all_wall_env_energy_efficiency_rating ⇒ Object
436 437 438 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 436 def @xml_doc.search("Walls/Environmental-Efficiency-Rating").map(&:content) end |
#assessment_id ⇒ Object
4 5 6 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 4 def assessment_id xpath(%w[RRN]) end |
#assessor_email ⇒ Object
45 46 47 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 45 def assessor_email xpath(%w[Home-Inspector E-Mail]) end |
#assessor_name ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 36 def assessor_name [ xpath(%w[Home-Inspector Name Prefix]), xpath(%w[Home-Inspector Name First-Name]), xpath(%w[Home-Inspector Name Surname]), xpath(%w[Home-Inspector Name Suffix]), ].reject { |e| e.to_s.empty? }.join(" ") end |
#assessor_telephone ⇒ Object
49 50 51 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 49 def assessor_telephone xpath(%w[Home-Inspector Telephone]) end |
#built_form ⇒ Object
383 384 385 386 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 383 def built_form built_form_value = xpath(%w[Built-Form]) Helper::XmlEnumsToOutput.xml_value_to_string(built_form_value) end |
#co2_emissions_current_per_floor_area ⇒ Object
274 275 276 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 274 def co2_emissions_current_per_floor_area xpath(%w[CO2-Emissions-Current-Per-Floor-Area]) end |
#construction_age_band ⇒ Object
201 202 203 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 201 def construction_age_band xpath(%w[Construction-Age-Band]) end |
#country_code ⇒ Object
239 240 241 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 239 def country_code xpath(%w[Country-Code]) end |
#current_carbon_emission ⇒ Object
162 163 164 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 162 def current_carbon_emission xpath(%w[CO2-Emissions-Current]) end |
#current_energy_rating ⇒ Object
170 171 172 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 170 def xpath(%w[Energy-Rating-Current]).to_i end |
#current_space_heating_demand ⇒ Object
213 214 215 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 213 def current_space_heating_demand xpath(%w[Space-Heating-Existing-Dwelling]) end |
#current_water_heating_demand ⇒ Object
217 218 219 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 217 def current_water_heating_demand xpath(%w[Water-Heating]) end |
#date_of_assessment ⇒ Object
53 54 55 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 53 def date_of_assessment xpath(%w[Inspection-Date]) end |
#date_of_expiry ⇒ Object
65 66 67 68 69 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 65 def date_of_expiry expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10 expires_at.to_s end |
#date_of_registration ⇒ Object
57 58 59 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 57 def date_of_registration xpath(%w[Registration-Date]) end |
#dwelling_type ⇒ Object
193 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 193 def dwelling_type; end |
#energy_consumption_potential ⇒ Object
178 179 180 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 178 def energy_consumption_potential xpath(%w[Energy-Consumption-Potential]) end |
#energy_tariff ⇒ Object
440 441 442 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 440 def energy_tariff xpath(%w[Electricity-Tariff]) end |
#environmental_impact_current ⇒ Object
266 267 268 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 266 def environmental_impact_current xpath(%w[Environmental-Impact-Current]) end |
#environmental_impact_potential ⇒ Object
270 271 272 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 270 def environmental_impact_potential xpath(%w[Environmental-Impact-Potential]) end |
#estimated_energy_cost ⇒ Object
182 183 184 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 182 def estimated_energy_cost xpath(%w[Estimated-Energy-Cost]) end |
#extensions_count ⇒ Object
404 405 406 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 404 def extensions_count xpath(%w[Extensions-Count]) end |
#fixed_lighting_outlets_count ⇒ Object
319 320 321 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 319 def fixed_lighting_outlets_count xpath(%w[Fixed-Lighting-Outlets-Count]) end |
#floor_height ⇒ Object
456 457 458 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 456 def floor_height @xml_doc.search("Storey-Height").map(&:content) end |
#floor_level ⇒ Object
452 453 454 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 452 def floor_level xpath(%w[SAP-Flat-Details Level]) end |
#glazed_area ⇒ Object
303 304 305 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 303 def glazed_area nil end |
#habitable_room_count ⇒ Object
307 308 309 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 307 def habitable_room_count nil end |
#heat_loss_corridor ⇒ Object
392 393 394 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 392 def heat_loss_corridor xpath(%w[Heat-Loss-Corridor]) end |
#heated_room_count ⇒ Object
311 312 313 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 311 def heated_room_count nil end |
#heating_cost_current ⇒ Object
150 151 152 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 150 def heating_cost_current xpath(%w[Heating-Cost-Current]) end |
#heating_cost_potential ⇒ Object
138 139 140 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 138 def heating_cost_potential xpath(%w[Heating-Cost-Potential]) end |
#hot_water_cost_current ⇒ Object
146 147 148 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 146 def hot_water_cost_current xpath(%w[Hot-Water-Cost-Current]) end |
#hot_water_cost_potential ⇒ Object
134 135 136 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 134 def hot_water_cost_potential xpath(%w[Hot-Water-Cost-Potential]) end |
#hot_water_description ⇒ Object
331 332 333 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 331 def hot_water_description xpath(%w[Hot-Water Description]) end |
#hot_water_energy_efficiency_rating ⇒ Object
335 336 337 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 335 def xpath(%w[Hot-Water Energy-Efficiency-Rating]) end |
#hot_water_environmental_efficiency_rating ⇒ Object
339 340 341 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 339 def xpath(%w[Hot-Water Environmental-Efficiency-Rating]) end |
#impact_of_cavity_insulation ⇒ Object
221 222 223 224 225 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 221 def impact_of_cavity_insulation if xpath(%w[Impact-Of-Cavity-Insulation]) xpath(%w[Impact-Of-Cavity-Insulation]).to_i end end |
#impact_of_loft_insulation ⇒ Object
227 228 229 230 231 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 227 def impact_of_loft_insulation if xpath(%w[Impact-Of-Loft-Insulation]) xpath(%w[Impact-Of-Loft-Insulation]).to_i end end |
#impact_of_solid_wall_insulation ⇒ Object
233 234 235 236 237 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 233 def impact_of_solid_wall_insulation if xpath(%w[Impact-Of-Solid-Wall-Insulation]) xpath(%w[Impact-Of-Solid-Wall-Insulation]).to_i end end |
#improvements ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 96 def improvements @xml_doc .search("Suggested-Improvements/Improvement") .map do |node| { energy_performance_rating_improvement: xpath(%w[Energy-Performance-Rating], node).to_i, environmental_impact_rating_improvement: xpath(%w[Environmental-Impact-Rating], node).to_i, green_deal_category_code: xpath(%w[Green-Deal-Category], node), improvement_category: xpath(%w[Improvement-Category], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_title: improvement_title(node), improvement_type: xpath(%w[Improvement-Type], node), indicative_cost: xpath(%w[Indicative-Cost], node), sequence: xpath(%w[Sequence], node).to_i, typical_saving: xpath(%w[Typical-Saving], node), } end end |
#level ⇒ Object
282 283 284 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 282 def level xpath(%w[Level]) end |
#lighting_cost_current ⇒ Object
154 155 156 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 154 def lighting_cost_current xpath(%w[Lighting-Cost-Current]) end |
#lighting_cost_potential ⇒ Object
142 143 144 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 142 def lighting_cost_potential xpath(%w[Lighting-Cost-Potential]) end |
#lighting_description ⇒ Object
367 368 369 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 367 def lighting_description xpath(%w[Lighting Description]) end |
#lighting_energy_efficiency_rating ⇒ Object
371 372 373 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 371 def xpath(%w[Lighting Energy-Efficiency-Rating]) end |
#lighting_environmental_efficiency_rating ⇒ Object
375 376 377 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 375 def xpath(%w[Lighting Environmental-Efficiency-Rating]) end |
#low_energy_fixed_lighting_outlets_count ⇒ Object
323 324 325 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 323 def low_energy_fixed_lighting_outlets_count xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count]) end |
#low_energy_lighting ⇒ Object
315 316 317 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 315 def low_energy_lighting xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Percentage]) end |
#main_fuel_type ⇒ Object
243 244 245 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 243 def main_fuel_type xpath(%w[Main-Fuel-Type]) end |
#main_heating_controls ⇒ Object
295 296 297 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 295 def main_heating_controls xpath(%w[Main-Heating-Controls Description]) end |
#mains_gas ⇒ Object
278 279 280 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 278 def mains_gas nil end |
#mechanical_ventilation ⇒ Object
448 449 450 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 448 def mechanical_ventilation nil end |
#multiple_glazed_proportion ⇒ Object
299 300 301 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 299 def multiple_glazed_proportion xpath(%w[Multiple-Glazed-Proportion]) end |
#open_fireplaces_count ⇒ Object
327 328 329 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 327 def open_fireplaces_count xpath(%w[Open-Fireplaces-Count]) end |
#photovoltaic_roof_area_percent ⇒ Object
379 380 381 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 379 def photovoltaic_roof_area_percent nil end |
#postcode ⇒ Object
28 29 30 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 28 def postcode xpath(%w[Property Address Postcode]) end |
#potential_carbon_emission ⇒ Object
158 159 160 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 158 def potential_carbon_emission xpath(%w[CO2-Emissions-Potential]) end |
#potential_energy_rating ⇒ Object
166 167 168 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 166 def xpath(%w[Energy-Rating-Potential]).to_i end |
#potential_energy_saving ⇒ Object
195 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 195 def potential_energy_saving; end |
#primary_energy_use ⇒ Object
174 175 176 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 174 def primary_energy_use xpath(%w[Energy-Consumption-Current]) end |
#property_age_band ⇒ Object
197 198 199 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 197 def property_age_band xpath(%w[Construction-Year]) end |
#property_summary ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 71 def property_summary @xml_doc.search("Energy-Assessment Property-Summary").children.select( &:element? ).map { |node| next if xpath(%w[Energy-Efficiency-Rating], node).nil? { energy_efficiency_rating: xpath(%w[Energy-Efficiency-Rating], node).to_i, environmental_efficiency_rating: xpath(%w[Environmental-Efficiency-Rating], node).to_i, name: node.name.underscore, description: xpath(%w[Description], node), } }.compact end |
#recommendations_for_report ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 119 def recommendations_for_report @xml_doc .search("Suggested-Improvements Improvement") .map do |node| { sequence: xpath(%w[Sequence], node).to_i, improvement_summary: xpath(%w[Improvement-Summary], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), indicative_cost: xpath(%w[Indicative-Cost], node), } end end |
#related_party_disclosure_number ⇒ Object
92 93 94 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 92 def nil end |
#related_party_disclosure_text ⇒ Object
88 89 90 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 88 def xpath(%w[Related-Party-Disclosure]) end |
#report_type ⇒ Object
412 413 414 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 412 def report_type xpath(%w[Report-Type]) end |
#scheme_assessor_id ⇒ Object
32 33 34 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 32 def scheme_assessor_id xpath(%w[Certificate-Number]) end |
#secondary_fuel_type ⇒ Object
247 248 249 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 247 def secondary_fuel_type xpath(%w[Secondary-Fuel-Type]) end |
#secondary_heating_description ⇒ Object
355 356 357 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 355 def secondary_heating_description xpath(%w[Secondary-Heating Description]) end |
#secondary_heating_energy_efficiency_rating ⇒ Object
359 360 361 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 359 def xpath(%w[Secondary-Heating Energy-Efficiency-Rating]) end |
#secondary_heating_environmental_efficiency_rating ⇒ Object
363 364 365 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 363 def xpath(%w[Secondary-Heating Environmental-Efficiency-Rating]) end |
#solar_water_heating_flag ⇒ Object
444 445 446 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 444 def solar_water_heating_flag nil end |
#storey_count ⇒ Object
291 292 293 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 291 def storey_count nil end |
#tenure ⇒ Object
205 206 207 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 205 def tenure nil end |
#top_storey ⇒ Object
286 287 288 289 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 286 def top_storey flat_level_code = xpath(%w[Level]) flat_level_code == "3" ? "Y" : "N" end |
#total_floor_area ⇒ Object
186 187 188 189 190 191 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 186 def total_floor_area building_part_areas = @xml_doc.search("//SAP-Building-Part/SAP-Floor-Dimensions/SAP-Floor-Dimension/Total-Floor-Area").map(&:content) room_in_roof_areas = @xml_doc.search("//SAP-Building-Part/SAP-Room-In-Roof/Floor-Area").map(&:content) all_areas = (building_part_areas + room_in_roof_areas).map(&:to_f) all_areas.sum.round.to_i.to_s end |
#town ⇒ Object
24 25 26 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 24 def town xpath(%w[Property Address Post-Town]) end |
#transaction_type ⇒ Object
209 210 211 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 209 def transaction_type nil end |
#type_of_assessment ⇒ Object
255 256 257 258 259 260 261 262 263 264 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 255 def type_of_assessment case xpath(%w[Report-Type]).to_i when 1 "HCR" when 2 "RdSAP" when 3 "SAP" end end |
#unheated_corridor_length ⇒ Object
388 389 390 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 388 def unheated_corridor_length xpath(%w[Unheated-Corridor-Length]) end |
#water_heating_fuel ⇒ Object
251 252 253 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 251 def water_heating_fuel xpath(%w[Water-Fuel-Type]) end |
#wind_turbine_count ⇒ Object
396 397 398 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 396 def wind_turbine_count xpath(%w[Wind-Turbines-Count]) end |
#window_description ⇒ Object
343 344 345 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 343 def window_description xpath(%w[Windows Description]) end |
#window_energy_efficiency_rating ⇒ Object
347 348 349 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 347 def xpath(%w[Windows Energy-Efficiency-Rating]) end |
#window_environmental_efficiency_rating ⇒ Object
351 352 353 |
# File 'lib/view_model/sap_schema_110/common_schema.rb', line 351 def xpath(%w[Windows Environmental-Efficiency-Rating]) end |