class ViewModel::RdSapWrapper

Attributes

schema_type[R]
view_model[R]

Public Class Methods

new(xml_doc, schema_type, additional_data = {}) click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 5
def initialize(xml_doc, schema_type, additional_data = {})
  @schema_type = schema_type
  @view_model = build_view_model(xml_doc, schema_type)
  @summary = Presenter::RdSap::Summary.new(view_model)
  @report = Presenter::RdSap::Report.new(view_model, schema_type, additional_data)
  @recommendation_report = Presenter::RdSap::RecommendationReport.new(view_model)
end

Public Instance Methods

get_view_model() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 33
def get_view_model
  view_model
end
to_hash() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 17
def to_hash
  @summary.to_hash
end
to_hash_ni() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 21
def to_hash_ni
  @report.to_hash_ni
end
to_recommendation_report() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 29
def to_recommendation_report
  @recommendation_report.to_hash
end
to_report() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 25
def to_report
  @report.to_hash
end
type() click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 13
def type
  :RdSAP
end

Private Instance Methods

build_view_model(xml_doc, schema_type) click to toggle source
# File lib/view_model/rd_sap_wrapper.rb, line 39
def build_view_model(xml_doc, schema_type)
  case schema_type
  when :"RdSAP-Schema-20.0.0"
    ViewModel::RdSapSchema200::CommonSchema.new xml_doc
  when :"RdSAP-Schema-19.0"
    ViewModel::RdSapSchema190::CommonSchema.new xml_doc
  when :"RdSAP-Schema-18.0"
    ViewModel::RdSapSchema180::CommonSchema.new xml_doc
  when :"RdSAP-Schema-17.1"
    ViewModel::RdSapSchema171::CommonSchema.new xml_doc
  when :"RdSAP-Schema-17.0"
    ViewModel::RdSapSchema170::CommonSchema.new xml_doc
  when :"RdSAP-Schema-NI-20.0.0"
    ViewModel::RdSapSchemaNi200::CommonSchema.new xml_doc
  when :"RdSAP-Schema-NI-19.0"
    ViewModel::RdSapSchemaNi190::CommonSchema.new xml_doc
  when :"RdSAP-Schema-NI-18.0"
    ViewModel::RdSapSchemaNi180::CommonSchema.new xml_doc
  when :"RdSAP-Schema-NI-17.4"
    ViewModel::RdSapSchemaNi174::CommonSchema.new xml_doc
  when :"RdSAP-Schema-NI-17.3"
    ViewModel::RdSapSchemaNi173::CommonSchema.new xml_doc
  else
    raise ArgumentError, "Unsupported schema type"
  end
end