Class: FHIR::CoverageCostToBeneficiary

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

Overview

fhir/coverage_cost_to_beneficiary.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



32
33
34
35
36
37
38
39
40
41
# File 'app/models/fhir/coverage_cost_to_beneficiary.rb', line 32

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

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = CodeableConcept.transform_json(json_hash['type']) unless json_hash['type'].nil?
  result['valueQuantity'] = SimpleQuantity.transform_json(json_hash['valueQuantity']) unless json_hash['valueQuantity'].nil?
  result['valueMoney'] = Money.transform_json(json_hash['valueMoney']) unless json_hash['valueMoney'].nil?
  result['exception'] = json_hash['exception'].map { |var| CoverageCostToBeneficiaryException.transform_json(var) } unless json_hash['exception'].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/coverage_cost_to_beneficiary.rb', line 10

def as_json(*args)
  result = super      
  unless self.type.nil? 
    result['type'] = self.type.as_json(*args)
  end
  unless self.valueQuantity.nil?
    result['valueQuantity'] = self.valueQuantity.as_json(*args)                        
  end          
  unless self.valueMoney.nil?
    result['valueMoney'] = self.valueMoney.as_json(*args)                        
  end          
  unless self.exception.nil?  || !self.exception.any? 
    result['exception'] = self.exception.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end