allscripts_unity_client 5.0.0 → 5.1.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
  SHA256:
3
- metadata.gz: d96b72062dd8b2c9d1d6c6a990b1b18597af5ec2bcfba97b66074ae1837d95b5
4
- data.tar.gz: 69910ee5c8de3126c2a4a55227189b0bd0aa2dc8045a1eb4b564e2b7911f3f71
3
+ metadata.gz: b116562b821aba2354693ae0c558db8fb45d7854b4da7167a5159f0069308049
4
+ data.tar.gz: dce828cd7de3875c3b165fca31625c3b084d6970bb2e3edd6232d8a44cb37075
5
5
  SHA512:
6
- metadata.gz: 4175b8a59a62ffc50fa8685b711c00e74f6fd46352420bb1cb8a4711deca43970990536c9143f3e508ec35910f35ecf11e251fc27db8033cc40bcec014b48607
7
- data.tar.gz: 956d56efb176d8591293158f1efb4dcf51c74403d31cabb3449b634192be67d45e9f54003c1cacebcdc3ff9cae33ebe6a5b398ad3721169b4a97f1887ce25182
6
+ metadata.gz: e8f4a8e409752a922352ea4465f23b468fc264df61d913ad2f11f337090d9a527d8dd105737448bad5e1bad462ea18d821813402bcf5ce8dda3a7ad24e8bb426
7
+ data.tar.gz: 852a4ad6fb74b4d089a5fe5bc178321589ffd4bb9c468e4c015856b38b77fd44f3d761466c2392ef9eea5eb7510a5110632d080ae5cf482e92dab8f768fc9852
@@ -31,6 +31,7 @@ module AllscriptsUnityClient
31
31
  # Returns an instance of Client.
32
32
  def self.create(options = {})
33
33
  options[:mode] ||= :json
34
+ options[:raw_dates] ||= false
34
35
  if options[:log] != false # explicitly
35
36
  options[:log] = true
36
37
  end
@@ -3,7 +3,7 @@ module AllscriptsUnityClient
3
3
  # Contains various options for Unity configuration.
4
4
  class ClientOptions
5
5
  attr_accessor :proxy, :logger, :ca_file, :ca_path, :timeout, :ehr_userid, :ehr_password
6
- attr_reader :base_unity_url, :username, :password, :appname, :timezone
6
+ attr_reader :base_unity_url, :username, :password, :appname, :timezone, :raw_dates
7
7
 
8
8
  # Constructor.
9
9
  #
@@ -34,6 +34,7 @@ module AllscriptsUnityClient
34
34
 
35
35
  self.timezone = options[:timezone]
36
36
  self.base_unity_url = options[:base_unity_url]
37
+ self.raw_dates = options[:raw_dates]
37
38
 
38
39
  validate_options
39
40
  end
@@ -96,6 +97,10 @@ module AllscriptsUnityClient
96
97
  end
97
98
  end
98
99
 
100
+ def raw_dates=(raw_dates)
101
+ @raw_dates = raw_dates || false
102
+ end
103
+
99
104
  # Return true if proxy is set and not empty.
100
105
  def proxy?
101
106
  !@proxy.to_s.strip.empty?
@@ -52,7 +52,7 @@ module AllscriptsUnityClient
52
52
  raise UnauthenticatedError, "#{parameters[:action]} for #{@options.base_unity_url}"
53
53
  end
54
54
 
55
- request = JSONUnityRequest.new(parameters, @options.timezone, @options.appname, @security_token)
55
+ request = JSONUnityRequest.new(parameters, @options.timezone, @options.appname, @security_token, @options.raw_dates)
56
56
  request_hash = request.to_hash
57
57
  request_data = MultiJson.dump(request_hash)
58
58
 
@@ -2,7 +2,7 @@ module AllscriptsUnityClient
2
2
 
3
3
  # Transform a Unity request into a Hash suitable for sending using Savon.
4
4
  class UnityRequest
5
- attr_accessor :parameters, :appname, :security_token, :timezone
5
+ attr_accessor :parameters, :appname, :security_token, :timezone, :raw_dates
6
6
 
7
7
  # Constructor.
8
8
  #
@@ -26,7 +26,7 @@ module AllscriptsUnityClient
26
26
  # timezone:: An ActiveSupport::TimeZone instance.
27
27
  # appname:: The Unity license appname.
28
28
  # security_token:: A security token from the Unity GetSecurityToken call.
29
- def initialize(parameters, timezone, appname, security_token)
29
+ def initialize(parameters, timezone, appname, security_token, raw_dates=false)
30
30
  raise ArgumentError, 'parameters can not be nil' if parameters.nil?
31
31
  raise ArgumentError, 'timezone can not be nil' if timezone.nil?
32
32
  raise ArgumentError, 'appname can not be nil' if appname.nil?
@@ -36,6 +36,7 @@ module AllscriptsUnityClient
36
36
  @security_token = security_token
37
37
  @parameters = parameters
38
38
  @timezone = timezone
39
+ @raw_dates = raw_dates
39
40
  end
40
41
 
41
42
  # Convert the parameters to a Hash for Savon with all possible dates
@@ -72,11 +73,17 @@ module AllscriptsUnityClient
72
73
 
73
74
  protected
74
75
 
76
+ def use_raw_dates?
77
+ @raw_dates || false
78
+ end
79
+
75
80
  def process_date(value)
76
81
  if value && (value.is_a?(Time) || value.is_a?(DateTime) || value.is_a?(ActiveSupport::TimeWithZone))
77
82
  return value.in_time_zone(@timezone).iso8601
78
83
  end
79
84
 
85
+ return value if use_raw_dates?
86
+
80
87
  date = Utilities::try_to_encode_as_date(ActiveSupport::TimeZone['Etc/UTC'], value)
81
88
 
82
89
  if date && date.is_a?(ActiveSupport::TimeWithZone)
@@ -1,3 +1,3 @@
1
1
  module AllscriptsUnityClient
2
- VERSION = '5.0.0'.freeze
2
+ VERSION = '5.1.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
4
+ version: 5.1.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-05-19 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient