Skip to content

Commit

Permalink
Merge pull request fhir-crucible#110 from fhir-crucible/history-bundle
Browse files Browse the repository at this point in the history
History bundle
  • Loading branch information
jawalonoski committed Mar 15, 2019
2 parents 759a22b + 5c3bc90 commit 8fd1cbd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.3
Exclude:
- '*.gemspec'
- 'Gemfile*'
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def parse_reply(klass, format, response)
return nil unless [200, 201].include? response.code
res = nil
begin
res = if(@fhir_version == :dstu2 || klass.ancestors.include?(FHIR::DSTU2::Model))
res = if(@fhir_version == :dstu2 || klass&.ancestors&.include?(FHIR::DSTU2::Model))
if(format.include?('xml'))
FHIR::DSTU2::Xml.from_xml(response.body)
else
Expand Down
10 changes: 9 additions & 1 deletion lib/fhir_client/sections/history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ module History
def history(options)
options = {format: @default_format}.merge(options)
reply = get resource_url(options), fhir_headers
reply.resource = parse_reply(options[:resource], options[:format], reply)

# The history reply should be a bundle
bundle_klass = if @fhir_version == :stu3
FHIR::Bundle
else
FHIR::DSTU2::Bundle
end

reply.resource = parse_reply(bundle_klass, options[:format], reply)
reply.resource_class = options[:resource]
reply
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module FHIR
class Client
VERSION = '3.1.0'
VERSION = '3.1.1'
end
end

0 comments on commit 8fd1cbd

Please sign in to comment.