allscripts_unity_client 5.0.0.pre.alpha.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81f49d5a27c7727f261d6aed0f49e8064449989123ce839646df3b14bc475a6f
4
- data.tar.gz: 8f3ef4a6cf3c23e7fab0250b15b38619ff7bb82d3d056b640947700f8df3c099
3
+ metadata.gz: d96b72062dd8b2c9d1d6c6a990b1b18597af5ec2bcfba97b66074ae1837d95b5
4
+ data.tar.gz: 69910ee5c8de3126c2a4a55227189b0bd0aa2dc8045a1eb4b564e2b7911f3f71
5
5
  SHA512:
6
- metadata.gz: a85fc9e1065fc894ad886fe262aa9fc6926f3913f3e7512612f5ca3fedc5129359ae92eb2b824d5ee5b3928ab302e5cc10183f407901fbf95c4a642e35745bdd
7
- data.tar.gz: ac7fb5010ea2726aaf2838b750e36dea8fa21e8bb9a4853f43fbedb4a13ee126c6d5069dab7cb85f68dedbb239364a477495bd6f4d9715c762d3f6491c7db9b3
6
+ metadata.gz: 4175b8a59a62ffc50fa8685b711c00e74f6fd46352420bb1cb8a4711deca43970990536c9143f3e508ec35910f35ecf11e251fc27db8033cc40bcec014b48607
7
+ data.tar.gz: 956d56efb176d8591293158f1efb4dcf51c74403d31cabb3449b634192be67d45e9f54003c1cacebcdc3ff9cae33ebe6a5b398ad3721169b4a97f1887ce25182
@@ -60,11 +60,11 @@ module AllscriptsUnityClient
60
60
  end
61
61
 
62
62
  def log_info(message)
63
- if @options.logger? && !message.nil?
64
- message += " #{@timer} seconds" unless @timer.nil?
65
- @timer = nil
66
- @options.logger.info(message)
67
- end
63
+ log(:info, message)
64
+ end
65
+
66
+ def log_warn(message)
67
+ log(:warn, message)
68
68
  end
69
69
 
70
70
  def start_timer
@@ -85,5 +85,15 @@ module AllscriptsUnityClient
85
85
 
86
86
  GetSecurityTokenError.new(error_message)
87
87
  end
88
+
89
+ private
90
+
91
+ def log(level, message)
92
+ if @options.logger? && !message.nil?
93
+ message += " #{@timer} seconds" unless @timer.nil?
94
+ @timer = nil
95
+ @options.logger.send(level, message)
96
+ end
97
+ end
88
98
  end
89
99
  end
@@ -8,6 +8,7 @@ module AllscriptsUnityClient
8
8
  attr_accessor :json_base_url, :connection
9
9
 
10
10
  UNITY_JSON_ENDPOINT = '/Unity/UnityService.svc/json'
11
+ TOKEN_REGEX = /^"?(\w|-)+"?$/
11
12
 
12
13
  def initialize(options)
13
14
  super
@@ -48,7 +49,7 @@ module AllscriptsUnityClient
48
49
 
49
50
  def magic(parameters = {})
50
51
  unless user_authenticated? || parameters[:action] == 'GetUserAuthentication'
51
- log_info("Unauthenticated access of #{parameters[:action]} for #{@options.base_unity_url}")
52
+ raise UnauthenticatedError, "#{parameters[:action]} for #{@options.base_unity_url}"
52
53
  end
53
54
 
54
55
  request = JSONUnityRequest.new(parameters, @options.timezone, @options.appname, @security_token)
@@ -84,10 +85,10 @@ module AllscriptsUnityClient
84
85
 
85
86
  if response[:valid_user] == 'YES'
86
87
  @user_authentication = response
87
- log_info("Successful authentication attempt for #{@options.base_unity_url}")
88
+ log_info("allscripts_unity_client authentication attempt: success #{@options.base_unity_url}")
88
89
  return true
89
90
  elsif response[:valid_user] == 'NO'
90
- log_info("Unsuccessful authentication attempt for #{@options.base_unity_url}")
91
+ log_warn("allscripts_unity_client authentication attempt: failure #{@options.base_unity_url}")
91
92
  return false
92
93
  else
93
94
  raise StandardError.new('Unexpected response from the server')
@@ -113,10 +114,10 @@ module AllscriptsUnityClient
113
114
  log_get_security_token
114
115
  log_info("Response Status: #{response.status}")
115
116
 
116
- if response.status != 200
117
+ if response.status != 200 || TOKEN_REGEX.match(response.body).nil?
117
118
  raise make_get_security_token_error
118
119
  else
119
- raise_if_response_error(response)
120
+ raise_if_response_error(response.body)
120
121
 
121
122
  @security_token = response.body
122
123
  end
@@ -1,3 +1,3 @@
1
1
  module AllscriptsUnityClient
2
- VERSION = '5.0.0-alpha.1'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
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: 5.0.0.pre.alpha.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - healthfinch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -260,9 +260,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
260
  version: 2.4.2
261
261
  required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
- - - ">"
263
+ - - ">="
264
264
  - !ruby/object:Gem::Version
265
- version: 1.3.1
265
+ version: '0'
266
266
  requirements: []
267
267
  rubygems_version: 3.0.3
268
268
  signing_key: