Sha256: 42d2e39c40955fdd915428efd01461caf42a45a5c5d97430474efab51181f949

Contents?: true

Size: 669 Bytes

Versions: 16

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/feeds"

module Renalware
  module Feeds
    class PersistMessage
      # message_payload is an HL7Message (a decorator around ::HL7::Message)
      # If the same message is persisted twice we'll get an ActiveRecord::RecordNotUnique error
      # but that's fine as we don't want to process the same HL7 message twice.
      def call(message_payload)
        Message.create!(
          event_code: message_payload.type,
          header_id: message_payload.header_id,
          body: message_payload.to_s,
          body_hash: Digest::MD5.hexdigest(message_payload.to_s)
        )
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
renalware-core-2.0.41 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.40 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.39 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.38 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.37 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.36 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.35 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.34 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.33 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.32 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.31 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.30 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.28 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.27 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.26 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.25 app/models/renalware/feeds/persist_message.rb