Class: FHIR::ExplanationOfBenefitPayment

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

Overview

fhir/explanation_of_benefit_payment.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/fhir/explanation_of_benefit_payment.rb', line 42

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

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = CodeableConcept.transform_json(json_hash['type']) unless json_hash['type'].nil?
  result['adjustment'] = Money.transform_json(json_hash['adjustment']) unless json_hash['adjustment'].nil?
  result['adjustmentReason'] = CodeableConcept.transform_json(json_hash['adjustmentReason']) unless json_hash['adjustmentReason'].nil?
  result['date'] = PrimitiveDate.transform_json(json_hash['date'], json_hash['_date']) unless json_hash['date'].nil?
  result['amount'] = Money.transform_json(json_hash['amount']) unless json_hash['amount'].nil?
  result['identifier'] = Identifier.transform_json(json_hash['identifier']) unless json_hash['identifier'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/fhir/explanation_of_benefit_payment.rb', line 12

def as_json(*args)
  result = super      
  unless self.type.nil? 
    result['type'] = self.type.as_json(*args)
  end
  unless self.adjustment.nil? 
    result['adjustment'] = self.adjustment.as_json(*args)
  end
  unless self.adjustmentReason.nil? 
    result['adjustmentReason'] = self.adjustmentReason.as_json(*args)
  end
  unless self.date.nil? 
    result['date'] = self.date.value
    serialized = Extension.serializePrimitiveExtension(self.date)            
    result['_date'] = serialized unless serialized.nil?
  end
  unless self.amount.nil? 
    result['amount'] = self.amount.as_json(*args)
  end
  unless self.identifier.nil? 
    result['identifier'] = self.identifier.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end