Sha256: 7f73a4ffeb80630e864b7ea2e9ae3bf68b25e2a2c671e889e61bc766cac6433f

Contents?: true

Size: 861 Bytes

Versions: 4

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true
module Roqua
  module Healthy
    class Client
      include ::Roqua::Support::Instrumentation

      attr_accessor :a19_endpoint, :a19_username, :a19_password

      def initialize(options = {})
        @a19_endpoint = options[:a19_endpoint]
        @a19_username = options[:a19_username]
        @a19_password = options[:a19_password]
      end

      def a19_endpoint
        @a19_endpoint || Roqua::Healthy.a19_endpoint
      end

      def use_basic_auth?
        @a19_username.present? || @a19_password.present?
      end

      def fetch_a19(patient_id)
        with_instrumentation 'hl7.a19', patient_id: patient_id do
          message = A19::Fetcher.new(patient_id, self).fetch
          patient = A19::Transformer.new(message).to_patient
          patient
        end
      end
    end
  end
end

require_relative 'a19'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roqua-healthy-1.5.3 lib/roqua/healthy/client.rb
roqua-healthy-1.5.2 lib/roqua/healthy/client.rb
roqua-healthy-1.5.1 lib/roqua/healthy/client.rb
roqua-healthy-1.5.0 lib/roqua/healthy/client.rb