Sha256: 41ea31274517a9484f87f1d718c93ae17883030559da9e8328e85d95780b4c4d

Contents?: true

Size: 449 Bytes

Versions: 9

Compression:

Stored size: 449 Bytes

Contents

require_dependency "renalware/letters"
require "attr_extras"

module Renalware
  module Letters
    class CompleteLetter
      include Broadcasting
      pattr_initialize :letter

      class << self
        alias_method :build, :new
      end

      def call(by:)
        Letter.transaction do
          @letter = letter.complete(by: by)
          letter.save!
          broadcast(:letter_completed, letter)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.7 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.5 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.4 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.3 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.2 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.1 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.0 app/models/renalware/letters/complete_letter.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/letters/complete_letter.rb