class ViewModel::CepcNi800::DecRr

Public Instance Methods

building_environment() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 62
def building_environment
  xpath(%w[Advisory-Report Technical-Information Building-Environment])
end
date_of_expiry() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 4
def date_of_expiry
  expiry_date = (Date.parse(date_of_issue) - 1).next_year 7

  expiry_date.strftime("%F")
end
discounted_energy() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 82
def discounted_energy
  xpath(%w[Special-Energy-Uses])
end
floor_area() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 58
def floor_area
  xpath(%w[Advisory-Report Technical-Information Floor-Area])
end
long_payback_recommendations() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 50
def long_payback_recommendations
  recommendations("Long-Payback")
end
medium_payback_recommendations() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 46
def medium_payback_recommendations
  recommendations("Medium-Payback")
end
occupier() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 70
def occupier
  xpath(%w[Occupier])
end
other_recommendations() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 54
def other_recommendations
  recommendations("Other-Payback")
end
property_type() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 74
def property_type
  xpath(%w[Property-Type])
end
recommendations(payback) click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 10
def recommendations(payback)
  @xml_doc
    .search("AR-Recommendations/#{payback}")
    .map do |node|
      {
        code: node.at("Recommendation-Code").content,
        text: node.at("Recommendation").content,
        cO2Impact: node.at("CO2-Impact").content,
      }
    end
end
renewable_sources() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 78
def renewable_sources
  xpath(%w[Renewable-Sources])
end
short_payback_recommendations() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 42
def short_payback_recommendations
  recommendations("Short-Payback")
end
site_service_one() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 30
def site_service_one
  site_services("Service-1")
end
site_service_three() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 38
def site_service_three
  site_services("Service-3")
end
site_service_two() click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 34
def site_service_two
  site_services("Service-2")
end
site_services(service) click to toggle source
# File lib/view_model/cepc_ni800/dec_rr.rb, line 22
def site_services(service)
  {
    description:
      @xml_doc.at("Site-Services/#{service}/Description").content,
    quantity: @xml_doc.at("Site-Services/#{service}/Quantity").content,
  }
end