allscripts_unity_client 2.0.0 → 2.0.1
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: 0f4d391c7be9dbfb1805efb30c26b2def701a968
|
4
|
+
data.tar.gz: 8339db470d7aeb19974e82b4d8e714af42103cee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7bafb0b0cbf587c7729fda1ff143f20f3481d54fa3f54b5f383c1c728ed942bfe64937b61ecb53b24f6fc837f21d420e34190c968cbaaa77c13429cdff3286a
|
7
|
+
data.tar.gz: 663bd4436aa214ac28cbc47e7f24109e9193f75ff27b60e60b19af2b42790268fce2cd9cce33a7da277afbad19a160b341c9e4513e8d1a65b2d9340d771b212d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Allscripts Unity Client [![Build Status](https://travis-ci.org/healthfinch/allscripts-unity-client.png?branch=
|
1
|
+
# Allscripts Unity Client [![Build Status](https://travis-ci.org/healthfinch/allscripts-unity-client.png?branch=version2)](https://travis-ci.org/healthfinch/allscripts-unity-client) [![Coverage Status](https://coveralls.io/repos/healthfinch/allscripts-unity-client/badge.png?branch=master)](https://coveralls.io/r/healthfinch/allscripts-unity-client?branch=version2)
|
2
2
|
|
3
3
|
The `allscripts_unity_client` gem is a Ruby client for the Allscripts Unity API. See http://remotecentral.allscripts.com/UnityAPIReference for more documentation on the API.
|
4
4
|
|
@@ -45,6 +45,38 @@ unity_client = AllscriptsUnityClient.create({
|
|
45
45
|
})
|
46
46
|
```
|
47
47
|
|
48
|
+
## SSL Management
|
49
|
+
|
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
|
+
some configuration when making connections over SSL. AllscriptsUnityClient will try to auto-detect the location of the
|
52
|
+
operating system's CA File or CA Path, but these values can be explicitly configured when creating a client:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
# Mode defaults to :soap
|
56
|
+
unity_client = AllscriptsUnityClient.create({
|
57
|
+
mode: :json,
|
58
|
+
base_unity_url: "http://unity.base.url",
|
59
|
+
appname: "appname",
|
60
|
+
username: "username",
|
61
|
+
password: "password",
|
62
|
+
ca_file: "/usr/lib/ssl/certs/ca-certificates.crt"
|
63
|
+
})
|
64
|
+
```
|
65
|
+
|
66
|
+
OR
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# Mode defaults to :soap
|
70
|
+
unity_client = AllscriptsUnityClient.create({
|
71
|
+
mode: :json,
|
72
|
+
base_unity_url: "http://unity.base.url",
|
73
|
+
appname: "appname",
|
74
|
+
username: "username",
|
75
|
+
password: "password",
|
76
|
+
ca_path: "/usr/lib/ssl/certs"
|
77
|
+
})
|
78
|
+
```
|
79
|
+
|
48
80
|
### Security token management
|
49
81
|
|
50
82
|
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
|
4
|
+
attr_reader :base_unity_url, :username, :password, :appname, :timezone, :ca_file, :ca_path
|
5
5
|
|
6
6
|
def initialize(options = {})
|
7
7
|
@base_unity_url = options[:base_unity_url] ? options[:base_unity_url].gsub(/\/$/, '') : nil
|
@@ -11,6 +11,8 @@ module AllscriptsUnityClient
|
|
11
11
|
@proxy = options[:proxy]
|
12
12
|
self.timezone = options[:timezone]
|
13
13
|
@logger = options[:logger]
|
14
|
+
@ca_file = options[:ca_file]
|
15
|
+
@ca_path = options[:ca_path]
|
14
16
|
|
15
17
|
validate_options
|
16
18
|
end
|
@@ -64,5 +66,17 @@ module AllscriptsUnityClient
|
|
64
66
|
def logger?
|
65
67
|
!@logger.nil?
|
66
68
|
end
|
69
|
+
|
70
|
+
def ca_file?
|
71
|
+
return false if @ca_file.nil?
|
72
|
+
return false if @ca_file.empty?
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
|
+
def ca_path?
|
77
|
+
return false if @ca_path.nil?
|
78
|
+
return false if @ca_path.empty?
|
79
|
+
true
|
80
|
+
end
|
67
81
|
end
|
68
82
|
end
|
@@ -10,11 +10,7 @@ module AllscriptsUnityClient
|
|
10
10
|
|
11
11
|
def initialize(options)
|
12
12
|
super
|
13
|
-
@connection = Faraday.new(
|
14
|
-
if @options.proxy?
|
15
|
-
conn.proxy @options.proxy
|
16
|
-
end
|
17
|
-
|
13
|
+
@connection = Faraday.new(build_faraday_options) do |conn|
|
18
14
|
conn.adapter :em_http
|
19
15
|
end
|
20
16
|
end
|
@@ -102,5 +98,54 @@ module AllscriptsUnityClient
|
|
102
98
|
raise APIError, response
|
103
99
|
end
|
104
100
|
end
|
101
|
+
|
102
|
+
def build_faraday_options
|
103
|
+
options = {}
|
104
|
+
|
105
|
+
# Configure Faraday base url
|
106
|
+
options[:url] = @options.base_unity_url
|
107
|
+
|
108
|
+
# Configure root certificates for Faraday using options or via auto-detection
|
109
|
+
if @options.ca_file?
|
110
|
+
options[:ssl] = { ca_file: @options.ca_file }
|
111
|
+
elsif @options.ca_path?
|
112
|
+
options[:ssl] = { ca_path: @options.ca_path }
|
113
|
+
elsif ca_file = JSONClientDriver.find_ca_file
|
114
|
+
options[:ssl] = { ca_file: ca_file }
|
115
|
+
elsif ca_path = JSONClientDriver.find_ca_path
|
116
|
+
options[:ssl] = { ca_path: ca_path }
|
117
|
+
end
|
118
|
+
|
119
|
+
# Configure proxy
|
120
|
+
if @options.proxy?
|
121
|
+
options[:proxy] = @options.proxy
|
122
|
+
end
|
123
|
+
|
124
|
+
options
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.find_ca_path
|
128
|
+
if File.directory?('/usr/lib/ssl/certs')
|
129
|
+
return '/usr/lib/ssl/certs'
|
130
|
+
end
|
131
|
+
|
132
|
+
nil
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.find_ca_file
|
136
|
+
if File.exists?('/opt/boxen/homebrew/opt/curl-ca-bundle/share/ca-bundle.crt')
|
137
|
+
return '/opt/boxen/homebrew/opt/curl-ca-bundle/share/ca-bundle.crt'
|
138
|
+
end
|
139
|
+
|
140
|
+
if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
|
141
|
+
return '/opt/local/share/curl/curl-ca-bundle.crt'
|
142
|
+
end
|
143
|
+
|
144
|
+
if File.exists?('/usr/lib/ssl/certs/ca-certificates.crt')
|
145
|
+
return '/usr/lib/ssl/certs/ca-certificates.crt'
|
146
|
+
end
|
147
|
+
|
148
|
+
nil
|
149
|
+
end
|
105
150
|
end
|
106
151
|
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.
|
4
|
+
version: 2.0.1
|
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-
|
12
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|