Class: FHIR::InvoiceLineItemPriceComponent

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

Overview

fhir/invoice_line_item_price_component.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



36
37
38
39
40
41
42
43
44
45
# File 'app/models/fhir/invoice_line_item_price_component.rb', line 36

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

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = InvoicePriceComponentType.transform_json(json_hash['type'], json_hash['_type']) unless json_hash['type'].nil?
  result['code'] = CodeableConcept.transform_json(json_hash['code']) unless json_hash['code'].nil?
  result['factor'] = PrimitiveDecimal.transform_json(json_hash['factor'], json_hash['_factor']) unless json_hash['factor'].nil?
  result['amount'] = Money.transform_json(json_hash['amount']) unless json_hash['amount'].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
31
32
33
34
# File 'app/models/fhir/invoice_line_item_price_component.rb', line 10

def as_json(*args)
  result = super      
  unless self.type.nil? 
    result['type'] = self.type.value
    serialized = Extension.serializePrimitiveExtension(self.type)            
    result['_type'] = serialized unless serialized.nil?
  end
  unless self.code.nil? 
    result['code'] = self.code.as_json(*args)
  end
  unless self.factor.nil? 
    result['factor'] = self.factor.value
    serialized = Extension.serializePrimitiveExtension(self.factor)            
    result['_factor'] = serialized unless serialized.nil?
  end
  unless self.amount.nil? 
    result['amount'] = self.amount.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end