Class: Services::Hl7Message

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/services/hl7_message.rb

Constant Summary collapse

STATUS_RECEIVED =
0
STATUS_PROCESSED =
1
STATUS_ERRORED =
2

Instance Method Summary collapse

Instance Method Details

#message_as_hashObject



16
17
18
# File 'app/models/services/hl7_message.rb', line 16

def message_as_hash
  message.empty? ? {} : ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(message))
end

#raw_hl7_messageObject



20
21
22
23
# File 'app/models/services/hl7_message.rb', line 20

def raw_hl7_message
  raw_data = message_as_hash['rawData']
  Base64.urlsafe_decode64(raw_data) if raw_data.present?
end