module Lifen class Attachment < Base attribute :title, String attribute :path, String attribute :content_type, String def fhir_payload { contentAttachment: { data: base_64_encoded_content, title: title, contentType: "{#{content_type}}" } } end private def base_64_encoded_content Base64.encode64(File.open(path, "rb").read) end end end