Class: AllscriptsUnityClient::ClientDriver

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

Direct Known Subclasses

JSONClientDriver, SOAPClientDriver

Constant Summary collapse

LOG_FILE =
"logs/unity_client.log"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_unity_url, username, password, appname, proxy = nil, timezone = nil, logger = nil, log = true) ⇒ ClientDriver

Returns a new instance of ClientDriver.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/allscripts_unity_client/client_driver.rb', line 9

def initialize(base_unity_url, username, password, appname, proxy = nil, timezone = nil, logger = nil, log = true)
  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?

  @base_unity_url = base_unity_url.gsub /\/$/, ""
  @username = username
  @password = password
  @appname = appname
  @proxy = proxy
  @log = log

  if logger.nil?
    @logger = Logger.new(STDOUT)
    @logger.level = Logger::INFO
  else
    @logger = logger
  end

  unless timezone.nil?
    @timezone = Timezone.new(timezone)
  else
    @timezone = Timezone.new("UTC")
  end
end

Instance Attribute Details

#appnameObject

Returns the value of attribute appname.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def appname
  @appname
end

#base_unity_urlObject

Returns the value of attribute base_unity_url.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def base_unity_url
  @base_unity_url
end

#logObject

Returns the value of attribute log.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def log
  @log
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def logger
  @logger
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def password
  @password
end

#proxyObject

Returns the value of attribute proxy.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def proxy
  @proxy
end

#security_tokenObject

Returns the value of attribute security_token.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def security_token
  @security_token
end

#timezoneObject

Returns the value of attribute timezone.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def timezone
  @timezone
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'lib/allscripts_unity_client/client_driver.rb', line 7

def username
  @username
end

Instance Method Details

#client_typeObject



44
45
46
# File 'lib/allscripts_unity_client/client_driver.rb', line 44

def client_type
  return :none
end

#get_security_token!(parameters = {}) ⇒ Object

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/allscripts_unity_client/client_driver.rb', line 52

def get_security_token!(parameters = {})
  raise NotImplementedError, "get_security_token! not implemented"
end

#log?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/allscripts_unity_client/client_driver.rb', line 40

def log?
  return @log
end

#magic(parameters = {}) ⇒ Object

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/allscripts_unity_client/client_driver.rb', line 48

def magic(parameters = {})
  raise NotImplementedError, "magic not implemented"
end

#retire_security_token!(parameters = {}) ⇒ Object

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/allscripts_unity_client/client_driver.rb', line 56

def retire_security_token!(parameters = {})
  raise NotImplementedError, "retire_security_token! not implemented"
end

#security_token?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/allscripts_unity_client/client_driver.rb', line 36

def security_token?
  return !@security_token.nil?
end