Sha256: 458b02f179c2ee03dbfcb522338f9a3545e08d2cc7f6095596f3ef69edc40e4f

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

module LifenFhir

  require 'virtus'
  require 'faraday'
  require 'inflecto'
  require 'base64'

  class Recipient < Virtus::Attribute
    def coerce(value)
      (value.is_a?(Practitioner) or value.is_a?(Patient) or value.nil?) ? value : raise(Error)
    end
  end

  class Sender < Virtus::Attribute
    def coerce(value)
      (value.is_a?(Practitioner) or value.nil?) ? value : raise(Error)
    end
  end

  require "lifen_fhir/version"

  require 'lifen_fhir/logger'
  require 'lifen_fhir/error'
  require 'lifen_fhir/client'
  require 'lifen_fhir/app_authenticated_client'
  require 'lifen_fhir/configuration'
  require 'lifen_fhir/base'
  require 'lifen_fhir/element'

  require 'lifen_fhir/address'
  require 'lifen_fhir/telecom'
  require 'lifen_fhir/channel'
  require 'lifen_fhir/practitioner'
  require 'lifen_fhir/category'
  require 'lifen_fhir/medium'
  require 'lifen_fhir/attachment'
  require 'lifen_fhir/binary'
  require 'lifen_fhir/patient'
  require 'lifen_fhir/content_string'
  require 'lifen_fhir/communication'
  require 'lifen_fhir/communication_request'

  Virtus.finalize

  AVAILABLE_INTEGRATIONS = %w(railties).freeze

  class << self
    extend Forwardable

    def_delegators :logger

    def inject
      integrations_to_load = LifenFhir::AVAILABLE_INTEGRATIONS

      integrations_to_load &= Gem.loaded_specs.keys
      integrations_to_load.each do |integration|
        load_integration(integration)
      end
    end

    def load_integration(integration)
      require "lifen_fhir/integrations/#{integration}"
    rescue Exception => error
      logger.warn "Unable to load lifen_fhir/integrations/#{integration}: #{error}"
    end
  end

end

LifenFhir.inject

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lifen_fhir-0.7.1 lib/lifen_fhir.rb
lifen_fhir-0.7.0 lib/lifen_fhir.rb