Sha256: 4a064c78c40a2475aa16744812b4410448f388dd37b1175645bf76c6044ed33b

Contents?: true

Size: 611 Bytes

Versions: 127

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/letters"

module Renalware
  module Letters
    class DraftLetter
      include Wisper::Publisher
      include LetterPathology

      def self.build
        new
      end

      def call(patient, params = {})
        letter = LetterFactory.new(patient, params).build
        letter.pathology_snapshot = build_pathology_snapshot(patient)
        letter.save!
        letter.reload
        broadcast(:draft_letter_successful, letter)
      rescue ActiveRecord::RecordInvalid
        broadcast(:draft_letter_failed, letter)
      end
    end
  end
end

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
renalware-core-2.0.145 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.144 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.143 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.142 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.141 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.140 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.139 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.138 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.137 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.136 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.135 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.134 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.133 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.132 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.131 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.130 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.129 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.128 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.127 app/models/renalware/letters/draft_letter.rb
renalware-core-2.0.126 app/models/renalware/letters/draft_letter.rb