allscripts_unity_client 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b018d1ed24a0f4b028314d344ddda233cdae85e
|
4
|
+
data.tar.gz: a50e668f398d71abb9b9c2a634ece8009a97b929
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60b57a172e05271f9c68d9eeb4d9c04e10dbe17d16c9bba85e8e9a91f3435fd290b63d8d8d787a7f827489f0aa2caff61837c985f5e46dbf3451f622312bca4
|
7
|
+
data.tar.gz: c2e23be3758cce7f2568476132afafcc1140cea9b9453e225373fb0d4b61f9f383997405ab592a556412cbea4935cfa8816bd0faf137ece71fc51fa2a3652de2
|
@@ -75,5 +75,15 @@ module AllscriptsUnityClient
|
|
75
75
|
@end_time = Time.now.utc
|
76
76
|
@timer = @end_time - @start_time
|
77
77
|
end
|
78
|
+
|
79
|
+
# Initializes a `GetSecurityTokenError` with a default message.
|
80
|
+
#
|
81
|
+
# @return [GetSecurityTokenError]
|
82
|
+
def make_get_security_token_error
|
83
|
+
base_unity_url = self.options.base_unity_url.inspect
|
84
|
+
error_message = "Could not retrieve security token from #{base_unity_url}"
|
85
|
+
|
86
|
+
GetSecurityTokenError.new(error_message)
|
87
|
+
end
|
78
88
|
end
|
79
89
|
end
|
@@ -12,7 +12,6 @@ module AllscriptsUnityClient
|
|
12
12
|
def initialize(options)
|
13
13
|
super
|
14
14
|
|
15
|
-
|
16
15
|
@connection = HTTPClient.new(
|
17
16
|
proxy: @options.proxy,
|
18
17
|
default_header: {'Content-Type' => 'application/json'}
|
@@ -90,9 +89,13 @@ module AllscriptsUnityClient
|
|
90
89
|
log_get_security_token
|
91
90
|
log_info("Response Status: #{response.status}")
|
92
91
|
|
93
|
-
|
92
|
+
if response.status != 200
|
93
|
+
raise make_get_security_token_error
|
94
|
+
else
|
95
|
+
raise_if_response_error(response)
|
94
96
|
|
95
|
-
|
97
|
+
@security_token = response.body
|
98
|
+
end
|
96
99
|
end
|
97
100
|
|
98
101
|
# See Client#retire_security_token!.
|
@@ -117,6 +120,14 @@ module AllscriptsUnityClient
|
|
117
120
|
|
118
121
|
private
|
119
122
|
|
123
|
+
# @param [Array,String,nil] response
|
124
|
+
#
|
125
|
+
# @return [nil]
|
126
|
+
#
|
127
|
+
# @todo This method should be responsible creating an `APIError` not
|
128
|
+
# raising it. The sender should be responsible for raising the
|
129
|
+
# error so the stack trace starts in the method where the failure
|
130
|
+
# occured.
|
120
131
|
def raise_if_response_error(response)
|
121
132
|
if response.nil?
|
122
133
|
raise APIError, 'Response was empty'
|
@@ -17,6 +17,10 @@ module AllscriptsUnityClient
|
|
17
17
|
class APIError < RuntimeError
|
18
18
|
end
|
19
19
|
|
20
|
+
# Raised whenever the security token could not be retrieved Unity.
|
21
|
+
class GetSecurityTokenError < RuntimeError
|
22
|
+
end
|
23
|
+
|
20
24
|
# Create an instance of the Unity client.
|
21
25
|
#
|
22
26
|
# options:: See ClientOptions.
|
@@ -102,6 +102,21 @@ describe AllscriptsUnityClient::JSONClientDriver do
|
|
102
102
|
|
103
103
|
subject.get_security_token!
|
104
104
|
end
|
105
|
+
|
106
|
+
it 'should fail when there is a problem retrieving the security token' do
|
107
|
+
stub_request(:post, 'http://www.example.com/Unity/UnityService.svc/json/GetToken')
|
108
|
+
.to_return(
|
109
|
+
{
|
110
|
+
body: "",
|
111
|
+
headers: {},
|
112
|
+
status: 503,
|
113
|
+
}
|
114
|
+
)
|
115
|
+
|
116
|
+
expect do
|
117
|
+
subject.get_security_token!
|
118
|
+
end.to raise_error(AllscriptsUnityClient::GetSecurityTokenError)
|
119
|
+
end
|
105
120
|
end
|
106
121
|
|
107
122
|
describe '#retire_security_token!' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allscripts_unity_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- healthfinch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
290
|
rubyforge_project:
|
291
|
-
rubygems_version: 2.
|
291
|
+
rubygems_version: 2.2.2
|
292
292
|
signing_key:
|
293
293
|
specification_version: 4
|
294
294
|
summary: Allscripts Unity API client
|