Class: FHIR::ClientReply
- Inherits:
-
Object
- Object
- FHIR::ClientReply
- Defined in:
- lib/ext/client_reply.rb
Instance Method Summary collapse
Instance Method Details
#response_format ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ext/client_reply.rb', line 4 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 |