Class: FHIR::BundleEntry

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

Overview

fhir/bundle_entry.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



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

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

  result = self.superclass.transform_json(json_hash, target)
  result['link'] = json_hash['link'].map { |var| BundleLink.transform_json(var) } unless json_hash['link'].nil?
  result['fullUrl'] = PrimitiveUri.transform_json(json_hash['fullUrl'], json_hash['_fullUrl']) unless json_hash['fullUrl'].nil?
  result['resource'] = Resource.transform_json(json_hash['resource']) unless json_hash['resource'].nil?
  result['search'] = BundleEntrySearch.transform_json(json_hash['search']) unless json_hash['search'].nil?
  result['request'] = BundleEntryRequest.transform_json(json_hash['request']) unless json_hash['request'].nil?
  result['response'] = BundleEntryResponse.transform_json(json_hash['response']) unless json_hash['response'].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/bundle_entry.rb', line 12

def as_json(*args)
  result = super      
  unless self.link.nil?  || !self.link.any? 
    result['link'] = self.link.map{ |x| x.as_json(*args) }
  end
  unless self.fullUrl.nil? 
    result['fullUrl'] = self.fullUrl.value
    serialized = Extension.serializePrimitiveExtension(self.fullUrl)            
    result['_fullUrl'] = serialized unless serialized.nil?
  end
  unless self.resource.nil? 
    result['resource'] = self.resource.as_json(*args)
  end
  unless self.search.nil? 
    result['search'] = self.search.as_json(*args)
  end
  unless self.request.nil? 
    result['request'] = self.request.as_json(*args)
  end
  unless self.response.nil? 
    result['response'] = self.response.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end