Sha256: db78a7d09857b2c6d37a6cb9abab5c7d204953c5177b4d6b68745c6d99330833

Contents?: true

Size: 447 Bytes

Versions: 7

Compression:

Stored size: 447 Bytes

Contents

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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
lifen-fhir-0.1.0 lib/lifen/attachment.rb
lifen-3.0.0 lib/lifen/attachment.rb
lifen-2.4.0 lib/lifen/attachment.rb
lifen-2.3.0 lib/lifen/attachment.rb
lifen-2.2.0 lib/lifen/attachment.rb
lifen-2.1.0 lib/lifen/attachment.rb
lifen-2.0.0 lib/lifen/attachment.rb