Class: FHIR::MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength

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

Overview

fhir/medicinal_product_ingredient_specified_substance_strength_reference_strength.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



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

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

  result = self.superclass.transform_json(json_hash, target)
  result['substance'] = CodeableConcept.transform_json(json_hash['substance']) unless json_hash['substance'].nil?
  result['strength'] = Ratio.transform_json(json_hash['strength']) unless json_hash['strength'].nil?
  result['strengthLowLimit'] = Ratio.transform_json(json_hash['strengthLowLimit']) unless json_hash['strengthLowLimit'].nil?
  result['measurementPoint'] = PrimitiveString.transform_json(json_hash['measurementPoint'], json_hash['_measurementPoint']) unless json_hash['measurementPoint'].nil?
  result['country'] = json_hash['country'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['country'].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/medicinal_product_ingredient_specified_substance_strength_reference_strength.rb', line 11

def as_json(*args)
  result = super      
  unless self.substance.nil? 
    result['substance'] = self.substance.as_json(*args)
  end
  unless self.strength.nil? 
    result['strength'] = self.strength.as_json(*args)
  end
  unless self.strengthLowLimit.nil? 
    result['strengthLowLimit'] = self.strengthLowLimit.as_json(*args)
  end
  unless self.measurementPoint.nil? 
    result['measurementPoint'] = self.measurementPoint.value
    serialized = Extension.serializePrimitiveExtension(self.measurementPoint)            
    result['_measurementPoint'] = serialized unless serialized.nil?
  end
  unless self.country.nil?  || !self.country.any? 
    result['country'] = self.country.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end