Sha256: 99afab32a55b856a1a562b92226711c802ffb304b1ce2085999e7eef0734bb8b

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

module LifenFhir
  class Configuration

    attr_accessor :site

    attr_accessor :application_access_token

    attr_accessor :proxy_url

    # Logger used by Lifen FHIR. In Rails, this is the Rails logger, otherwise
    # Lifen FHIR provides its own LifenFhir::Logger.
    attr_accessor :logger

    def initialize
      self.logger = ::LifenFhir::Logger.new(STDOUT)
    end

    def site=(url)
      if !/(.*)\/$/.match(url)
        raise Error.new(message: "Invalid 'site' provided in configuration: '#{url}', a trailing slash is missing")
      end

      @site = url
    end
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configure
    yield(configuration) if block_given?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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