Class: Presenter::Cepc::CertificateSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/presenter/cepc/certificate_summary.rb

Constant Summary collapse

TYPE_OF_ASSESSMENT =
"CEPC".freeze

Instance Method Summary collapse

Constructor Details

#initialize(view_model) ⇒ CertificateSummary

Returns a new instance of CertificateSummary.



6
7
8
# File 'lib/presenter/cepc/certificate_summary.rb', line 6

def initialize(view_model)
  @view_model = view_model
end

Instance Method Details

#to_certificate_summaryObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/presenter/cepc/certificate_summary.rb', line 10

def to_certificate_summary
  {
    type_of_assessment: TYPE_OF_ASSESSMENT,
    assessment_id: @view_model.assessment_id,
    date_of_expiry: @view_model.date_of_expiry,
    report_type: @view_model.report_type,
    date_of_assessment: @view_model.date_of_assessment,
    date_of_registration: @view_model.date_of_registration,
    address: {
      address_line1: @view_model.address_line1,
      address_line2: @view_model.address_line2,
      address_line3: @view_model.address_line3,
      address_line4: @view_model.address_line4,
      town: @view_model.town,
      postcode: @view_model.postcode,
    },
    assessor: {
      scheme_assessor_id: @view_model.scheme_assessor_id,
      name: @view_model.assessor_name,
      contact_details: {
        email: @view_model.assessor_email,
        telephone: @view_model.assessor_telephone,
      },
    },
    technical_information: {
      main_heating_fuel: @view_model.main_heating_fuel,
      building_environment: @view_model.building_environment,
      floor_area: @view_model.floor_area,
      building_level: @view_model.building_level,
    },
    building_emission_rate: @view_model.respond_to?(:building_emission_rate) ? @view_model.building_emission_rate : nil,
    primary_energy_use: @view_model.respond_to?(:primary_energy_use) ? @view_model.primary_energy_use : nil,
    related_rrn: @view_model.related_rrn,
    new_build_rating: @view_model.new_build_rating,
    new_build_band: Helper::EnergyBandCalculator.commercial(@view_model.new_build_rating),
    existing_build_rating: @view_model.existing_build_rating,
    existing_build_band: Helper::EnergyBandCalculator.commercial(@view_model.existing_build_rating),
    current_energy_efficiency_rating: @view_model.energy_efficiency_rating,
    energy_efficiency_rating: @view_model.energy_efficiency_rating,
    related_party_disclosure: @view_model.epc_related_party_disclosure,
    current_energy_efficiency_band: Helper::EnergyBandCalculator.commercial(@view_model.energy_efficiency_rating),
    property_type: @view_model.property_type,
    building_complexity: @view_model.building_level,
  }
end

#to_certificate_summary_scotlandObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/presenter/cepc/certificate_summary.rb', line 56

def to_certificate_summary_scotland
  {
    type_of_assessment: TYPE_OF_ASSESSMENT,
    assessment_id: @view_model.assessment_id,
    report_type: @view_model.report_type,
    date_of_assessment: @view_model.date_of_assessment,
    date_of_expiry: @view_model.date_of_expiry,
    date_of_registration: @view_model.date_of_registration,
    address: {
      address_line1: @view_model.address_line1,
      address_line2: @view_model.address_line2.to_s,
      address_line3: @view_model.address_line3.to_s,
      address_line4: @view_model.address_line4.to_s,
      town: @view_model.town,
      postcode: @view_model.postcode,
    },
    assessor: {
      scheme_assessor_id: @view_model.scheme_assessor_id,
      name: @view_model.assessor_name,
      contact_details: {
        email: @view_model.assessor_email,
        telephone: @view_model.assessor_telephone,
        trading_address: @view_model.trading_address,
      },
      company_name: @view_model.company_name,
      insurer: @view_model.insurer,
      policy_no: @view_model.policy_no,
      insurer_effective_date: @view_model.insurer_effective_date,
      insurer_expiry_date: @view_model.insurer_expiry_date,
      insurer_pi_limit: @view_model.insurer_pi_limit,
    },
    technical_information: {
      main_heating_fuel: @view_model.main_heating_fuel,
      building_environment: @view_model.building_environment,
      floor_area: @view_model.floor_area,
    },
    current_energy_efficiency_rating: @view_model.energy_efficiency_rating,
    current_energy_efficiency_band: @view_model.current_energy_efficiency_band,
    potential_energy_efficiency_rating: @view_model.potential_energy_rating,
    potential_energy_efficiency_band: @view_model.potential_energy_band,
    new_build_benchmark_rating: @view_model.new_build_rating,
    new_build_benchmark_band: @view_model.new_build_benchmark_band,
    comparative_asset_rating: @view_model.comparative_asset_rating,
    epc_rating_ber: @view_model.epc_rating_ber,
    approximate_energy_use: @view_model.approximate_energy_use,
    property_type: {
      property_type_long_description: @view_model.property_long_description,
      property_type_short_description: @view_model.property_short_description,
    },
    compliant_2002: @view_model.compliant_2002,
    renewable_energy_sources: @view_model.renewable_energy_sources,
    electricity_sources: @view_model.electricity_sources,
    primary_energy_indicator: @view_model.primary_energy_indicator,
    calculation_tool: @view_model.calculation_tool,
    ter_2002: @view_model.ter_2002,
    ter: @view_model.ter,
    short_payback_recommendations:
      @view_model.short_payback_recommendations,
    medium_payback_recommendations:
      @view_model.medium_payback_recommendations,
    long_payback_recommendations: @view_model.long_payback_recommendations,
    other_payback_recommendations: @view_model.other_payback_recommendations,
  }
end