Sha256: 11baca9b9829b7bd203390f5049b0ce216b6b99d2d96613d00632043ff66f2c9

Contents?: true

Size: 624 Bytes

Versions: 8

Compression:

Stored size: 624 Bytes

Contents

require_dependency "renalware/patients"

module Renalware
  module Patients
    class MessageListener
      def message_processed(message_payload)
        patient_params = parse_patient_params(message_payload)
        system_user = find_system_user
        create_patient(patient_params, system_user)
      end

      private

      def parse_patient_params(message_payload)
        MessageParamParser.new.parse(message_payload)
      end

      def create_patient(params, user)
        IdempotentCreatePatient.new(user).call(params)
      end

      def find_system_user
        SystemUser.find
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta10 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta9 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/patients/message_listener.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/patients/message_listener.rb