class ViewModel::Cepc50::Dec

Public Instance Methods

ac_inspection_commissioned() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 196
def ac_inspection_commissioned
  xpath(%w[AC-Inspection-Commissioned])
end
ac_kw_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 204
def ac_kw_rating
  xpath(%w[AC-kW-Rating])
end
ac_present() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 200
def ac_present
  xpath(%w[AC-Present])
end
annual_energy_summary() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 176
def annual_energy_summary
  summary = @xml_doc.search("DEC-Annual-Energy-Summary")
  {
    electrical: xpath(%w[Annual-Energy-Use-Electrical], summary),
    fuel_thermal: xpath(%w[Annual-Energy-Use-Fuel-Thermal], summary),
    renewables_fuel_thermal: xpath(%w[Renewables-Fuel-Thermal], summary),
    renewables_electrical: xpath(%w[Renewables-Electrical], summary),
    typical_thermal_use: xpath(%w[Typical-Thermal-Use], summary),
    typical_electrical_use: xpath(%w[Typical-Electrical-Use], summary),
  }
end
annual_energy_use_electrical() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 108
def annual_energy_use_electrical
  xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Electrical])
end
annual_energy_use_fuel_thermal() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 104
def annual_energy_use_fuel_thermal
  xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Fuel-Thermal])
end
asset_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 100
def asset_rating
  xpath(%w[OR-Previous-Data Asset-Rating])
end
benchmarks() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 156
def benchmarks
  []
end
building_category() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 212
def building_category
  xpath(%w[Building-Category])
end
building_environment() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 92
def building_environment
  xpath(%w[Technical-Information Building-Environment])
end
calculation_tool() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 136
def calculation_tool
  xpath(%w[Calculation-Details Calculation-Tool])
end
current_assessment_date() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 24
def current_assessment_date
  xpath(%w[This-Assessment Nominated-Date])
end
current_electricity_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 32
def current_electricity_co2
  xpath(%w[This-Assessment Electricity-CO2])
end
current_heating_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 28
def current_heating_co2
  xpath(%w[This-Assessment Heating-CO2])
end
current_renewables_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 36
def current_renewables_co2
  xpath(%w[This-Assessment Renewables-CO2])
end
date_of_expiry() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 4
def date_of_expiry
  floor_area =
    xpath(%w[Display-Certificate Technical-Information Floor-Area])

  expiry_date = Date.parse(current_assessment_date)

  expiry_date =
    if floor_area.to_i <= 1000 && !postcode.start_with?("BT")
      (expiry_date - 1).next_year 10
    else
      (expiry_date - 1).next_year 1
    end

  expiry_date.strftime("%F")
end
dec_status() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 128
def dec_status
  xpath(%w[DEC-Status])
end
energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 20
def energy_efficiency_rating
  xpath(%w[This-Assessment Energy-Rating])
end
estimated_ac_kw_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 208
def estimated_ac_kw_rating
  xpath(%w[AC-Estimated-Output])
end
floor_area() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 96
def floor_area
  xpath(%w[Technical-Information Floor-Area])
end
main_benchmark() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 192
def main_benchmark
  xpath(%w[OR-Benchmark-Data Main-Benchmark])
end
main_heating_fuel() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 88
def main_heating_fuel
  xpath(%w[Technical-Information Main-Heating-Fuel])
end
occupancy_level() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 84
def occupancy_level
  xpath(%w[Occupancy-Level])
end
occupier() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 152
def occupier
  xpath(%w[Occupier])
end
or_assessment_start_date() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 148
def or_assessment_start_date
  xpath(%w[OR-Operational-Rating OR-Assessment-Start-Date])
end
or_energy_consumption() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 160
def or_energy_consumption
  @xml_doc
    .search("OR-Energy-Consumption")
    .children
    .select(&:element?)
    .map do |node|
      {
        consumption: xpath(%w[Consumption], node),
        start_date: xpath(%w[Start-Date], node),
        end_date: xpath(%w[End-Date], node),
        estimate: xpath(%w[Estimate], node),
        name: node.name,
      }
    end
end
other_fuel() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 216
def other_fuel
  xpath(%w[Technical-Information Other-Fuel-Description])
end
output_engine() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 144
def output_engine
  xpath(%w[Output-Engine])
end
property_type() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 188
def property_type
  xpath(%w[Property-Type])
end
renewables_electrical() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 124
def renewables_electrical
  xpath(%w[DEC-Annual-Energy-Summary Renewables-Electrical])
end
renewables_fuel_thermal() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 120
def renewables_fuel_thermal
  xpath(%w[DEC-Annual-Energy-Summary Renewables-Fuel-Thermal])
end
special_energy_uses() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 76
def special_energy_uses
  xpath(%w[Technical-Information Special-Energy-Uses])
end
typical_electrical_use() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 116
def typical_electrical_use
  xpath(%w[DEC-Annual-Energy-Summary Typical-Electrical-Use])
end
typical_thermal_use() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 112
def typical_thermal_use
  xpath(%w[DEC-Annual-Energy-Summary Typical-Thermal-Use])
end
year1_assessment_date() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 40
def year1_assessment_date
  xpath(%w[Year1-Assessment Nominated-Date])
end
year1_electricity_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 48
def year1_electricity_co2
  xpath(%w[Year1-Assessment Electricity-CO2])
end
year1_energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 56
def year1_energy_efficiency_rating
  xpath(%w[Year1-Assessment Energy-Rating])
end
year1_heating_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 44
def year1_heating_co2
  xpath(%w[Year1-Assessment Heating-CO2])
end
year1_renewables_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 52
def year1_renewables_co2
  xpath(%w[Year1-Assessment Renewables-CO2])
end
year2_assessment_date() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 60
def year2_assessment_date
  xpath(%w[Year2-Assessment Nominated-Date])
end
year2_electricity_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 68
def year2_electricity_co2
  xpath(%w[Year2-Assessment Electricity-CO2])
end
year2_energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 80
def year2_energy_efficiency_rating
  xpath(%w[Year2-Assessment Energy-Rating])
end
year2_heating_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 64
def year2_heating_co2
  xpath(%w[Year2-Assessment Heating-CO2])
end
year2_renewables_co2() click to toggle source
# File lib/view_model/cepc50/dec.rb, line 72
def year2_renewables_co2
  xpath(%w[Year2-Assessment Renewables-CO2])
end