Class: FHIR::ExampleScenarioProcessStep

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

Overview

fhir/example_scenario_process_step.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



34
35
36
37
38
39
40
41
42
43
# File 'app/models/fhir/example_scenario_process_step.rb', line 34

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

  result = self.superclass.transform_json(json_hash, target)
  result['process'] = json_hash['process'].map { |var| ExampleScenarioProcess.transform_json(var) } unless json_hash['process'].nil?
  result['pause'] = PrimitiveBoolean.transform_json(json_hash['pause'], json_hash['_pause']) unless json_hash['pause'].nil?
  result['operation'] = ExampleScenarioProcessStepOperation.transform_json(json_hash['operation']) unless json_hash['operation'].nil?
  result['alternative'] = json_hash['alternative'].map { |var| ExampleScenarioProcessStepAlternative.transform_json(var) } unless json_hash['alternative'].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
# File 'app/models/fhir/example_scenario_process_step.rb', line 10

def as_json(*args)
  result = super      
  unless self.process.nil?  || !self.process.any? 
    result['process'] = self.process.map{ |x| x.as_json(*args) }
  end
  unless self.pause.nil? 
    result['pause'] = self.pause.value
    serialized = Extension.serializePrimitiveExtension(self.pause)            
    result['_pause'] = serialized unless serialized.nil?
  end
  unless self.operation.nil? 
    result['operation'] = self.operation.as_json(*args)
  end
  unless self.alternative.nil?  || !self.alternative.any? 
    result['alternative'] = self.alternative.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end