Class: FHIR::DeviceVersion

Inherits:
BackboneElement show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/device_version.rb

Overview

fhir/device_version.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



30
31
32
33
34
35
36
37
38
# File 'app/models/fhir/device_version.rb', line 30

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

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = CodeableConcept.transform_json(json_hash['type']) unless json_hash['type'].nil?
  result['component'] = Identifier.transform_json(json_hash['component']) unless json_hash['component'].nil?
  result['value'] = PrimitiveString.transform_json(json_hash['value'], json_hash['_value']) unless json_hash['value'].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
# File 'app/models/fhir/device_version.rb', line 9

def as_json(*args)
  result = super      
  unless self.type.nil? 
    result['type'] = self.type.as_json(*args)
  end
  unless self.component.nil? 
    result['component'] = self.component.as_json(*args)
  end
  unless self.value.nil? 
    result['value'] = self.value.value
    serialized = Extension.serializePrimitiveExtension(self.value)            
    result['_value'] = serialized unless serialized.nil?
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end