Class: AllscriptsUnityClient::SOAPClientDriver
Constant Summary
collapse
- UNITY_SOAP_ENDPOINT =
'/Unity/UnityService.svc/unityservice'
- UNITY_ENDPOINT_NAMESPACE =
'http://www.allscripts.com/Unity/IUnityService'
Constants inherited
from ClientDriver
ClientDriver::LOG_FILE
Instance Attribute Summary collapse
Attributes inherited from ClientDriver
#options, #security_token
Instance Method Summary
collapse
#security_token?
Constructor Details
Returns a new instance of SOAPClientDriver.
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 10
def initialize(options)
super
client_proxy = @options.proxy
base_unity_url = "#{@options.base_unity_url}#{UNITY_SOAP_ENDPOINT}"
@savon_client = Savon.client do
namespace_identifier nil
endpoint base_unity_url
namespace 'http://www.allscripts.com/Unity'
unless client_proxy.nil?
proxy client_proxy
end
env_namespace :soap
convert_request_keys_to :camelcase
({ 'Accept-Encoding' => 'gzip,deflate'})
log false
end
end
|
Instance Attribute Details
#savon_client ⇒ Object
Returns the value of attribute savon_client.
5
6
7
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 5
def savon_client
@savon_client
end
|
Instance Method Details
#client_type ⇒ Object
51
52
53
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 51
def client_type
:soap
end
|
#get_security_token!(parameters = {}) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 76
def get_security_token!(parameters = {})
username = parameters[:username] || @options.username
password = parameters[:password] || @options.password
appname = parameters[:appname] || @options.appname
call_data = {
message: {
'Username' => username,
'Password' => password,
'Appname' => appname
},
soap_action: "#{UNITY_ENDPOINT_NAMESPACE}/GetSecurityToken"
}
begin
start_timer
response = @savon_client.call('GetSecurityToken', call_data)
end_timer
rescue Savon::SOAPFault => e
raise APIError, e.message
end
log_get_security_token
@security_token = response.body[:get_security_token_response][:get_security_token_result]
end
|
#magic(parameters = {}) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 55
def magic(parameters = {})
request_data = UnityRequest.new(parameters, @options.timezone, @options.appname, @security_token)
call_data = {
message: request_data.to_hash,
soap_action: "#{UNITY_ENDPOINT_NAMESPACE}/Magic"
}
begin
start_timer
response = @savon_client.call('Magic', call_data)
end_timer
rescue Savon::SOAPFault => e
raise APIError, e.message
end
log_magic(request_data)
response = UnityResponse.new(response.body, @options.timezone)
response.to_hash
end
|
#retire_security_token!(parameters = {}) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/allscripts_unity_client/soap_client_driver.rb', line 103
def retire_security_token!(parameters = {})
token = parameters[:token] || @security_token
appname = parameters[:appname] || @options.appname
call_data = {
message: {
'Token' => token,
'Appname' => appname
},
soap_action: "#{UNITY_ENDPOINT_NAMESPACE}/RetireSecurityToken"
}
begin
start_timer
@savon_client.call('RetireSecurityToken', call_data)
end_timer
rescue Savon::SOAPFault => e
raise APIError, e.message
end
log_retire_security_token
@security_token = nil
end
|