class AllscriptsUnityClient::ClientOptions
Contains various options for Unity configuration.
Attributes
Public Class Methods
Source
# File lib/allscripts_unity_client/client_options.rb, line 25 def initialize(options = {}) @username = options[:username] @password = options[:password] @appname = options[:appname] @proxy = options[:proxy] @logger = options[:logger] @ca_file = options[:ca_file] @ca_path = options[:ca_path] @timeout = options[:timeout] @ehr_userid = options[:ehr_userid] @ehr_password = options[:ehr_password] @use_ubiquity = options[:use_ubiquity] || false @ubiquity_id = options[:ubiquity_id] @ubiquity_client_id = options[:ubiquity_client_id] self.timezone = options[:timezone] self.base_unity_url = options[:base_unity_url] self.raw_dates = options[:raw_dates] validate_options end
Constructor.
- options
-
:username - Unity license username for security token __(required)__.
-
:password - Unity license password for security token __(required)__.
-
:appname - Unity license appname __(required)__.
-
:proxy - A string URL pointing to an HTTP proxy (optional, primarily for debugging)
-
:logger - A Ruby object that adheres to the same interface as Logger.
-
:ca_file - A string path for a CA File on the OS (JSON only).
-
:cs_path - A string path for a CA directory (JSON only).
-
:timeout - The number of seconds to set the HTTP response timeout and keepalive timeout (JSON only).
-
:base_unity_url - The URL where a Unity server is located (i.e. unity.server.com) __(required)__
-
:ehr_userid - Allscripts EHR Username for user authentication __(required)__.
-
:ehr_password - EHR Password for user authentication __(required)__.
-
:use_ubiquity - Specifies whether the
base_unity_url
is a ubiquity endpoint
-
Public Instance Methods
Source
# File lib/allscripts_unity_client/client_options.rb, line 96 def appname=(appname) validate_options(appname: appname) @appname = appname end
Mutator for appname.
Ensures appname is not nil,
Source
# File lib/allscripts_unity_client/client_options.rb, line 65 def base_unity_url=(base_unity_url) validate_options(base_unity_url: base_unity_url) @base_unity_url = base_unity_url.gsub(/\/$/, '') end
Mutator for @base_unity_url.
Strips trailing slash for URL.
Source
# File lib/allscripts_unity_client/client_options.rb, line 127 def ca_file? !@ca_file.to_s.strip.empty? end
Return true if ca_file
is not empty.
Source
# File lib/allscripts_unity_client/client_options.rb, line 132 def ca_path? !@ca_path.to_s.strip.empty? end
Return true if ca_path
is not empty.
Source
# File lib/allscripts_unity_client/client_options.rb, line 122 def logger? !@logger.nil? end
Return true if logger is not nil.
Source
# File lib/allscripts_unity_client/client_options.rb, line 88 def password=(password) validate_options(password: password) @password = password end
Mutator for password.
Ensures password is not nil,
Source
# File lib/allscripts_unity_client/client_options.rb, line 117 def proxy? !@proxy.to_s.strip.empty? end
Return true if proxy is set and not empty.
Source
# File lib/allscripts_unity_client/client_options.rb, line 112 def raw_dates=(raw_dates) @raw_dates = raw_dates || false end
Source
# File lib/allscripts_unity_client/client_options.rb, line 137 def timeout? !@timeout.to_s.strip.empty? end
Return true if timeout is not empty.
Source
# File lib/allscripts_unity_client/client_options.rb, line 104 def timezone=(timezone) if !timezone.nil? @timezone = ActiveSupport::TimeZone[timezone] else @timezone = ActiveSupport::TimeZone['Etc/UTC'] end end
Mutator for timezone.
Ensures timezone is not nil,
Source
# File lib/allscripts_unity_client/client_options.rb, line 73 def use_ubiquity=(use_ubiquity) @use_ubiquity = use_ubiquity || false end
Mutator for @use_ubiquity.
defaults value to false if nil
Source
# File lib/allscripts_unity_client/client_options.rb, line 80 def username=(username) validate_options(username: username) @username = username end
Mutator for username.
Ensures username is not nil,
Source
# File lib/allscripts_unity_client/client_options.rb, line 50 def validate_options(options = {}) base_unity_url = options.fetch(:base_unity_url, @base_unity_url) username = options.fetch(:username, @username) password = options.fetch(:password, @password) appname = options.fetch(:appname, @appname) raise ArgumentError, 'base_unity_url can not be nil' if base_unity_url.nil? raise ArgumentError, 'username can not be nil' if username.nil? raise ArgumentError, 'password can not be nil' if password.nil? raise ArgumentError, 'appname can not be nil' if appname.nil? end
Validates options by ensuring that all required options are present.
See initialize.