allscripts_unity_client 1.0.3

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.
Files changed (67) hide show
  1. data/.gitignore +20 -0
  2. data/.travis.yml +3 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +22 -0
  5. data/README.md +180 -0
  6. data/Rakefile +7 -0
  7. data/allscripts_unity_client.gemspec +39 -0
  8. data/lib/allscripts_unity_client.rb +43 -0
  9. data/lib/allscripts_unity_client/client.rb +594 -0
  10. data/lib/allscripts_unity_client/client_driver.rb +95 -0
  11. data/lib/allscripts_unity_client/json_client_driver.rb +110 -0
  12. data/lib/allscripts_unity_client/json_unity_request.rb +33 -0
  13. data/lib/allscripts_unity_client/json_unity_response.rb +27 -0
  14. data/lib/allscripts_unity_client/soap_client_driver.rb +128 -0
  15. data/lib/allscripts_unity_client/timezone.rb +99 -0
  16. data/lib/allscripts_unity_client/unity_request.rb +63 -0
  17. data/lib/allscripts_unity_client/unity_response.rb +110 -0
  18. data/lib/allscripts_unity_client/utilities.rb +66 -0
  19. data/lib/allscripts_unity_client/version.rb +3 -0
  20. data/spec/allscripts_unity_client_spec.rb +57 -0
  21. data/spec/client_driver_spec.rb +71 -0
  22. data/spec/client_spec.rb +406 -0
  23. data/spec/factories/allscripts_unity_client_parameters_factory.rb +13 -0
  24. data/spec/factories/client_driver_factory.rb +14 -0
  25. data/spec/factories/client_factory.rb +7 -0
  26. data/spec/factories/json_client_driver_factory.rb +3 -0
  27. data/spec/factories/json_unity_request_factory.rb +3 -0
  28. data/spec/factories/json_unity_response_factory.rb +3 -0
  29. data/spec/factories/magic_request_factory.rb +33 -0
  30. data/spec/factories/soap_client_driver_factory.rb +3 -0
  31. data/spec/factories/timezone_factory.rb +7 -0
  32. data/spec/factories/unity_request_factory.rb +10 -0
  33. data/spec/factories/unity_response_factory.rb +8 -0
  34. data/spec/fixtures/attributes_hash.yml +15 -0
  35. data/spec/fixtures/date_hash.yml +8 -0
  36. data/spec/fixtures/date_string_hash.yml +8 -0
  37. data/spec/fixtures/error.json +3 -0
  38. data/spec/fixtures/get_providers.json +69 -0
  39. data/spec/fixtures/get_providers.xml +119 -0
  40. data/spec/fixtures/get_providers_json.yml +65 -0
  41. data/spec/fixtures/get_providers_xml.yml +270 -0
  42. data/spec/fixtures/get_security_token.json +1 -0
  43. data/spec/fixtures/get_security_token.xml +7 -0
  44. data/spec/fixtures/get_server_info.json +10 -0
  45. data/spec/fixtures/get_server_info.xml +40 -0
  46. data/spec/fixtures/get_server_info_json.yml +8 -0
  47. data/spec/fixtures/get_server_info_xml.yml +55 -0
  48. data/spec/fixtures/no_attributes_hash.yml +7 -0
  49. data/spec/fixtures/retire_security_token.json +1 -0
  50. data/spec/fixtures/retire_security_token.xml +5 -0
  51. data/spec/fixtures/soap_fault.xml +13 -0
  52. data/spec/fixtures/string_keyed_hash.yml +8 -0
  53. data/spec/fixtures/symbol_keyed_hash.yml +8 -0
  54. data/spec/json_client_driver_spec.rb +209 -0
  55. data/spec/json_unity_request_spec.rb +37 -0
  56. data/spec/json_unity_response_spec.rb +44 -0
  57. data/spec/soap_client_driver_spec.rb +201 -0
  58. data/spec/spec_helper.rb +44 -0
  59. data/spec/support/fixture_loader.rb +22 -0
  60. data/spec/support/shared_examples_for_client_driver.rb +139 -0
  61. data/spec/support/shared_examples_for_unity_request.rb +94 -0
  62. data/spec/support/shared_examples_for_unity_response.rb +26 -0
  63. data/spec/timezone_spec.rb +161 -0
  64. data/spec/unity_request_spec.rb +37 -0
  65. data/spec/unity_response_spec.rb +36 -0
  66. data/spec/utilities_spec.rb +69 -0
  67. metadata +323 -0
@@ -0,0 +1,63 @@
1
+ module AllscriptsUnityClient
2
+ class UnityRequest
3
+ attr_accessor :parameters, :appname, :security_token, :timezone
4
+
5
+ def initialize(parameters, timezone, appname, security_token)
6
+ raise ArgumentError, "parameters can not be nil" if parameters.nil?
7
+ raise ArgumentError, "timezone can not be nil" if timezone.nil?
8
+ raise ArgumentError, "appname can not be nil" if appname.nil?
9
+ raise ArgumentError, "security_token can not be nil" if security_token.nil?
10
+
11
+ @appname = appname
12
+ @security_token = security_token
13
+ @parameters = parameters
14
+ @timezone = timezone
15
+ end
16
+
17
+ def to_hash
18
+ action = @parameters[:action]
19
+ userid = @parameters[:userid]
20
+ appname = @parameters[:appname] || @appname
21
+ patientid = @parameters[:patientid]
22
+ token = @parameters[:token] || @security_token
23
+ parameter1 = process_date(@parameters[:parameter1])
24
+ parameter2 = process_date(@parameters[:parameter2])
25
+ parameter3 = process_date(@parameters[:parameter3])
26
+ parameter4 = process_date(@parameters[:parameter4])
27
+ parameter5 = process_date(@parameters[:parameter5])
28
+ parameter6 = process_date(@parameters[:parameter6])
29
+ data = Utilities::encode_data(@parameters[:data])
30
+
31
+ return {
32
+ "Action" => action,
33
+ "UserID" => userid,
34
+ "Appname" => appname,
35
+ "PatientID" => patientid,
36
+ "Token" => token,
37
+ "Parameter1" => parameter1,
38
+ "Parameter2" => parameter2,
39
+ "Parameter3" => parameter3,
40
+ "Parameter4" => parameter4,
41
+ "Parameter5" => parameter5,
42
+ "Parameter6" => parameter6,
43
+ "data" => data
44
+ }
45
+ end
46
+
47
+ protected
48
+
49
+ def process_date(value)
50
+ if value.nil?
51
+ return nil
52
+ end
53
+
54
+ result = Utilities::try_to_encode_as_date(value)
55
+
56
+ if result.instance_of?(Time) || result.instance_of?(Date) || result.instance_of?(DateTime)
57
+ return @timezone.utc_to_local(result)
58
+ end
59
+
60
+ value
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,110 @@
1
+ require "date"
2
+
3
+ module AllscriptsUnityClient
4
+ class UnityResponse
5
+ attr_accessor :response, :timezone
6
+
7
+ def initialize(response, timezone)
8
+ raise ArgumentError, "timezone can not be nil" if timezone.nil?
9
+ raise ArgumentError, "response can not be nil" if response.nil?
10
+
11
+ @response = response
12
+ @timezone = timezone
13
+ end
14
+
15
+ def to_hash
16
+ result = @response[:magic_response][:magic_result][:diffgram]
17
+ result = strip_attributes(result)
18
+ result = convert_dates_to_utc(result)
19
+
20
+ if result.nil?
21
+ return []
22
+ end
23
+
24
+ # All magic responses wrap their result in an ActionResponse element
25
+ result = result.values.first
26
+
27
+ # Often the first element in ActionResponse is an element
28
+ # called ActionInfo, but in some cases it has a different name
29
+ # so we just get the first element.
30
+ result.values.first
31
+ end
32
+
33
+ protected
34
+
35
+ def strip_attributes(response)
36
+ # Base case: nil maps to nil
37
+ if response.nil?
38
+ return nil
39
+ end
40
+
41
+ # Recurse step: if the value is a hash then delete all
42
+ # keys that match the attribute pattern that Nori uses
43
+ if response.is_a?(Hash)
44
+ response.delete_if do |key, value|
45
+ is_attribute = key.to_s =~ /^@/
46
+
47
+ unless is_attribute
48
+ strip_attributes(value)
49
+ end
50
+
51
+ is_attribute
52
+ end
53
+
54
+ return response
55
+ end
56
+
57
+ # Recurse step: if the value is an array then delete all
58
+ # keys within hashes that match the attribute pattern that
59
+ # Nori uses
60
+ if response.is_a?(Array)
61
+ result = response.map do |value|
62
+ strip_attributes(value)
63
+ end
64
+
65
+ return result
66
+ end
67
+
68
+ # Base case: value doesn't need attributes stripped
69
+ response
70
+ end
71
+
72
+ def convert_dates_to_utc(response)
73
+ # Base case
74
+ if response.nil?
75
+ return nil
76
+ end
77
+
78
+ # Recurse step: if the value is an array then convert all
79
+ # Ruby date objects to UTC
80
+ if response.is_a?(Array)
81
+ return response.map do |value|
82
+ convert_dates_to_utc(value)
83
+ end
84
+ end
85
+
86
+ # Recurse step: if the value is a hash then convert all
87
+ # Ruby date object values to UTC
88
+ if response.is_a?(Hash)
89
+ result = response.map do |key, value|
90
+ { key => convert_dates_to_utc(value) }
91
+ end
92
+
93
+ # Trick to make Hash#map return a hash. Simply calls the merge method
94
+ # on each hash in the array to reduce to a single merged hash.
95
+ return result.reduce(:merge)
96
+ end
97
+
98
+ # Attempt to parse a Date or DateTime from a string
99
+ response = Utilities::try_to_encode_as_date(response)
100
+
101
+ # Base case: convert date object to UTC
102
+ if response.instance_of?(Time) || response.instance_of?(DateTime) || response.instance_of?(Date)
103
+ return @timezone.local_to_utc(response)
104
+ end
105
+
106
+ # Base case: value is not a date
107
+ response
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,66 @@
1
+ require "date"
2
+
3
+ module AllscriptsUnityClient
4
+ class Utilities
5
+ DATETIME_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2}))(T| )\d{1,2}:\d{2}(:\d{2})?(\.\d+)?( ?PM|AM|pm|am)?((-|\+)\d{2}:?\d{2})?Z?$/
6
+ DATE_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2}))$/
7
+
8
+ def self.try_to_encode_as_date(possible_date)
9
+ if possible_date.nil?
10
+ return nil
11
+ end
12
+
13
+ if possible_date.is_a?(String) && possible_date =~ DATE_REGEX
14
+ return Date.parse(possible_date)
15
+ end
16
+
17
+ if possible_date.is_a?(String) && possible_date =~ DATETIME_REGEX
18
+ return DateTime.parse(possible_date)
19
+ end
20
+
21
+ possible_date
22
+ end
23
+
24
+ def self.encode_data(data)
25
+ if data.nil?
26
+ return nil
27
+ end
28
+
29
+ if data.respond_to?(:pack)
30
+ return data.pack("m")
31
+ else
32
+ return [data].pack("m")
33
+ end
34
+ end
35
+
36
+ def self.recursively_symbolize_keys(hash)
37
+ # Base case: nil maps to nil
38
+ if hash.nil?
39
+ return nil
40
+ end
41
+
42
+ # Recurse case: value is a hash so symbolize keys
43
+ if hash.is_a?(Hash)
44
+ result = hash.map do |key, value|
45
+ { key.snakecase.to_sym => recursively_symbolize_keys(value) }
46
+ end
47
+
48
+ return result.reduce(:merge)
49
+ end
50
+
51
+ # Recurse case: value is an array so symbolize keys for any hash
52
+ # in it
53
+ if hash.is_a?(Array)
54
+ result = hash.map do |value|
55
+ recursively_symbolize_keys(value)
56
+ end
57
+
58
+ return result
59
+ end
60
+
61
+ # Base case: value was not an array or a hash, so just
62
+ # return it
63
+ hash
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,3 @@
1
+ module AllscriptsUnityClient
2
+ VERSION = "1.0.3"
3
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'AllscriptsUnityClient' do
4
+ include Savon::SpecHelper
5
+
6
+ subject { AllscriptsUnityClient }
7
+
8
+ let(:get_security_token) { FixtureLoader.load_file("get_security_token.xml") }
9
+
10
+ before(:all) { savon.mock! }
11
+ after(:all) { savon.unmock! }
12
+
13
+ describe '.create' do
14
+ context 'when given :mode => :soap' do
15
+ it 'returns a SOAPClient' do
16
+ savon.expects("GetSecurityToken").with(:message => :any).returns(get_security_token)
17
+ parameters = FactoryGirl.build(:allscripts_unity_client_parameters, :mode => :soap)
18
+ expect(subject.create(parameters).client_type).to be(:soap)
19
+ end
20
+ end
21
+
22
+ context 'when given :mode => :json' do
23
+ it 'returns a client with client_type :json' do
24
+ stub_request(:post, "http://www.example.com/Unity/UnityService.svc/json/GetToken")
25
+ parameters = FactoryGirl.build(:allscripts_unity_client_parameters, :mode => :json)
26
+ expect(subject.create(parameters).client_type).to be(:json)
27
+ end
28
+ end
29
+
30
+ context 'when not given :mode' do
31
+ it 'returns a client with client_type :soap' do
32
+ savon.expects("GetSecurityToken").with(:message => :any).returns(get_security_token)
33
+ parameters = FactoryGirl.build(:allscripts_unity_client_parameters)
34
+ parameters[:mode] = nil
35
+ expect(subject.create(parameters).client_type).to be(:soap)
36
+ end
37
+ end
38
+ end
39
+
40
+ describe '.raise_if_parameters_invalid' do
41
+ context 'when not given :base_unity_url' do
42
+ it { expect { subject.send(:raise_if_parameters_invalid, FactoryGirl.build(:allscripts_unity_client_parameters, :base_unity_url => nil)) }.to raise_error(ArgumentError) }
43
+ end
44
+
45
+ context 'when not given :username' do
46
+ it { expect { subject.send(:raise_if_parameters_invalid, FactoryGirl.build(:allscripts_unity_client_parameters, :username => nil)) }.to raise_error(ArgumentError) }
47
+ end
48
+
49
+ context 'when not given :password' do
50
+ it { expect { subject.send(:raise_if_parameters_invalid, FactoryGirl.build(:allscripts_unity_client_parameters, :password => nil)) }.to raise_error(ArgumentError) }
51
+ end
52
+
53
+ context 'when not given :appname' do
54
+ it { expect { subject.send(:raise_if_parameters_invalid, FactoryGirl.build(:allscripts_unity_client_parameters, :appname => nil)) }.to raise_error(ArgumentError) }
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'ClientDriver' do
4
+ it_behaves_like 'a client driver'
5
+
6
+ subject { FactoryGirl.build(:client_driver) }
7
+
8
+ describe '#initialize' do
9
+ context 'when nil is given for base_unity_url' do
10
+ it { expect { FactoryGirl.build(:client_driver, :base_unity_url => nil) }.to raise_error(ArgumentError) }
11
+ end
12
+
13
+ context 'when nil is given for username' do
14
+ it { expect { FactoryGirl.build(:client_driver, :username => nil) }.to raise_error(ArgumentError) }
15
+ end
16
+
17
+ context 'when nil is given for password' do
18
+ it { expect { FactoryGirl.build(:client_driver, :password => nil) }.to raise_error(ArgumentError) }
19
+ end
20
+
21
+ context 'when nil is given for appname' do
22
+ it { expect { FactoryGirl.build(:client_driver, :appname => nil) }.to raise_error(ArgumentError) }
23
+ end
24
+
25
+ context 'when given a base_unity_url with a trailing /' do
26
+ it 'sets @base_unity_url without the trailing /' do
27
+ client_driver = FactoryGirl.build(:client_driver, :base_unity_url => "http://www.example.com/")
28
+ expect(client_driver.base_unity_url).to eq("http://www.example.com")
29
+ end
30
+ end
31
+
32
+ context 'when nil is given for timezone' do
33
+ it 'sets @timezone to UTC' do
34
+ client_driver = FactoryGirl.build(:client_driver, :timezone => nil)
35
+ utc_timezone = FactoryGirl.build(:timezone, :zone_identifier => "UTC")
36
+ expect(client_driver.timezone.tzinfo).to eq(utc_timezone.tzinfo)
37
+ end
38
+ end
39
+
40
+ context 'when nil is given for logger' do
41
+ it 'sets @logger to Logger' do
42
+ client_driver = FactoryGirl.build(:client_driver, :logger => nil)
43
+ expect(client_driver.logger).to be_instance_of(Logger)
44
+ end
45
+ end
46
+
47
+ context 'when logger is set' do
48
+ it 'sets @logger to logger' do
49
+ logger = double("logger")
50
+ client_driver = FactoryGirl.build(:client_driver, :logger => logger)
51
+ expect(client_driver.logger).to be(logger)
52
+ end
53
+ end
54
+ end
55
+
56
+ describe '#client_type' do
57
+ it { expect(subject.client_type).to be(:none) }
58
+ end
59
+
60
+ describe '#magic' do
61
+ it { expect { subject.magic }.to raise_error(NotImplementedError) }
62
+ end
63
+
64
+ describe '#get_security_token!' do
65
+ it { expect { subject.get_security_token! }.to raise_error(NotImplementedError) }
66
+ end
67
+
68
+ describe '#retire_security_token!' do
69
+ it { expect { subject.retire_security_token! }.to raise_error(NotImplementedError) }
70
+ end
71
+ end
@@ -0,0 +1,406 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Client' do
4
+ subject { FactoryGirl.build(:client) }
5
+
6
+ describe '#initialize' do
7
+ context 'when given nil for client_driver' do
8
+ it { expect { FactoryGirl.build(:client, :client_driver => nil) }.to raise_error(ArgumentError) }
9
+ end
10
+ end
11
+
12
+ describe '#magic' do
13
+ it 'calls magic on @client_driver' do
14
+ subject.client_driver = double(:magic => "magic")
15
+ subject.magic
16
+ expect(subject.client_driver).to have_received(:magic)
17
+ end
18
+ end
19
+
20
+ describe '#get_security_token!' do
21
+ it 'calls get_security_token! on @client_driver' do
22
+ subject.client_driver = double(:get_security_token! => "get_security_token!")
23
+ subject.get_security_token!
24
+ expect(subject.client_driver).to have_received(:get_security_token!)
25
+ end
26
+ end
27
+
28
+ describe '#retire_security_token!' do
29
+ it 'calls retire_security_token! on @client_driver' do
30
+ subject.client_driver = double(:retire_security_token! => "retire_security_token!")
31
+ subject.retire_security_token!
32
+ expect(subject.client_driver).to have_received(:retire_security_token!)
33
+ end
34
+ end
35
+
36
+ describe '#security_token?' do
37
+ it 'calls security_token? on @client_driver' do
38
+ subject.client_driver = double(:security_token? => "security_token?")
39
+ subject.security_token?
40
+ expect(subject.client_driver).to have_received(:security_token?)
41
+ end
42
+ end
43
+
44
+ describe '#client_type' do
45
+ it 'calls client_type on @client_driver' do
46
+ subject.client_driver = double(:client_type => "client_type?")
47
+ subject.client_type
48
+ expect(subject.client_driver).to have_received(:client_type)
49
+ end
50
+ end
51
+
52
+ describe '#commit_charges' do
53
+ it { expect { subject.commit_charges }.to raise_error(NotImplementedError) }
54
+ end
55
+
56
+ describe '#echo'
57
+
58
+ describe '#get_account' do
59
+ it { expect { subject.get_account }.to raise_error(NotImplementedError) }
60
+ end
61
+
62
+ describe '#get_changed_patients'
63
+
64
+ describe '#get_charge_info_by_username' do
65
+ it { expect { subject.get_charge_info_by_username }.to raise_error(NotImplementedError) }
66
+ end
67
+
68
+ describe '#get_charges' do
69
+ it { expect { subject.get_charges }.to raise_error(NotImplementedError) }
70
+ end
71
+
72
+ describe '#get_chart_item_details'
73
+ describe '#get_clinical_summary'
74
+
75
+ describe '#get_delegates' do
76
+ it { expect { subject.get_delegates }.to raise_error(NotImplementedError) }
77
+ end
78
+
79
+ describe '#get_dictionary'
80
+
81
+ describe '#get_dictionary_sets' do
82
+ it { expect { subject.get_dictionary_sets }.to raise_error(NotImplementedError) }
83
+ end
84
+
85
+ describe '#get_doc_template' do
86
+ it { expect { subject.get_doc_template }.to raise_error(NotImplementedError) }
87
+ end
88
+
89
+ describe '#get_document_by_accession' do
90
+ it { expect { subject.get_document_by_accession }.to raise_error(NotImplementedError) }
91
+ end
92
+
93
+ describe '#get_document_image' do
94
+ it { expect { subject.get_document_image }.to raise_error(NotImplementedError) }
95
+ end
96
+
97
+ describe '#get_documents' do
98
+ it { expect { subject.get_documents }.to raise_error(NotImplementedError) }
99
+ end
100
+
101
+ describe '#get_document_type' do
102
+ it { expect { subject.get_document_type }.to raise_error(NotImplementedError) }
103
+ end
104
+
105
+ describe '#get_dur' do
106
+ it { expect { subject.get_dur }.to raise_error(NotImplementedError) }
107
+ end
108
+
109
+ describe '#get_encounter' do
110
+ it { expect { subject.get_encounter }.to raise_error(NotImplementedError) }
111
+ end
112
+
113
+ describe '#get_encounter_date' do
114
+ it { expect { subject.get_encounter_date }.to raise_error(NotImplementedError) }
115
+ end
116
+
117
+ describe '#get_encounter_list'
118
+
119
+ describe '#get_hie_document' do
120
+ it { expect { subject.get_hie_document }.to raise_error(NotImplementedError) }
121
+ end
122
+
123
+ describe '#get_last_patient' do
124
+ it { expect { subject.get_last_patient }.to raise_error(NotImplementedError) }
125
+ end
126
+
127
+ describe '#get_list_of_dictionaries' do
128
+ it { expect { subject.get_list_of_dictionaries }.to raise_error(NotImplementedError) }
129
+ end
130
+
131
+ describe '#get_medication_by_trans_id'
132
+
133
+ describe '#get_order_history' do
134
+ it { expect { subject.get_order_history }.to raise_error(NotImplementedError) }
135
+ end
136
+
137
+ describe '#get_organization_id' do
138
+ it { expect { subject.get_organization_id }.to raise_error(NotImplementedError) }
139
+ end
140
+
141
+ describe '#get_packages' do
142
+ it { expect { subject.get_packages }.to raise_error(NotImplementedError) }
143
+ end
144
+
145
+ describe '#get_patient'
146
+ describe '#get_patient_activity'
147
+
148
+ describe '#get_patient_by_mrn' do
149
+ it { expect { subject.get_patient_by_mrn }.to raise_error(NotImplementedError) }
150
+ end
151
+
152
+ describe '#get_patient_cda' do
153
+ it { expect { subject.get_patient_cda }.to raise_error(NotImplementedError) }
154
+ end
155
+
156
+ describe '#get_patient_diagnosis' do
157
+ it { expect { subject.get_patient_diagnosis }.to raise_error(NotImplementedError) }
158
+ end
159
+
160
+ describe '#get_patient_full' do
161
+ it { expect { subject.get_patient_full }.to raise_error(NotImplementedError) }
162
+ end
163
+
164
+ describe '#get_patient_ids' do
165
+ it { expect { subject.get_patient_ids }.to raise_error(NotImplementedError) }
166
+ end
167
+
168
+ describe '#get_patient_list' do
169
+ it { expect { subject.get_patient_list }.to raise_error(NotImplementedError) }
170
+ end
171
+
172
+ describe '#get_patient_locations' do
173
+ it { expect { subject.get_patient_locations }.to raise_error(NotImplementedError) }
174
+ end
175
+
176
+ describe '#get_patient_pharmacies' do
177
+ it { expect { subject.get_patient_pharmacies }.to raise_error(NotImplementedError) }
178
+ end
179
+
180
+ describe '#get_patient_problems'
181
+ describe '#get_patients_by_icd9'
182
+
183
+ describe '#get_patient_sections' do
184
+ it { expect { subject.get_patient_sections }.to raise_error(NotImplementedError) }
185
+ end
186
+
187
+ describe '#get_procedures' do
188
+ it { expect { subject.get_procedures }.to raise_error(NotImplementedError) }
189
+ end
190
+
191
+ describe '#get_provider'
192
+ describe '#get_providers'
193
+
194
+ describe '#get_ref_providers_by_specialty' do
195
+ it { expect { subject.get_ref_providers_by_specialty }.to raise_error(NotImplementedError) }
196
+ end
197
+
198
+ describe '#get_rounding_list_entries' do
199
+ it { expect { subject.get_rounding_list_entries }.to raise_error(NotImplementedError) }
200
+ end
201
+
202
+ describe '#get_rounding_lists' do
203
+ it { expect { subject.get_rounding_lists }.to raise_error(NotImplementedError) }
204
+ end
205
+
206
+ describe '#get_rx_favs' do
207
+ it { expect { subject.get_rx_favs }.to raise_error(NotImplementedError) }
208
+ end
209
+
210
+ describe '#get_schedule' do
211
+ it { expect { subject.get_schedule }.to raise_error(NotImplementedError) }
212
+ end
213
+
214
+ describe '#get_server_info'
215
+
216
+ describe '#get_sigs' do
217
+ it { expect { subject.get_sigs }.to raise_error(NotImplementedError) }
218
+ end
219
+
220
+ describe '#get_task'
221
+ describe '#get_task_list'
222
+
223
+ describe '#get_user_authentication' do
224
+ it { expect { subject.get_user_authentication }.to raise_error(NotImplementedError) }
225
+ end
226
+
227
+ describe '#get_user_id' do
228
+ it { expect { subject.get_user_id }.to raise_error(NotImplementedError) }
229
+ end
230
+
231
+ describe '#get_user_security' do
232
+ it { expect { subject.get_user_security }.to raise_error(NotImplementedError) }
233
+ end
234
+
235
+ describe '#get_vaccine_manufacturers' do
236
+ it { expect { subject.get_vaccine_manufacturers }.to raise_error(NotImplementedError) }
237
+ end
238
+
239
+ describe '#get_vitals' do
240
+ it { expect { subject.get_vitals }.to raise_error(NotImplementedError) }
241
+ end
242
+
243
+ describe '#make_task' do
244
+ it { expect { subject.make_task }.to raise_error(NotImplementedError) }
245
+ end
246
+
247
+ describe '#save_admin_task' do
248
+ it { expect { subject.save_admin_task }.to raise_error(NotImplementedError) }
249
+ end
250
+
251
+ describe '#save_allergy' do
252
+ it { expect { subject.save_allergy }.to raise_error(NotImplementedError) }
253
+ end
254
+
255
+ describe '#save_ced' do
256
+ it { expect { subject.save_ced }.to raise_error(NotImplementedError) }
257
+ end
258
+
259
+ describe '#save_charge' do
260
+ it { expect { subject.save_charge }.to raise_error(NotImplementedError) }
261
+ end
262
+
263
+ describe '#save_chart_view_audit' do
264
+ it { expect { subject.save_chart_view_audit }.to raise_error(NotImplementedError) }
265
+ end
266
+
267
+ describe '#save_diagnosis' do
268
+ it { expect { subject.save_diagnosis }.to raise_error(NotImplementedError) }
269
+ end
270
+
271
+ describe '#save_document_image' do
272
+ it { expect { subject.save_document_image }.to raise_error(NotImplementedError) }
273
+ end
274
+
275
+ describe '#save_er_note' do
276
+ it { expect { subject.save_er_note }.to raise_error(NotImplementedError) }
277
+ end
278
+
279
+ describe '#save_hie_document' do
280
+ it { expect { subject.save_hie_document }.to raise_error(NotImplementedError) }
281
+ end
282
+
283
+ describe '#save_history' do
284
+ it { expect { subject.save_history }.to raise_error(NotImplementedError) }
285
+ end
286
+
287
+ describe '#save_immunization' do
288
+ it { expect { subject.save_immunization }.to raise_error(NotImplementedError) }
289
+ end
290
+
291
+ describe '#save_note' do
292
+ it { expect { subject.save_note }.to raise_error(NotImplementedError) }
293
+ end
294
+
295
+ describe '#save_patient' do
296
+ it { expect { subject.save_patient }.to raise_error(NotImplementedError) }
297
+ end
298
+
299
+ describe '#save_patient_location' do
300
+ it { expect { subject.save_patient_location }.to raise_error(NotImplementedError) }
301
+ end
302
+
303
+ describe '#save_problem' do
304
+ it { expect { subject.save_problem }.to raise_error(NotImplementedError) }
305
+ end
306
+
307
+ describe '#save_problems_data' do
308
+ it { expect { subject.save_problems_data }.to raise_error(NotImplementedError) }
309
+ end
310
+
311
+ describe '#save_ref_provider' do
312
+ it { expect { subject.save_ref_provider }.to raise_error(NotImplementedError) }
313
+ end
314
+
315
+ describe '#save_result' do
316
+ it { expect { subject.save_result }.to raise_error(NotImplementedError) }
317
+ end
318
+
319
+ describe '#save_rx'
320
+
321
+ describe '#save_simple_encounter' do
322
+ it { expect { subject.save_simple_encounter }.to raise_error(NotImplementedError) }
323
+ end
324
+
325
+ describe '#save_simple_rx' do
326
+ it { expect { subject.save_simple_rx }.to raise_error(NotImplementedError) }
327
+ end
328
+
329
+ describe '#save_specialist' do
330
+ it { expect { subject.save_specialist }.to raise_error(NotImplementedError) }
331
+ end
332
+
333
+ describe '#save_task'
334
+ describe '#save_task_status'
335
+
336
+ describe '#save_tiff' do
337
+ it { expect { subject.save_tiff }.to raise_error(NotImplementedError) }
338
+ end
339
+
340
+ describe '#save_unstructured_document' do
341
+ it { expect { subject.save_unstructured_document }.to raise_error(NotImplementedError) }
342
+ end
343
+
344
+ describe '#save_v10_doc_signature' do
345
+ it { expect { subject.save_v10_doc_signature }.to raise_error(NotImplementedError) }
346
+ end
347
+
348
+ describe '#save_v11_note' do
349
+ it { expect { subject.save_v11_note }.to raise_error(NotImplementedError) }
350
+ end
351
+
352
+ describe '#save_vitals' do
353
+ it { expect { subject.save_vitals }.to raise_error(NotImplementedError) }
354
+ end
355
+
356
+ describe '#save_vitals_data' do
357
+ it { expect { subject.save_vitals_data }.to raise_error(NotImplementedError) }
358
+ end
359
+
360
+ describe '#search_charge_codes' do
361
+ it { expect { subject.search_charge_codes }.to raise_error(NotImplementedError) }
362
+ end
363
+
364
+ describe '#search_diagnosis_codes' do
365
+ it { expect { subject.search_diagnosis_codes }.to raise_error(NotImplementedError) }
366
+ end
367
+
368
+ describe '#search_meds'
369
+
370
+ describe '#search_patients' do
371
+ it { expect { subject.search_patients }.to raise_error(NotImplementedError) }
372
+ end
373
+
374
+ describe '#search_patients_rxhub5' do
375
+ it { expect { subject.search_patients_rxhub5 }.to raise_error(NotImplementedError) }
376
+ end
377
+
378
+ describe '#search_pharmacies' do
379
+ it { expect { subject.search_pharmacies }.to raise_error(NotImplementedError) }
380
+ end
381
+
382
+ describe '#search_problem_codes' do
383
+ it { expect { subject.search_problem_codes }.to raise_error(NotImplementedError) }
384
+ end
385
+
386
+ describe '#update_encounter' do
387
+ it { expect { subject.update_encounter }.to raise_error(NotImplementedError) }
388
+ end
389
+
390
+ describe '#update_order' do
391
+ it { expect { subject.update_order }.to raise_error(NotImplementedError) }
392
+ end
393
+
394
+ describe '#update_referral_order_status' do
395
+ it { expect { subject.update_referral_order_status }.to raise_error(NotImplementedError) }
396
+ end
397
+
398
+ describe '#nokogiri_to_string' do
399
+ context 'when given a Nokogiri::XML::Builder' do
400
+ it 'returns an XML string' do
401
+ builder = Nokogiri::XML::Builder.new { |xml| xml.field "test" }
402
+ expect(subject.send(:nokogiri_to_string, builder)).to eq("<field>test</field>")
403
+ end
404
+ end
405
+ end
406
+ end