Class: FHIR::SubstancePolymerRepeatRepeatUnit

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

Overview

fhir/substance_polymer_repeat_repeat_unit.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



38
39
40
41
42
43
44
45
46
47
48
# File 'app/models/fhir/substance_polymer_repeat_repeat_unit.rb', line 38

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

  result = self.superclass.transform_json(json_hash, target)
  result['orientationOfPolymerisation'] = CodeableConcept.transform_json(json_hash['orientationOfPolymerisation']) unless json_hash['orientationOfPolymerisation'].nil?
  result['repeatUnit'] = PrimitiveString.transform_json(json_hash['repeatUnit'], json_hash['_repeatUnit']) unless json_hash['repeatUnit'].nil?
  result['amount'] = SubstanceAmount.transform_json(json_hash['amount']) unless json_hash['amount'].nil?
  result['degreeOfPolymerisation'] = json_hash['degreeOfPolymerisation'].map { |var| SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation.transform_json(var) } unless json_hash['degreeOfPolymerisation'].nil?
  result['structuralRepresentation'] = json_hash['structuralRepresentation'].map { |var| SubstancePolymerRepeatRepeatUnitStructuralRepresentation.transform_json(var) } unless json_hash['structuralRepresentation'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/fhir/substance_polymer_repeat_repeat_unit.rb', line 11

def as_json(*args)
  result = super      
  unless self.orientationOfPolymerisation.nil? 
    result['orientationOfPolymerisation'] = self.orientationOfPolymerisation.as_json(*args)
  end
  unless self.repeatUnit.nil? 
    result['repeatUnit'] = self.repeatUnit.value
    serialized = Extension.serializePrimitiveExtension(self.repeatUnit)            
    result['_repeatUnit'] = serialized unless serialized.nil?
  end
  unless self.amount.nil? 
    result['amount'] = self.amount.as_json(*args)
  end
  unless self.degreeOfPolymerisation.nil?  || !self.degreeOfPolymerisation.any? 
    result['degreeOfPolymerisation'] = self.degreeOfPolymerisation.map{ |x| x.as_json(*args) }
  end
  unless self.structuralRepresentation.nil?  || !self.structuralRepresentation.any? 
    result['structuralRepresentation'] = self.structuralRepresentation.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end