Class: ViewModel::Cepc800::DecRr
Instance Method Summary
collapse
#address_id, #address_line1, #address_line2, #address_line3, #address_line4, #all_energy_types, #all_reason_types, #all_start_dates, #assessment_id, #assessor_email, #assessor_name, #assessor_telephone, #building_level, #calculation_tool, #company_address, #company_name, #date_of_assessment, #date_of_issue, #date_of_registration, #inspection_type, #or_assessment_end_date, #postcode, #report_type, #scheme_assessor_id, #town
#initialize, #xpath
Instance Method Details
#building_environment ⇒ Object
73
74
75
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 73
def building_environment
xpath(%w[Advisory-Report Technical-Information Building-Environment])
end
|
#date_of_expiry ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 6
def date_of_expiry
floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
expiry_date = Date.parse(date_of_issue)
expiry_date =
if floor_area.to_f <= 1000 && !postcode.start_with?("BT")
(expiry_date - 1).next_year 10
else
(expiry_date - 1).next_year 7
end
expiry_date.strftime("%F")
end
|
#discounted_energy ⇒ Object
93
94
95
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 93
def discounted_energy
xpath(%w[Special-Energy-Uses])
end
|
#floor_area ⇒ Object
69
70
71
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 69
def floor_area
xpath(%w[Advisory-Report Technical-Information Floor-Area])
end
|
#long_payback_recommendations ⇒ Object
61
62
63
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 61
def long_payback_recommendations
recommendations("Long-Payback")
end
|
#medium_payback_recommendations ⇒ Object
57
58
59
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 57
def medium_payback_recommendations
recommendations("Medium-Payback")
end
|
#occupier ⇒ Object
81
82
83
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 81
def occupier
xpath(%w[Occupier])
end
|
#other_recommendations ⇒ Object
65
66
67
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 65
def other_recommendations
recommendations("Other-Payback")
end
|
#property_type ⇒ Object
85
86
87
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 85
def property_type
xpath(%w[Property-Type])
end
|
#recommendations(payback) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 21
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
|
77
78
79
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 77
def related_rrn
xpath(%w[Related-RRN])
end
|
#renewable_sources ⇒ Object
89
90
91
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 89
def renewable_sources
xpath(%w[Renewable-Sources])
end
|
#short_payback_recommendations ⇒ Object
53
54
55
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 53
def short_payback_recommendations
recommendations("Short-Payback")
end
|
#site_service_one ⇒ Object
41
42
43
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 41
def site_service_one
site_services("Service-1")
end
|
#site_service_three ⇒ Object
49
50
51
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 49
def site_service_three
site_services("Service-3")
end
|
#site_service_two ⇒ Object
45
46
47
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 45
def site_service_two
site_services("Service-2")
end
|
#site_services(service) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/view_model/cepc800/dec_rr.rb', line 33
def site_services(service)
{
description:
@xml_doc.at("Site-Services/#{service}/Description").content,
quantity: @xml_doc.at("Site-Services/#{service}/Quantity").content,
}
end
|