Class: FHIR::MedicationKnowledgeRegulatory
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::MedicationKnowledgeRegulatory
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/medication_knowledge_regulatory.rb
Overview
fhir/medication_knowledge_regulatory.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = MedicationKnowledgeRegulatory.new) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/fhir/medication_knowledge_regulatory.rb', line 32 def self.transform_json(json_hash, target = MedicationKnowledgeRegulatory.new) result = self.superclass.transform_json(json_hash, target) result['regulatoryAuthority'] = Reference.transform_json(json_hash['regulatoryAuthority']) unless json_hash['regulatoryAuthority'].nil? result['substitution'] = json_hash['substitution'].map { |var| MedicationKnowledgeRegulatorySubstitution.transform_json(var) } unless json_hash['substitution'].nil? result['schedule'] = json_hash['schedule'].map { |var| MedicationKnowledgeRegulatorySchedule.transform_json(var) } unless json_hash['schedule'].nil? result['maxDispense'] = MedicationKnowledgeRegulatoryMaxDispense.transform_json(json_hash['maxDispense']) unless json_hash['maxDispense'].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/medication_knowledge_regulatory.rb', line 10 def as_json(*args) result = super unless self.regulatoryAuthority.nil? result['regulatoryAuthority'] = self.regulatoryAuthority.as_json(*args) end unless self.substitution.nil? || !self.substitution.any? result['substitution'] = self.substitution.map{ |x| x.as_json(*args) } end unless self.schedule.nil? || !self.schedule.any? result['schedule'] = self.schedule.map{ |x| x.as_json(*args) } end unless self.maxDispense.nil? result['maxDispense'] = self.maxDispense.as_json(*args) end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |