class Maglev::GetPublishedPageSectionsService

def call

def call
  (fetch_container_store(page).sections || []).map do |section|
    transform_section(section.dup)
  end.compact
end

def fetch_container_store(container)

def fetch_container_store(container)
  store = container.sections_content_stores.published.first
  raise Maglev::Errors::UnpublishedPage if store.blank?
  store
end

def find_site_section(type)

def find_site_section(type)
  site_store.find_sections_by_type(type).first
end

def site

def site
  fetch_site.call
end

def site_store

def site_store
  @site_store ||= fetch_container_store(site)
end

def theme

def theme
  fetch_theme.call
end