Class: FHIR::MedicinalProductName

Inherits:
BackboneElement show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/medicinal_product_name.rb

Overview

fhir/medicinal_product_name.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.transform_json(json_hash, target = MedicinalProductName.new) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'app/models/fhir/medicinal_product_name.rb', line 30

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

  result = self.superclass.transform_json(json_hash, target)
  result['productName'] = PrimitiveString.transform_json(json_hash['productName'], json_hash['_productName']) unless json_hash['productName'].nil?
  result['namePart'] = json_hash['namePart'].map { |var| MedicinalProductNameNamePart.transform_json(var) } unless json_hash['namePart'].nil?
  result['countryLanguage'] = json_hash['countryLanguage'].map { |var| MedicinalProductNameCountryLanguage.transform_json(var) } unless json_hash['countryLanguage'].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
# File 'app/models/fhir/medicinal_product_name.rb', line 9

def as_json(*args)
  result = super      
  unless self.productName.nil? 
    result['productName'] = self.productName.value
    serialized = Extension.serializePrimitiveExtension(self.productName)            
    result['_productName'] = serialized unless serialized.nil?
  end
  unless self.namePart.nil?  || !self.namePart.any? 
    result['namePart'] = self.namePart.map{ |x| x.as_json(*args) }
  end
  unless self.countryLanguage.nil?  || !self.countryLanguage.any? 
    result['countryLanguage'] = self.countryLanguage.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end