allscripts_unity_client 3.4.0 → 3.4.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: 5b018d1ed24a0f4b028314d344ddda233cdae85e
4
- data.tar.gz: a50e668f398d71abb9b9c2a634ece8009a97b929
3
+ metadata.gz: 58403ed28c5720a5561b2586e08f45a0b4e94674
4
+ data.tar.gz: 5f7839227467a6f441cd79033529d5edfb708318
5
5
  SHA512:
6
- metadata.gz: f60b57a172e05271f9c68d9eeb4d9c04e10dbe17d16c9bba85e8e9a91f3435fd290b63d8d8d787a7f827489f0aa2caff61837c985f5e46dbf3451f622312bca4
7
- data.tar.gz: c2e23be3758cce7f2568476132afafcc1140cea9b9453e225373fb0d4b61f9f383997405ab592a556412cbea4935cfa8816bd0faf137ece71fc51fa2a3652de2
6
+ metadata.gz: 12454a2b06e5e7003afa26d1ccb3a67d9dd39f2f348682b5194e8837548d4d3348d5b561f2dde184ee86bee12e9f7e38b2d8dafa71a0aa578943f35a478bb825
7
+ data.tar.gz: 6598b9d73b4c62d7ab736a52917678530f9a7a621c50c4cd386bc51f921dac50f9620ad60d1c299c28e35087afd1aad0bf801c408e57122ffef5948217312c5a
@@ -277,6 +277,17 @@ module AllscriptsUnityClient
277
277
  raise NotImplementedError, 'GetListOfDictionaries magic action not implemented'
278
278
  end
279
279
 
280
+ # @param [String] userid the Allscripts EHR username.
281
+ #
282
+ # @param [Numeric,String] patient_id the Allscripts internal patient ID.
283
+ #
284
+ # @param [Numeric,String] transaction_id the transaction ID of the
285
+ # RX in question. M prefix=medication, H prefix=historic
286
+ # medication.
287
+ #
288
+ # @return [Array] if {transaction_id} is either 0 or "0".
289
+ #
290
+ # @return [Hash] if {transaction_id} is not 0 or "0".
280
291
  def get_medication_by_trans_id(userid, patientid, transaction_id)
281
292
  magic_parameters = {
282
293
  action: 'GetMedicationByTransID',
@@ -299,6 +310,13 @@ module AllscriptsUnityClient
299
310
  result
300
311
  end
301
312
 
313
+ # @param [String] userid the Allscripts EHR username.
314
+ #
315
+ # @param [String] ddid the numeric drug identifier.
316
+ #
317
+ # @param [String] patientid the Allscripts internal patient ID.
318
+ #
319
+ # @return [Object]
302
320
  def get_medication_info(userid, ddid, patientid = nil)
303
321
  magic_parameters = {
304
322
  action: 'GetMedicationInfo',
@@ -18,18 +18,19 @@ module AllscriptsUnityClient
18
18
  #
19
19
  # Returns Date or ActiveSupport::TimeWithZone, or the string if it did not contain a date.
20
20
  def self.try_to_encode_as_date(timezone, possible_date)
21
- if possible_date.nil?
22
- return nil
23
- end
24
-
25
- if possible_date.is_a?(String) && possible_date =~ DATE_REGEX
26
- return Date.parse(possible_date)
27
- end
28
-
29
- if possible_date.is_a?(String) && possible_date =~ DATETIME_REGEX
30
- return timezone.parse(possible_date)
21
+ case possible_date
22
+ when DATE_REGEX
23
+ Date.parse(possible_date)
24
+ when DATETIME_REGEX
25
+ timezone.parse(possible_date)
26
+ else
27
+ possible_date
31
28
  end
32
-
29
+ # Since we know in either of the cases above we only attempt to
30
+ # parse a string this is either an "invalid date" from
31
+ # `Date.parse` or an "argument out of range" from
32
+ # `ActiveSupport::TimeZone#parse`.
33
+ rescue ArgumentError
33
34
  possible_date
34
35
  end
35
36
 
@@ -1,3 +1,3 @@
1
1
  module AllscriptsUnityClient
2
- VERSION = '3.4.0'
2
+ VERSION = '3.4.1'.freeze
3
3
  end
@@ -103,6 +103,15 @@ describe AllscriptsUnityClient::Utilities do
103
103
  expect(subject.try_to_encode_as_date(timezone, invalid_date_string_one)).to eq(invalid_date_string_one)
104
104
  end
105
105
  end
106
+
107
+ context 'when givn an valid date string that represents an invalid date' do
108
+ it 'it returns the string' do
109
+ date = "10/00/1999"
110
+ date_time = "10/00/1999 01:01:01"
111
+ expect(subject.try_to_encode_as_date(timezone, date)).to be(date)
112
+ expect(subject.try_to_encode_as_date(timezone, date_time)).to be(date_time)
113
+ end
114
+ end
106
115
  end
107
116
 
108
117
  describe '.encode_data' do
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: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - healthfinch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient