Class: ViewModel::DomesticEpcViewModel
Direct Known Subclasses
RdSapSchema170::CommonSchema, RdSapSchema171::CommonSchema, RdSapSchema180::CommonSchema, RdSapSchema190::CommonSchema, RdSapSchema200::CommonSchema, RdSapSchema210::CommonSchema, RdSapSchemaNi173::CommonSchema, RdSapSchemaNi174::CommonSchema, RdSapSchemaNi180::CommonSchema, RdSapSchemaNi190::CommonSchema, RdSapSchemaNi200::CommonSchema, SapSchema102::CommonSchema, SapSchema110::CommonSchema, SapSchema112::CommonSchema, SapSchema120::CommonSchema, SapSchema130::CommonSchema, SapSchema140::CommonSchema, SapSchema141::CommonSchema, SapSchema142::CommonSchema, SapSchema150::CommonSchema, SapSchema160::CommonSchema, SapSchema161::CommonSchema, SapSchema162::CommonSchema, SapSchema163::CommonSchema, SapSchema170::CommonSchema, SapSchema171::CommonSchema, SapSchema1800::CommonSchema, SapSchema1900::CommonSchema, SapSchema1910::CommonSchema, SapSchemaNi112::CommonSchema, SapSchemaNi120::CommonSchema, SapSchemaNi130::CommonSchema, SapSchemaNi140::CommonSchema, SapSchemaNi141::CommonSchema, SapSchemaNi142::CommonSchema, SapSchemaNi150::CommonSchema, SapSchemaNi160::CommonSchema, SapSchemaNi161::CommonSchema, SapSchemaNi170::CommonSchema, SapSchemaNi171::CommonSchema, SapSchemaNi172::CommonSchema, SapSchemaNi173::CommonSchema, SapSchemaNi174::CommonSchema, SapSchemaNi1800::CommonSchema
Instance Method Summary
collapse
#initialize, #xpath
Instance Method Details
#addendum ⇒ Object
34
35
36
37
38
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 34
def addendum
return nil if xpath(%w[Addendum]).nil?
fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
end
|
#has_hot_water_cylinder ⇒ Object
57
58
59
60
61
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 57
def has_hot_water_cylinder
return "false" if xpath(%w[Has-Hot-Water-Cylinder]).nil?
xpath(%w[Has-Hot-Water-Cylinder])
end
|
#improvement_title(node) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 7
def improvement_title(node)
return "" unless node
title =
[
xpath(%w[Improvement-Heading], node),
xpath(%w[Improvement-Summary], node),
xpath(%w[Improvement], node),
].compact.delete_if(&:empty?).first || ""
title = "" if title.to_i.to_s == title
title
end
|
#lzc_energy_sources ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 40
def lzc_energy_sources
return nil if xpath(%w[LZC-Energy-Sources]).nil?
@xml_doc
.search("LZC-Energy-Sources/LZC-Energy-Source")
.select(&:element?)
.map { |n| n.text.to_i }
end
|
#main_heating_category ⇒ Object
63
64
65
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 63
def main_heating_category
xpath(%w[Main-Heating-Category])
end
|
#multi_glazing_type ⇒ Object
30
31
32
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 30
def multi_glazing_type
xpath(%w[Multiple-Glazing-Type])
end
|
#property_type ⇒ Object
26
27
28
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 26
def property_type
xpath(%w[Property-Type])
end
|
#status ⇒ Object
49
50
51
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 49
def status
Time.parse(date_of_expiry) < Time.now ? "EXPIRED" : "ENTERED"
end
|
#water_heating_code ⇒ Object
53
54
55
|
# File 'lib/view_model/domestic_epc_view_model.rb', line 53
def water_heating_code
xpath(%w[Water-Heating-Code])
end
|