Sha256: d0acf67f9707c8d60288232ff85e76ccd6b81bcdfc66ab195996bb9edf69c384

Contents?: true

Size: 429 Bytes

Versions: 2

Compression:

Stored size: 429 Bytes

Contents

module FHIR
  class ClientReply

    def response_format
      doc = Nokogiri::XML(self.body)
      if doc.errors.empty?
        FHIR::Formats::ResourceFormat::RESOURCE_XML
      else
        begin
          JSON.parse(self.body)
          FHIR::Formats::ResourceFormat::RESOURCE_JSON
        rescue JSON::ParserError => e
          raise "Failed to detect response format: #{self.body}"
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plan_executor-1.8.0 lib/ext/client_reply.rb
plan_executor-1.0.2 lib/ext/client_reply.rb