allscripts_unity_client 2.0.1 → 2.0.2

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: 0f4d391c7be9dbfb1805efb30c26b2def701a968
4
- data.tar.gz: 8339db470d7aeb19974e82b4d8e714af42103cee
3
+ metadata.gz: 78b65bf8597ab01389fb52af523a577324cf25af
4
+ data.tar.gz: 906619caa58558d76501a941e68d9f440e7bfeee
5
5
  SHA512:
6
- metadata.gz: b7bafb0b0cbf587c7729fda1ff143f20f3481d54fa3f54b5f383c1c728ed942bfe64937b61ecb53b24f6fc837f21d420e34190c968cbaaa77c13429cdff3286a
7
- data.tar.gz: 663bd4436aa214ac28cbc47e7f24109e9193f75ff27b60e60b19af2b42790268fce2cd9cce33a7da277afbad19a160b341c9e4513e8d1a65b2d9340d771b212d
6
+ metadata.gz: 6d8287a426c5c4bed6e1aa8bb084d1d0e0e14e43c6983bbdbf92fc4eb27fca5528ff7ef02951a76289855cf9284cc2d97f8823d067f0c5dc7e9ebda1bc69cee2
7
+ data.tar.gz: 32e1e7798cbaf325d5cc2abd90fe70336216cf54e4d88444f7bc2ce285d8a9d0c836ac4ca8c561718f036cebf3b8d401095e1ffbd637dff2fb801177f40e49b4
data/README.md CHANGED
@@ -45,7 +45,7 @@ unity_client = AllscriptsUnityClient.create({
45
45
  })
46
46
  ```
47
47
 
48
- ## SSL Management
48
+ ### SSL Management
49
49
 
50
50
  [Faraday](https://github.com/lostisland/faraday) is used in combination with [EM-HTTP-Request](https://github.com/igrigorik/em-http-request) to send HTTP requests when using JSON clients. Faraday requires
51
51
  some configuration when making connections over SSL. AllscriptsUnityClient will try to auto-detect the location of the
@@ -77,6 +77,24 @@ unity_client = AllscriptsUnityClient.create({
77
77
  })
78
78
  ```
79
79
 
80
+ ### Request Timeout
81
+
82
+ When using a JSON client, request timeouts can be configured:
83
+
84
+ ```ruby
85
+ # Mode defaults to :soap
86
+ unity_client = AllscriptsUnityClient.create({
87
+ mode: :json,
88
+ base_unity_url: "http://unity.base.url",
89
+ appname: "appname",
90
+ username: "username",
91
+ password: "password",
92
+ timeout: 30
93
+ })
94
+ ```
95
+
96
+ Timeout is given in seconds and defaults to 90.
97
+
80
98
  ### Security token management
81
99
 
82
100
  Security tokens can be manually requested using the `get_security_token!` method:
@@ -1,7 +1,7 @@
1
1
  module AllscriptsUnityClient
2
2
  class ClientOptions
3
3
  attr_accessor :proxy, :logger
4
- attr_reader :base_unity_url, :username, :password, :appname, :timezone, :ca_file, :ca_path
4
+ attr_reader :base_unity_url, :username, :password, :appname, :timezone, :ca_file, :ca_path, :timeout
5
5
 
6
6
  def initialize(options = {})
7
7
  @base_unity_url = options[:base_unity_url] ? options[:base_unity_url].gsub(/\/$/, '') : nil
@@ -13,6 +13,7 @@ module AllscriptsUnityClient
13
13
  @logger = options[:logger]
14
14
  @ca_file = options[:ca_file]
15
15
  @ca_path = options[:ca_path]
16
+ @timeout = options[:timeout]
16
17
 
17
18
  validate_options
18
19
  end
@@ -78,5 +79,11 @@ module AllscriptsUnityClient
78
79
  return false if @ca_path.empty?
79
80
  true
80
81
  end
82
+
83
+ def timeout?
84
+ return false if @timeout.nil?
85
+ return false if @timeout.empty?
86
+ true
87
+ end
81
88
  end
82
89
  end
@@ -26,6 +26,8 @@ module AllscriptsUnityClient
26
26
  request.url "#{UNITY_JSON_ENDPOINT}/MagicJson"
27
27
  request.headers['Content-Type'] = 'application/json'
28
28
  request.body = JSON.generate(request_data.to_hash)
29
+ set_request_timeout(request)
30
+
29
31
  start_timer
30
32
  end
31
33
  end_timer
@@ -54,6 +56,8 @@ module AllscriptsUnityClient
54
56
  request.url "#{UNITY_JSON_ENDPOINT}/GetToken"
55
57
  request.headers['Content-Type'] = 'application/json'
56
58
  request.body = JSON.generate(request_data)
59
+ set_request_timeout(request)
60
+
57
61
  start_timer
58
62
  end
59
63
  end_timer
@@ -77,6 +81,8 @@ module AllscriptsUnityClient
77
81
  request.url "#{UNITY_JSON_ENDPOINT}/RetireSecurityToken"
78
82
  request.headers['Content-Type'] = 'application/json'
79
83
  request.body = JSON.generate(request_data)
84
+ set_request_timeout(request)
85
+
80
86
  start_timer
81
87
  end
82
88
  end_timer
@@ -147,5 +153,15 @@ module AllscriptsUnityClient
147
153
 
148
154
  nil
149
155
  end
156
+
157
+ def set_request_timeout(request)
158
+ if @options.timeout?
159
+ request.options[:timeout] = @options.timeout
160
+ request.options[:open_timeout] = @options.timeout
161
+ else
162
+ request.options[:timeout] = 90
163
+ request.options[:open_timeout] = 90
164
+ end
165
+ end
150
166
  end
151
167
  end
@@ -1,3 +1,3 @@
1
1
  module AllscriptsUnityClient
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allscripts_unity_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Gupta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-30 00:00:00.000000000 Z
12
+ date: 2014-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon