Class: FHIR::ExplanationOfBenefitInsurance
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::ExplanationOfBenefitInsurance
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/explanation_of_benefit_insurance.rb
Overview
fhir/explanation_of_benefit_insurance.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = ExplanationOfBenefitInsurance.new) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/fhir/explanation_of_benefit_insurance.rb', line 32 def self.transform_json(json_hash, target = ExplanationOfBenefitInsurance.new) result = self.superclass.transform_json(json_hash, target) result['focal'] = PrimitiveBoolean.transform_json(json_hash['focal'], json_hash['_focal']) unless json_hash['focal'].nil? result['coverage'] = Reference.transform_json(json_hash['coverage']) unless json_hash['coverage'].nil? result['preAuthRef'] = json_hash['preAuthRef'].each_with_index.map do |var, i| extension_hash = json_hash['_preAuthRef'] && json_hash['_preAuthRef'][i] PrimitiveString.transform_json(var, extension_hash) end unless json_hash['preAuthRef'].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 27 28 29 30 |
# File 'app/models/fhir/explanation_of_benefit_insurance.rb', line 9 def as_json(*args) result = super unless self.focal.nil? result['focal'] = self.focal.value serialized = Extension.serializePrimitiveExtension(self.focal) result['_focal'] = serialized unless serialized.nil? end unless self.coverage.nil? result['coverage'] = self.coverage.as_json(*args) end unless self.preAuthRef.nil? || !self.preAuthRef.any? result['preAuthRef'] = self.preAuthRef.compact().map{ |x| x.value } serialized = Extension.serializePrimitiveExtensionArray(self.preAuthRef) result['_preAuthRef'] = serialized unless serialized.nil? || !serialized.any? end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |