redox 0.1.3 → 0.1.4
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 +4 -4
- data/CHANGELOG.md +11 -1
- data/bin/console +1 -0
- data/lib/redox.rb +33 -2
- data/lib/redox/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8779e7746c52bb1e149b95b8a28719fce07048b9b08538ea32841c66e6958a
|
4
|
+
data.tar.gz: fe25242609d42be438e504f719bcdbde764aa7c7c0c47ae1f1cf404012bd2478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c9fd7c435756453d2b388c8af01d7664281ffa5c69c7eaaa8a2c9d24ba98746046319fb62f74532e1e19c2e271248f6cd640d24b87c0263939a41d654f803e6
|
7
|
+
data.tar.gz: 721b2e09e0c8e8768ad4f452ee3ae7e7dfc84ccbaeb22d43af80f8c0aefca244395bb5c11f1fc1d991d2175ed1fb181c7fbd6689dd0f1d3a6e5f7b757e4581d2
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
|
+
None
|
9
|
+
|
10
|
+
## [0.1.4] - 2019-04-02
|
11
|
+
### Added
|
12
|
+
- Patient search
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Raise on auth failure
|
16
|
+
- Tweaks to console setup
|
8
17
|
|
9
18
|
## [0.1.3] - 2018-10-03
|
10
19
|
### Added
|
@@ -38,7 +47,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
38
47
|
### Added
|
39
48
|
- Initial Release
|
40
49
|
|
41
|
-
[Unreleased]: https://github.com/WeInfuse/redox/compare/0.1.
|
50
|
+
[Unreleased]: https://github.com/WeInfuse/redox/compare/0.1.4...HEAD
|
51
|
+
[0.1.4]: https://github.com/WeInfuse/redox/compare/0.1.3...0.1.4
|
42
52
|
[0.1.3]: https://github.com/WeInfuse/redox/compare/0.1.2...0.1.3
|
43
53
|
[0.1.2]: https://github.com/WeInfuse/redox/compare/0.1.1...0.1.2
|
44
54
|
[0.1.1]: https://github.com/WeInfuse/redox/compare/0.1.0...0.1.1
|
data/bin/console
CHANGED
data/lib/redox.rb
CHANGED
@@ -2,6 +2,7 @@ require 'redox/version'
|
|
2
2
|
require 'json'
|
3
3
|
require 'net/http'
|
4
4
|
require 'uri'
|
5
|
+
require 'openssl'
|
5
6
|
|
6
7
|
module Redox
|
7
8
|
# Redox API client
|
@@ -28,6 +29,8 @@ module Redox
|
|
28
29
|
@destinations = destinations
|
29
30
|
@facility_code = facility_code
|
30
31
|
@test = test
|
32
|
+
@connection = nil
|
33
|
+
@access_token = nil
|
31
34
|
end
|
32
35
|
|
33
36
|
# Send NewPatient message
|
@@ -76,6 +79,29 @@ module Redox
|
|
76
79
|
JSON.parse(response.body)
|
77
80
|
end
|
78
81
|
|
82
|
+
# Send PatientSearch query
|
83
|
+
#
|
84
|
+
# @param [Hash] patient_params data to send in the Patient JSON object
|
85
|
+
# @return [Hash] parsed response object
|
86
|
+
# @example
|
87
|
+
# Redox::Redox.new(*connection_params).search_patients(
|
88
|
+
# Identifiers: [],
|
89
|
+
# Demographics: {
|
90
|
+
# FirstName: 'Joe'
|
91
|
+
# }
|
92
|
+
# )
|
93
|
+
def search_patients(patient_params)
|
94
|
+
patient_request = Net::HTTP::Post.new('/query', auth_header)
|
95
|
+
request_body = request_meta(
|
96
|
+
data_model: 'PatientSearch', event_type: 'Query'
|
97
|
+
).merge(Patient: patient_params)
|
98
|
+
patient_request.body = request_body.to_json
|
99
|
+
|
100
|
+
response = connection.request(patient_request)
|
101
|
+
|
102
|
+
JSON.parse(response.body)
|
103
|
+
end
|
104
|
+
|
79
105
|
private
|
80
106
|
|
81
107
|
attr_reader :api_key, :secret, :source, :destinations, :facility_code, :test
|
@@ -88,6 +114,11 @@ module Redox
|
|
88
114
|
)
|
89
115
|
login_request.body = { apiKey: api_key, secret: secret }.to_json
|
90
116
|
response = connection.request(login_request)
|
117
|
+
|
118
|
+
if (false == response.is_a?(Net::HTTPOK))
|
119
|
+
raise "Failed to authenticate '#{response.code}' '#{response.body}'."
|
120
|
+
end
|
121
|
+
|
91
122
|
body = JSON.parse(response.body)
|
92
123
|
|
93
124
|
@access_token = body['accessToken']
|
@@ -119,12 +150,12 @@ module Redox
|
|
119
150
|
EventType: event_type,
|
120
151
|
EventDateTime: nil,
|
121
152
|
Test: test,
|
122
|
-
Source: source,
|
123
|
-
Destinations: destinations,
|
124
153
|
}
|
125
154
|
}
|
126
155
|
|
127
156
|
meta_object[:Meta][:FacilityCode] = facility_code if facility_code
|
157
|
+
meta_object[:Meta][:Source] = source if source
|
158
|
+
meta_object[:Meta][:Destinations] = destinations if destinations && !destinations.empty?
|
128
159
|
|
129
160
|
meta_object
|
130
161
|
end
|
data/lib/redox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
|
123
|
-
rubygems_version: 2.7.6
|
122
|
+
rubygems_version: 3.0.3
|
124
123
|
signing_key:
|
125
124
|
specification_version: 4
|
126
125
|
summary: Ruby wrapper for the Redox Engine API
|