Class: FHIR::ProductShelfLife
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::ProductShelfLife
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/product_shelf_life.rb
Overview
fhir/product_shelf_life.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = ProductShelfLife.new) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/fhir/product_shelf_life.rb', line 32 def self.transform_json(json_hash, target = ProductShelfLife.new) result = self.superclass.transform_json(json_hash, target) result['identifier'] = Identifier.transform_json(json_hash['identifier']) unless json_hash['identifier'].nil? result['type'] = CodeableConcept.transform_json(json_hash['type']) unless json_hash['type'].nil? result['period'] = Quantity.transform_json(json_hash['period']) unless json_hash['period'].nil? result['specialPrecautionsForStorage'] = json_hash['specialPrecautionsForStorage'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['specialPrecautionsForStorage'].nil? result end |
Instance Method Details
#as_json(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/fhir/product_shelf_life.rb', line 10 def as_json(*args) result = super unless self.identifier.nil? result['identifier'] = self.identifier.as_json(*args) end unless self.type.nil? result['type'] = self.type.as_json(*args) end unless self.period.nil? result['period'] = self.period.as_json(*args) end unless self.specialPrecautionsForStorage.nil? || !self.specialPrecautionsForStorage.any? result['specialPrecautionsForStorage'] = self.specialPrecautionsForStorage.map{ |x| x.as_json(*args) } end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |