Class: FHIR::AppointmentParticipant

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

Overview

fhir/appointment_participant.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



40
41
42
43
44
45
46
47
48
49
50
# File 'app/models/fhir/appointment_participant.rb', line 40

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

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = json_hash['type'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['type'].nil?
  result['actor'] = Reference.transform_json(json_hash['actor']) unless json_hash['actor'].nil?
  result['required'] = ParticipantRequired.transform_json(json_hash['required'], json_hash['_required']) unless json_hash['required'].nil?
  result['status'] = ParticipationStatus.transform_json(json_hash['status'], json_hash['_status']) unless json_hash['status'].nil?
  result['period'] = Period.transform_json(json_hash['period']) unless json_hash['period'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



11
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
# File 'app/models/fhir/appointment_participant.rb', line 11

def as_json(*args)
  result = super      
  unless self.type.nil?  || !self.type.any? 
    result['type'] = self.type.map{ |x| x.as_json(*args) }
  end
  unless self.actor.nil? 
    result['actor'] = self.actor.as_json(*args)
  end
  unless self.required.nil? 
    result['required'] = self.required.value
    serialized = Extension.serializePrimitiveExtension(self.required)            
    result['_required'] = serialized unless serialized.nil?
  end
  unless self.status.nil? 
    result['status'] = self.status.value
    serialized = Extension.serializePrimitiveExtension(self.status)            
    result['_status'] = serialized unless serialized.nil?
  end
  unless self.period.nil? 
    result['period'] = self.period.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end