Sha256: c8037473bfc9d1115d9b33ab78d1eb5422b4947fd26fc37f153acfda296d0497
Contents?: true
Size: 1.59 KB
Versions: 35
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true module Renalware module UKRDC module Outgoing module Rendering class Document < Rendering::Base pattr_initialize [:letter!] def xml document_element end private # rubocop:disable Metrics/MethodLength, Metrics/AbcSize def document_element create_node("Document") do |elem| elem << create_node("DocumentTime", letter.issued_on.to_time.iso8601) elem << Clinician.new(user: letter.author).xml elem << create_node("DocumentName", letter.title) elem << create_node("Status") do |status| status << create_node("Code", "ACTIVE") end elem << EnteredBy.new(user: letter.updated_by).xml if letter.hospital_unit_renal_registry_code.present? elem << create_node("EnteredAt") do |entered_at| entered_at << create_node("CodingStandard", "LOCAL") entered_at << create_node("Code", letter.hospital_unit_renal_registry_code) end end elem << create_node("FileType", "application/pdf") elem << create_node("FileName", letter.pdf_stateless_filename) elem << create_node("Stream", encoded_document_content) end end # rubocop:enable Metrics/MethodLength, Metrics/AbcSize def encoded_document_content Base64.encode64(Renalware::Letters::PdfRenderer.call(letter)) end end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems