Module: FHIR::ModelExtras::InstanceMethods

Defined in:
lib/fhir_client/ext/model.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



11
12
13
# File 'lib/fhir_client/ext/model.rb', line 11

def client
  @client || FHIR::Model.client
end

#conditional_create(params) ⇒ Object



23
24
25
# File 'lib/fhir_client/ext/model.rb', line 23

def conditional_create(params)
  handle_response client.conditional_create(self, params)
end

#conditional_update(params) ⇒ Object



31
32
33
# File 'lib/fhir_client/ext/model.rb', line 31

def conditional_update(params)
  handle_response client.conditional_update(self, id, params)
end

#createObject



19
20
21
# File 'lib/fhir_client/ext/model.rb', line 19

def create
  handle_response client.create(self)
end

#destroyObject



35
36
37
38
# File 'lib/fhir_client/ext/model.rb', line 35

def destroy
  handle_response client.destroy(self.class, id) unless id.nil?
  nil
end

#resolve(reference) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/fhir_client/ext/model.rb', line 40

def resolve(reference)
  if reference.contained?
    contained.detect { |c| c.id == reference.id }
  else
    reference.read
  end
end

#updateObject



27
28
29
# File 'lib/fhir_client/ext/model.rb', line 27

def update
  handle_response client.update(self, id)
end

#vread(version_id) ⇒ Object



15
16
17
# File 'lib/fhir_client/ext/model.rb', line 15

def vread(version_id)
  self.class.vread(id, version_id, client)
end