Class: ViewModel::Cs63::CommonSchema
Constant Summary
collapse
- THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY =
65
Instance Method Summary
collapse
#addendum, #has_hot_water_cylinder, #improvement_title, #lzc_energy_sources, #main_heating_category, #multi_glazing_type, #property_type, #water_heating_code
#initialize, #xpath
Instance Method Details
#accept_prescriptive_improvements ⇒ Object
144
145
146
|
# File 'lib/view_model/cs63/common_schema.rb', line 144
def accept_prescriptive_improvements
xpath(%w[Prescriptive-Improvements Accept-Prescriptive-Improvements])
end
|
#actual_completion_date ⇒ Object
132
133
134
|
# File 'lib/view_model/cs63/common_schema.rb', line 132
def actual_completion_date
xpath(%w[Improvements-Completion Actual-Completion-Date])
end
|
#address_id ⇒ Object
92
93
94
|
# File 'lib/view_model/cs63/common_schema.rb', line 92
def address_id
xpath(%w[UPRN])
end
|
#address_line1 ⇒ Object
32
33
34
|
# File 'lib/view_model/cs63/common_schema.rb', line 32
def address_line1
xpath(%w[Report-Header Property Address Address-Line-1])
end
|
#address_line2 ⇒ Object
36
37
38
|
# File 'lib/view_model/cs63/common_schema.rb', line 36
def address_line2
xpath(%w[Report-Header Property Address Address-Line-2])
end
|
#address_line3 ⇒ Object
40
41
42
|
# File 'lib/view_model/cs63/common_schema.rb', line 40
def address_line3
xpath(%w[Report-Header Property Address Address-Line-3])
end
|
#address_line4 ⇒ Object
44
45
46
|
# File 'lib/view_model/cs63/common_schema.rb', line 44
def address_line4
xpath(%w[Report-Header Property Address Address-Line-4])
end
|
#alternative_improvements ⇒ Object
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/view_model/cs63/common_schema.rb', line 163
def alternative_improvements
@xml_doc
.search("Alternative-Improvements Alternative-Scenario")
.map do |node|
{
measure_description_short:
xpath(%w[Measure-Description-Short], node),
measure_description_long:
xpath(%w[Measure-Description-Long], node),
measure_valid: xpath(%w[Measure-Valid], node),
measure_type: xpath(%w[Measure-Type], node),
}
end
end
|
#assessment_date ⇒ Object
20
21
22
|
# File 'lib/view_model/cs63/common_schema.rb', line 20
def assessment_date
xpath(%w[Report-Header Assessment-Date])
end
|
#assessment_id ⇒ Object
8
9
10
|
# File 'lib/view_model/cs63/common_schema.rb', line 8
def assessment_id
xpath(%w[Report-Header RRN])
end
|
#assessor_email ⇒ Object
84
85
86
|
# File 'lib/view_model/cs63/common_schema.rb', line 84
def assessor_email
xpath(%w[Energy-Assessor/E-Mail])
end
|
#assessor_name ⇒ Object
60
61
62
|
# File 'lib/view_model/cs63/common_schema.rb', line 60
def assessor_name
xpath(%w[Energy-Assessor Name])
end
|
#assessor_telephone ⇒ Object
88
89
90
|
# File 'lib/view_model/cs63/common_schema.rb', line 88
def assessor_telephone
xpath(%w[Energy-Assessor/Telephone-Number])
end
|
#building_improvements ⇒ Object
116
117
118
|
# File 'lib/view_model/cs63/common_schema.rb', line 116
def building_improvements
xpath(%w[Improvement-Type Building-Improvements])
end
|
#company_name ⇒ Object
76
77
78
|
# File 'lib/view_model/cs63/common_schema.rb', line 76
def company_name
xpath(%w[Energy-Assessor Company-Name])
end
|
#date_of_assessment ⇒ Object
186
187
188
|
# File 'lib/view_model/cs63/common_schema.rb', line 186
def date_of_assessment
xpath(%w[Report-Header Assessment-Date])
end
|
#date_of_expiry ⇒ Object
182
183
184
|
# File 'lib/view_model/cs63/common_schema.rb', line 182
def date_of_expiry
Date.parse(date_of_registration).next_month(42).to_s
end
|
#date_of_registration ⇒ Object
178
179
180
|
# File 'lib/view_model/cs63/common_schema.rb', line 178
def date_of_registration
xpath(%w[Report-Header Plan-Report-Date])
end
|
#dec ⇒ Object
124
125
126
|
# File 'lib/view_model/cs63/common_schema.rb', line 124
def dec
xpath(%w[Operational-Rating-System Display-Energy-Certificate])
end
|
#delegated_person_commission_report ⇒ Object
104
105
106
|
# File 'lib/view_model/cs63/common_schema.rb', line 104
def delegated_person_commission_report
xpath(%w[Delegated-Person-Commission-Report])
end
|
#epc_assessment_id ⇒ Object
12
13
14
|
# File 'lib/view_model/cs63/common_schema.rb', line 12
def epc_assessment_id
xpath(%w[Report-Header EPC-RRN])
end
|
#operational_ratings ⇒ Object
120
121
122
|
# File 'lib/view_model/cs63/common_schema.rb', line 120
def operational_ratings
xpath(%w[Improvement-Type Operational-Rating])
end
|
#owner_commission_report ⇒ Object
def type_of_assessment
"CS63"
end
100
101
102
|
# File 'lib/view_model/cs63/common_schema.rb', line 100
def owner_commission_report
xpath(%w[Owner-Commission-Report])
end
|
#plan_report_date ⇒ Object
24
25
26
|
# File 'lib/view_model/cs63/common_schema.rb', line 24
def plan_report_date
xpath(%w[Report-Header Plan-Report-Date])
end
|
#planned_completion_date ⇒ Object
128
129
130
|
# File 'lib/view_model/cs63/common_schema.rb', line 128
def planned_completion_date
xpath(%w[Improvements-Completion Planned-Completion-Date])
end
|
#postcode ⇒ Object
52
53
54
|
# File 'lib/view_model/cs63/common_schema.rb', line 52
def postcode
xpath(%w[Report-Header Property Address Postcode])
end
|
#prescriptive_improvements ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/view_model/cs63/common_schema.rb', line 148
def prescriptive_improvements
@xml_doc
.search("Prescriptive-Improvements Prescriptive-Scenario")
.map do |node|
{
measure_description_short:
xpath(%w[Measure-Description-Short], node),
measure_description_long:
xpath(%w[Measure-Description-Long], node),
measure_valid: xpath(%w[Measure-Valid], node),
measure_type: xpath(%w[Measure-Type], node),
}
end
end
|
#property_type_long_description ⇒ Object
112
113
114
|
# File 'lib/view_model/cs63/common_schema.rb', line 112
def property_type_long_description
xpath(%w[Property-Type Long-Description])
end
|
#property_type_short_description ⇒ Object
108
109
110
|
# File 'lib/view_model/cs63/common_schema.rb', line 108
def property_type_short_description
xpath(%w[Property-Type Short-Description])
end
|
190
191
192
|
# File 'lib/view_model/cs63/common_schema.rb', line 190
def related_rrn
nil
end
|
#report_type ⇒ Object
28
29
30
|
# File 'lib/view_model/cs63/common_schema.rb', line 28
def report_type
xpath(%w[Report-Header Report-Type])
end
|
#sale_lease_date ⇒ Object
16
17
18
|
# File 'lib/view_model/cs63/common_schema.rb', line 16
def sale_lease_date
xpath(%w[Report-Header Sale-Lease-Date])
end
|
#scheme_assessor_id ⇒ Object
56
57
58
|
# File 'lib/view_model/cs63/common_schema.rb', line 56
def scheme_assessor_id
xpath(%w[Energy-Assessor Membership-Number]) or xpath(%w[Energy-Assessor Certificate-Number])
end
|
#status ⇒ Object
80
81
82
|
# File 'lib/view_model/cs63/common_schema.rb', line 80
def status
xpath(%w[Energy-Assessor Status])
end
|
#target_emission_savings ⇒ Object
136
137
138
|
# File 'lib/view_model/cs63/common_schema.rb', line 136
def target_emission_savings
xpath(%w[Target-Savings Target-Emission-Savings])
end
|
#target_energy_savings ⇒ Object
140
141
142
|
# File 'lib/view_model/cs63/common_schema.rb', line 140
def target_energy_savings
xpath(%w[Target-Savings Target-Energy-Savings])
end
|
#town ⇒ Object
48
49
50
|
# File 'lib/view_model/cs63/common_schema.rb', line 48
def town
xpath(%w[Report-Header Property Address Post-Town])
end
|
#trading_address ⇒ Object
def approved_organisation_name
xpath(%w[Energy-Assessor Approved-Organisation-Name])
end
def approved_organisation_web_address
xpath(%w[Energy-Assessor Approved-Organisation-Name])
end
72
73
74
|
# File 'lib/view_model/cs63/common_schema.rb', line 72
def trading_address
xpath(%w[Energy-Assessor Trading-Address])
end
|