Class: AllscriptsUnityClient::ClientOptions
- Inherits:
-
Object
- Object
- AllscriptsUnityClient::ClientOptions
- Defined in:
- lib/allscripts_unity_client/client_options.rb
Overview
Contains various options for Unity configuration.
Instance Attribute Summary collapse
-
#appname ⇒ Object
Returns the value of attribute appname.
-
#base_unity_url ⇒ Object
Returns the value of attribute base_unity_url.
-
#ca_file ⇒ Object
Returns the value of attribute ca_file.
-
#ca_path ⇒ Object
Returns the value of attribute ca_path.
-
#ehr_password ⇒ Object
Returns the value of attribute ehr_password.
-
#ehr_userid ⇒ Object
Returns the value of attribute ehr_userid.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#raw_dates ⇒ Object
Returns the value of attribute raw_dates.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#use_ubiquity ⇒ Object
Returns the value of attribute use_ubiquity.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#ca_file? ⇒ Boolean
Return true if ca_file is not empty.
-
#ca_path? ⇒ Boolean
Return true if ca_path is not empty.
-
#initialize(options = {}) ⇒ ClientOptions
constructor
Constructor.
-
#logger? ⇒ Boolean
Return true if logger is not nil.
-
#proxy? ⇒ Boolean
Return true if proxy is set and not empty.
-
#timeout? ⇒ Boolean
Return true if timeout is not empty.
-
#validate_options(options = {}) ⇒ Object
Validates options by ensuring that all required options are present.
Constructor Details
#initialize(options = {}) ⇒ ClientOptions
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
-
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/allscripts_unity_client/client_options.rb', line 24 def initialize( = {}) @username = [:username] @password = [:password] @appname = [:appname] @proxy = [:proxy] @logger = [:logger] @ca_file = [:ca_file] @ca_path = [:ca_path] @timeout = [:timeout] @ehr_userid = [:ehr_userid] @ehr_password = [:ehr_password] @use_ubiquity = [:use_ubiquity] || false self.timezone = [:timezone] self.base_unity_url = [:base_unity_url] self.raw_dates = [:raw_dates] end |
Instance Attribute Details
#appname ⇒ Object
Returns the value of attribute appname.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def appname @appname end |
#base_unity_url ⇒ Object
Returns the value of attribute base_unity_url.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def base_unity_url @base_unity_url end |
#ca_file ⇒ Object
Returns the value of attribute ca_file.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def ca_file @ca_file end |
#ca_path ⇒ Object
Returns the value of attribute ca_path.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def ca_path @ca_path end |
#ehr_password ⇒ Object
Returns the value of attribute ehr_password.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def ehr_password @ehr_password end |
#ehr_userid ⇒ Object
Returns the value of attribute ehr_userid.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def ehr_userid @ehr_userid end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def password @password end |
#proxy ⇒ Object
Returns the value of attribute proxy.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def proxy @proxy end |
#raw_dates ⇒ Object
Returns the value of attribute raw_dates.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def raw_dates @raw_dates end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/allscripts_unity_client/client_options.rb', line 5 def timeout @timeout end |
#timezone ⇒ Object
Returns the value of attribute timezone.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def timezone @timezone end |
#use_ubiquity ⇒ Object
Returns the value of attribute use_ubiquity.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def use_ubiquity @use_ubiquity end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/allscripts_unity_client/client_options.rb', line 6 def username @username end |
Instance Method Details
#ca_file? ⇒ Boolean
Return true if ca_file is not empty.
124 125 126 |
# File 'lib/allscripts_unity_client/client_options.rb', line 124 def ca_file? !@ca_file.to_s.strip.empty? end |
#ca_path? ⇒ Boolean
Return true if ca_path is not empty.
129 130 131 |
# File 'lib/allscripts_unity_client/client_options.rb', line 129 def ca_path? !@ca_path.to_s.strip.empty? end |
#logger? ⇒ Boolean
Return true if logger is not nil.
119 120 121 |
# File 'lib/allscripts_unity_client/client_options.rb', line 119 def logger? !@logger.nil? end |
#proxy? ⇒ Boolean
Return true if proxy is set and not empty.
114 115 116 |
# File 'lib/allscripts_unity_client/client_options.rb', line 114 def proxy? !@proxy.to_s.strip.empty? end |
#timeout? ⇒ Boolean
Return true if timeout is not empty.
134 135 136 |
# File 'lib/allscripts_unity_client/client_options.rb', line 134 def timeout? !@timeout.to_s.strip.empty? end |
#validate_options(options = {}) ⇒ Object
Validates options by ensuring that all required options are present.
See #initialize.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/allscripts_unity_client/client_options.rb', line 47 def ( = {}) base_unity_url = .fetch(:base_unity_url, @base_unity_url) username = .fetch(:username, @username) password = .fetch(:password, @password) appname = .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 |