Class: AllscriptsUnityClient::ClientOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/allscripts_unity_client/client_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ClientOptions

Returns a new instance of ClientOptions.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/allscripts_unity_client/client_options.rb', line 6

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]
  @new_relic = options[:new_relic]

  self.timezone = options[:timezone]
  self.base_unity_url = options[:base_unity_url]

  validate_options
end

Instance Attribute Details

#appnameObject

Returns the value of attribute appname.



4
5
6
# File 'lib/allscripts_unity_client/client_options.rb', line 4

def appname
  @appname
end

#base_unity_urlObject

Returns the value of attribute base_unity_url.



4
5
6
# File 'lib/allscripts_unity_client/client_options.rb', line 4

def base_unity_url
  @base_unity_url
end

#ca_fileObject

Returns the value of attribute ca_file.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def ca_file
  @ca_file
end

#ca_pathObject

Returns the value of attribute ca_path.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def ca_path
  @ca_path
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def logger
  @logger
end

#new_relicObject

Returns the value of attribute new_relic.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def new_relic
  @new_relic
end

#passwordObject

Returns the value of attribute password.



4
5
6
# File 'lib/allscripts_unity_client/client_options.rb', line 4

def password
  @password
end

#proxyObject

Returns the value of attribute proxy.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def proxy
  @proxy
end

#timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/allscripts_unity_client/client_options.rb', line 3

def timeout
  @timeout
end

#timezoneObject

Returns the value of attribute timezone.



4
5
6
# File 'lib/allscripts_unity_client/client_options.rb', line 4

def timezone
  @timezone
end

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/allscripts_unity_client/client_options.rb', line 4

def username
  @username
end

Instance Method Details

#ca_file?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/allscripts_unity_client/client_options.rb', line 71

def ca_file?
  !@ca_file.to_s.strip.empty?
end

#ca_path?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/allscripts_unity_client/client_options.rb', line 75

def ca_path?
  !@ca_path.to_s.strip.empty?
end

#logger?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/allscripts_unity_client/client_options.rb', line 67

def logger?
  !@logger.nil?
end

#new_relic?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/allscripts_unity_client/client_options.rb', line 83

def new_relic?
  !@new_relic.nil?
end

#proxy?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/allscripts_unity_client/client_options.rb', line 63

def proxy?
  !@proxy.to_s.strip.empty?
end

#timeout?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/allscripts_unity_client/client_options.rb', line 79

def timeout?
  !@timeout.to_s.strip.empty?
end

#validate_options(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/allscripts_unity_client/client_options.rb', line 23

def validate_options(options = {})
  base_unity_url = options.has_key?(:base_unity_url) ? options[:base_unity_url] : @base_unity_url
  username = options.has_key?(:username) ? options[:username] : @username
  password = options.has_key?(:password) ? options[:password] : @password
  appname = options.has_key?(:appname) ? options[: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