Skip to content

Commit 8fd1cbd

Browse files
authored
Merge pull request #110 from fhir-crucible/history-bundle
History bundle
2 parents 759a22b + 5c3bc90 commit 8fd1cbd

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.2
2+
TargetRubyVersion: 2.3
33
Exclude:
44
- '*.gemspec'
55
- 'Gemfile*'

lib/fhir_client/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def parse_reply(klass, format, response)
322322
return nil unless [200, 201].include? response.code
323323
res = nil
324324
begin
325-
res = if(@fhir_version == :dstu2 || klass.ancestors.include?(FHIR::DSTU2::Model))
325+
res = if(@fhir_version == :dstu2 || klass&.ancestors&.include?(FHIR::DSTU2::Model))
326326
if(format.include?('xml'))
327327
FHIR::DSTU2::Xml.from_xml(response.body)
328328
else

lib/fhir_client/sections/history.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ module History
2626
def history(options)
2727
options = {format: @default_format}.merge(options)
2828
reply = get resource_url(options), fhir_headers
29-
reply.resource = parse_reply(options[:resource], options[:format], reply)
29+
30+
# The history reply should be a bundle
31+
bundle_klass = if @fhir_version == :stu3
32+
FHIR::Bundle
33+
else
34+
FHIR::DSTU2::Bundle
35+
end
36+
37+
reply.resource = parse_reply(bundle_klass, options[:format], reply)
3038
reply.resource_class = options[:resource]
3139
reply
3240
end

lib/fhir_client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module FHIR
22
class Client
3-
VERSION = '3.1.0'
3+
VERSION = '3.1.1'
44
end
55
end

0 commit comments

Comments
 (0)