Class: ViewModel::Cepc800::Dec
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, #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
#ac_inspection_commissioned ⇒ Object
210
211
212
|
# File 'lib/view_model/cepc800/dec.rb', line 210
def ac_inspection_commissioned
xpath(%w[AC-Inspection-Commissioned])
end
|
#ac_kw_rating ⇒ Object
218
219
220
|
# File 'lib/view_model/cepc800/dec.rb', line 218
def ac_kw_rating
xpath(%w[AC-kW-Rating])&.to_i
end
|
#ac_present ⇒ Object
214
215
216
|
# File 'lib/view_model/cepc800/dec.rb', line 214
def ac_present
xpath(%w[AC-Present])
end
|
#annual_energy_summary ⇒ Object
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/view_model/cepc800/dec.rb', line 178
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 ⇒ Object
102
103
104
|
# File 'lib/view_model/cepc800/dec.rb', line 102
def annual_energy_use_electrical
xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Electrical])
end
|
#annual_energy_use_fuel_thermal ⇒ Object
98
99
100
|
# File 'lib/view_model/cepc800/dec.rb', line 98
def annual_energy_use_fuel_thermal
xpath(%w[Annual-Energy-Use-Fuel-Thermal])
end
|
#asset_rating ⇒ Object
94
95
96
|
# File 'lib/view_model/cepc800/dec.rb', line 94
def asset_rating
xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
end
|
#benchmarks ⇒ Object
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/view_model/cepc800/dec.rb', line 150
def benchmarks
@xml_doc
.search("Benchmarks/Benchmark")
.map do |node|
{
name: xpath(%w[Name], node),
id: xpath(%w[Benchmark-ID], node)&.to_i,
tufa: xpath(%w[TUFA], node),
}
end
end
|
#building_category ⇒ Object
226
227
228
|
# File 'lib/view_model/cepc800/dec.rb', line 226
def building_category
xpath(%w[Building-Category])
end
|
#building_environment ⇒ Object
86
87
88
|
# File 'lib/view_model/cepc800/dec.rb', line 86
def building_environment
xpath(%w[Technical-Information Building-Environment])
end
|
130
131
132
|
# File 'lib/view_model/cepc800/dec.rb', line 130
def calculation_tool
xpath(%w[Calculation-Details Calculation-Tool])
end
|
#current_assessment_date ⇒ Object
26
27
28
|
# File 'lib/view_model/cepc800/dec.rb', line 26
def current_assessment_date
xpath(%w[This-Assessment Nominated-Date])
end
|
#current_electricity_co2 ⇒ Object
34
35
36
|
# File 'lib/view_model/cepc800/dec.rb', line 34
def current_electricity_co2
xpath(%w[This-Assessment Electricity-CO2])&.to_i
end
|
#current_heating_co2 ⇒ Object
30
31
32
|
# File 'lib/view_model/cepc800/dec.rb', line 30
def current_heating_co2
xpath(%w[This-Assessment Heating-CO2])&.to_i
end
|
#current_renewables_co2 ⇒ Object
38
39
40
|
# File 'lib/view_model/cepc800/dec.rb', line 38
def current_renewables_co2
xpath(%w[This-Assessment Renewables-CO2])&.to_i
end
|
#date_of_expiry ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/view_model/cepc800/dec.rb', line 6
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
|
126
127
128
|
# File 'lib/view_model/cepc800/dec.rb', line 126
def dec_related_party_disclosure
xpath(%w[DEC-Related-Party-Disclosure])
end
|
#dec_status ⇒ Object
122
123
124
|
# File 'lib/view_model/cepc800/dec.rb', line 122
def dec_status
xpath(%w[DEC-Status])
end
|
#energy_efficiency_rating ⇒ Object
22
23
24
|
# File 'lib/view_model/cepc800/dec.rb', line 22
def energy_efficiency_rating
xpath(%w[This-Assessment Energy-Rating])&.to_i
end
|
#estimated_ac_kw_rating ⇒ Object
222
223
224
|
# File 'lib/view_model/cepc800/dec.rb', line 222
def estimated_ac_kw_rating
xpath(%w[AC-Estimated-Output])&.to_i
end
|
#floor_area ⇒ Object
90
91
92
|
# File 'lib/view_model/cepc800/dec.rb', line 90
def floor_area
xpath(%w[Technical-Information Floor-Area])
end
|
#main_benchmark ⇒ Object
194
195
196
|
# File 'lib/view_model/cepc800/dec.rb', line 194
def main_benchmark
xpath(%w[OR-Benchmark-Data Main-Benchmark])
end
|
#main_heating_fuel ⇒ Object
82
83
84
|
# File 'lib/view_model/cepc800/dec.rb', line 82
def main_heating_fuel
xpath(%w[Technical-Information Main-Heating-Fuel])
end
|
#occupancy_level ⇒ Object
206
207
208
|
# File 'lib/view_model/cepc800/dec.rb', line 206
def occupancy_level
xpath(%w[Benchmarks Benchmark Occupancy-Level])
end
|
#occupier ⇒ Object
146
147
148
|
# File 'lib/view_model/cepc800/dec.rb', line 146
def occupier
xpath(%w[Occupier])
end
|
#or_assessment_start_date ⇒ Object
142
143
144
|
# File 'lib/view_model/cepc800/dec.rb', line 142
def or_assessment_start_date
xpath(%w[OR-Operational-Rating OR-Assessment-Start-Date])
end
|
#or_energy_consumption ⇒ Object
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/view_model/cepc800/dec.rb', line 162
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)&.to_i,
name: node.name,
}
end
end
|
#other_fuel ⇒ Object
198
199
200
|
# File 'lib/view_model/cepc800/dec.rb', line 198
def other_fuel
xpath(%w[Technical-Information Other-Fuel-Description])
end
|
#output_engine ⇒ Object
138
139
140
|
# File 'lib/view_model/cepc800/dec.rb', line 138
def output_engine
xpath(%w[Output-Engine])
end
|
#property_type ⇒ Object
190
191
192
|
# File 'lib/view_model/cepc800/dec.rb', line 190
def property_type
xpath(%w[Property-Type])
end
|
134
135
136
|
# File 'lib/view_model/cepc800/dec.rb', line 134
def related_rrn
xpath(%w[Related-RRN])
end
|
#renewables_electrical ⇒ Object
118
119
120
|
# File 'lib/view_model/cepc800/dec.rb', line 118
def renewables_electrical
xpath(%w[DEC-Annual-Energy-Summary Renewables-Electrical])
end
|
#renewables_fuel_thermal ⇒ Object
114
115
116
|
# File 'lib/view_model/cepc800/dec.rb', line 114
def renewables_fuel_thermal
xpath(%w[DEC-Annual-Energy-Summary Renewables-Fuel-Thermal])
end
|
#special_energy_uses ⇒ Object
202
203
204
|
# File 'lib/view_model/cepc800/dec.rb', line 202
def special_energy_uses
xpath(%w[Technical-Information Special-Energy-Uses])
end
|
#typical_electrical_use ⇒ Object
110
111
112
|
# File 'lib/view_model/cepc800/dec.rb', line 110
def typical_electrical_use
xpath(%w[DEC-Annual-Energy-Summary Typical-Electrical-Use])
end
|
#typical_thermal_use ⇒ Object
106
107
108
|
# File 'lib/view_model/cepc800/dec.rb', line 106
def typical_thermal_use
xpath(%w[DEC-Annual-Energy-Summary Typical-Thermal-Use])
end
|
#year1_assessment_date ⇒ Object
42
43
44
|
# File 'lib/view_model/cepc800/dec.rb', line 42
def year1_assessment_date
xpath(%w[Year1-Assessment Nominated-Date])
end
|
#year1_electricity_co2 ⇒ Object
50
51
52
|
# File 'lib/view_model/cepc800/dec.rb', line 50
def year1_electricity_co2
xpath(%w[Year1-Assessment Electricity-CO2])&.to_i
end
|
#year1_energy_efficiency_rating ⇒ Object
58
59
60
|
# File 'lib/view_model/cepc800/dec.rb', line 58
def year1_energy_efficiency_rating
xpath(%w[Year1-Assessment Energy-Rating])&.to_i
end
|
#year1_heating_co2 ⇒ Object
46
47
48
|
# File 'lib/view_model/cepc800/dec.rb', line 46
def year1_heating_co2
xpath(%w[Year1-Assessment Heating-CO2])&.to_i
end
|
#year1_renewables_co2 ⇒ Object
54
55
56
|
# File 'lib/view_model/cepc800/dec.rb', line 54
def year1_renewables_co2
xpath(%w[Year1-Assessment Renewables-CO2])&.to_i
end
|
#year2_assessment_date ⇒ Object
62
63
64
|
# File 'lib/view_model/cepc800/dec.rb', line 62
def year2_assessment_date
xpath(%w[Year2-Assessment Nominated-Date])
end
|
#year2_electricity_co2 ⇒ Object
70
71
72
|
# File 'lib/view_model/cepc800/dec.rb', line 70
def year2_electricity_co2
xpath(%w[Year2-Assessment Electricity-CO2])&.to_i
end
|
#year2_energy_efficiency_rating ⇒ Object
78
79
80
|
# File 'lib/view_model/cepc800/dec.rb', line 78
def year2_energy_efficiency_rating
xpath(%w[Year2-Assessment Energy-Rating])&.to_i
end
|
#year2_heating_co2 ⇒ Object
66
67
68
|
# File 'lib/view_model/cepc800/dec.rb', line 66
def year2_heating_co2
xpath(%w[Year2-Assessment Heating-CO2])&.to_i
end
|
#year2_renewables_co2 ⇒ Object
74
75
76
|
# File 'lib/view_model/cepc800/dec.rb', line 74
def year2_renewables_co2
xpath(%w[Year2-Assessment Renewables-CO2])&.to_i
end
|