Class: FHIR::SubstanceIngredient
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::SubstanceIngredient
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/substance_ingredient.rb
Overview
fhir/substance_ingredient.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = SubstanceIngredient.new) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/models/fhir/substance_ingredient.rb', line 28 def self.transform_json(json_hash, target = SubstanceIngredient.new) result = self.superclass.transform_json(json_hash, target) result['quantity'] = Ratio.transform_json(json_hash['quantity']) unless json_hash['quantity'].nil? result['substanceCodeableConcept'] = CodeableConcept.transform_json(json_hash['substanceCodeableConcept']) unless json_hash['substanceCodeableConcept'].nil? result['substanceReference'] = Reference.transform_json(json_hash['substanceReference']) unless json_hash['substanceReference'].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 |
# File 'app/models/fhir/substance_ingredient.rb', line 9 def as_json(*args) result = super unless self.quantity.nil? result['quantity'] = self.quantity.as_json(*args) end unless self.substanceCodeableConcept.nil? result['substanceCodeableConcept'] = self.substanceCodeableConcept.as_json(*args) end unless self.substanceReference.nil? result['substanceReference'] = self.substanceReference.as_json(*args) end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |