Class: FHIR::MedicinalProductIngredient

Inherits:
DomainResource show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/medicinal_product_ingredient.rb

Overview

fhir/medicinal_product_ingredient.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 = MedicinalProductIngredient.new) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/fhir/medicinal_product_ingredient.rb', line 42

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

  result = self.superclass.transform_json(json_hash, target)
  result['identifier'] = Identifier.transform_json(json_hash['identifier']) unless json_hash['identifier'].nil?
  result['role'] = CodeableConcept.transform_json(json_hash['role']) unless json_hash['role'].nil?
  result['allergenicIndicator'] = PrimitiveBoolean.transform_json(json_hash['allergenicIndicator'], json_hash['_allergenicIndicator']) unless json_hash['allergenicIndicator'].nil?
  result['manufacturer'] = json_hash['manufacturer'].map { |var| Reference.transform_json(var) } unless json_hash['manufacturer'].nil?
  result['specifiedSubstance'] = json_hash['specifiedSubstance'].map { |var| MedicinalProductIngredientSpecifiedSubstance.transform_json(var) } unless json_hash['specifiedSubstance'].nil?
  result['substance'] = MedicinalProductIngredientSubstance.transform_json(json_hash['substance']) unless json_hash['substance'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



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
37
38
39
40
# File 'app/models/fhir/medicinal_product_ingredient.rb', line 12

def as_json(*args)
  result = super      
  unless self.identifier.nil? 
    result['identifier'] = self.identifier.as_json(*args)
  end
  unless self.role.nil? 
    result['role'] = self.role.as_json(*args)
  end
  unless self.allergenicIndicator.nil? 
    result['allergenicIndicator'] = self.allergenicIndicator.value
    serialized = Extension.serializePrimitiveExtension(self.allergenicIndicator)            
    result['_allergenicIndicator'] = serialized unless serialized.nil?
  end
  unless self.manufacturer.nil?  || !self.manufacturer.any? 
    result['manufacturer'] = self.manufacturer.map{ |x| x.as_json(*args) }
  end
  unless self.specifiedSubstance.nil?  || !self.specifiedSubstance.any? 
    result['specifiedSubstance'] = self.specifiedSubstance.map{ |x| x.as_json(*args) }
  end
  unless self.substance.nil? 
    result['substance'] = self.substance.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end