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.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#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 __(required)__.
-
:password - Unity license password __(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)__
-
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/allscripts_unity_client/client_options.rb', line 21 def initialize( = {}) @username = [:username] @password = [:password] @appname = [:appname] @proxy = [:proxy] @logger = [:logger] @ca_file = [:ca_file] @ca_path = [:ca_path] @timeout = [:timeout] self.timezone = [:timezone] self.base_unity_url = [:base_unity_url] 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 |
#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 |
#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 |
#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.
106 107 108 |
# File 'lib/allscripts_unity_client/client_options.rb', line 106 def ca_file? !@ca_file.to_s.strip.empty? end |
#ca_path? ⇒ Boolean
Return true if ca_path is not empty.
111 112 113 |
# File 'lib/allscripts_unity_client/client_options.rb', line 111 def ca_path? !@ca_path.to_s.strip.empty? end |
#logger? ⇒ Boolean
Return true if logger is not nil.
101 102 103 |
# File 'lib/allscripts_unity_client/client_options.rb', line 101 def logger? !@logger.nil? end |
#proxy? ⇒ Boolean
Return true if proxy is set and not empty.
96 97 98 |
# File 'lib/allscripts_unity_client/client_options.rb', line 96 def proxy? !@proxy.to_s.strip.empty? end |
#timeout? ⇒ Boolean
Return true if timeout is not empty.
116 117 118 |
# File 'lib/allscripts_unity_client/client_options.rb', line 116 def timeout? !@timeout.to_s.strip.empty? end |
#validate_options(options = {}) ⇒ Object
Validates options by ensuring that all required options are present.
See #initialize.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/allscripts_unity_client/client_options.rb', line 40 def ( = {}) base_unity_url = .has_key?(:base_unity_url) ? [:base_unity_url] : @base_unity_url username = .has_key?(:username) ? [:username] : @username password = .has_key?(:password) ? [:password] : @password appname = .has_key?(:appname) ? [: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 |