Sha256: 59306de6d6a3bd99e26823bce14eeb615ce3cca418d9a2f2a3ce093e2ca8867a

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

require_dependency "renalware/letters"

module Renalware
  module Letters
    class DraftLetter
      include Wisper::Publisher

      def self.build
        self.new
      end

      def call(patient, params = {})
        letter = LetterFactory.new(patient, params).build
        # Rails.logger.info "Drafting letter of class #{letter.class} with type #{letter.type}"
        letter.save!
        letter.reload
        broadcast(:draft_letter_successful, letter)
      rescue ActiveRecord::RecordInvalid
        broadcast(:draft_letter_failed, letter)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta4 app/models/renalware/letters/draft_letter.rb