Class: FHIR::Binary

Inherits:
Resource show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/binary.rb

Overview

fhir/binary.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from FHIR::Resource

Class Method Details

.transform_json(json_hash, target = Binary.new) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'app/models/fhir/binary.rb', line 32

def self.transform_json(json_hash, target = Binary.new)

  result = self.superclass.transform_json(json_hash, target)
  result['contentType'] = MimeType.transform_json(json_hash['contentType'], json_hash['_contentType']) unless json_hash['contentType'].nil?
  result['securityContext'] = Reference.transform_json(json_hash['securityContext']) unless json_hash['securityContext'].nil?
  result['data'] = PrimitiveBase64Binary.transform_json(json_hash['data'], json_hash['_data']) unless json_hash['data'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/fhir/binary.rb', line 9

def as_json(*args)
  result = super      
  unless self.contentType.nil? 
    result['contentType'] = self.contentType.value
    serialized = Extension.serializePrimitiveExtension(self.contentType)            
    result['_contentType'] = serialized unless serialized.nil?
  end
  unless self.securityContext.nil? 
    result['securityContext'] = self.securityContext.as_json(*args)
  end
  unless self.data.nil? 
    result['data'] = self.data.value
    serialized = Extension.serializePrimitiveExtension(self.data)            
    result['_data'] = serialized unless serialized.nil?
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end