Class: Presenter::RdSap::DomesticDigest
- Inherits:
-
Object
- Object
- Presenter::RdSap::DomesticDigest
- Defined in:
- lib/presenter/rd_sap/domestic_digest.rb
Instance Method Summary collapse
-
#initialize(view_model, schema_type) ⇒ DomesticDigest
constructor
A new instance of DomesticDigest.
- #to_domestic_digest ⇒ Object
Constructor Details
#initialize(view_model, schema_type) ⇒ DomesticDigest
Returns a new instance of DomesticDigest.
7 8 9 10 |
# File 'lib/presenter/rd_sap/domestic_digest.rb', line 7 def initialize(view_model, schema_type) @view_model = view_model @schema_type = schema_type end |
Instance Method Details
#to_domestic_digest ⇒ Object
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 |
# File 'lib/presenter/rd_sap/domestic_digest.rb', line 12 def to_domestic_digest { type_of_assessment: TYPE_OF_ASSESSMENT, assessment_id: @view_model.assessment_id, 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, }, dwelling_type: @view_model.dwelling_type, built_form: Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form), main_dwelling_construction_age_band_or_year: Helper::XmlEnumsToOutput.construction_age_band_lookup( @view_model.main_dwelling_construction_age_band_or_year, @schema_type, @view_model.report_type, ), property_summary: @view_model.property_summary, main_heating_category: Helper::XmlEnumsToOutput.main_heating_category(value: @view_model.main_heating_category), main_fuel_type: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type, @schema_type, @view_model.report_type), has_hot_water_cylinder: @view_model.has_hot_water_cylinder, total_floor_area: @view_model.total_floor_area.to_s, has_mains_gas: @view_model.respond_to?(:mains_gas) ? @view_model.mains_gas : nil, current_energy_efficiency_rating: @view_model., potential_energy_efficiency_rating: @view_model., type_of_property: Helper::XmlEnumsToOutput.property_type(@view_model.property_type), recommended_improvements: @view_model.improvements.map do |improvement| improvement[:energy_performance_band_improvement] = Helper::EnergyBandCalculator.domestic(improvement[:energy_performance_rating_improvement]) improvement end, } end |