module FHIR::ModelExtras::ClassMethods

Public Instance Methods

all(client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 111
def all(client = self.client)
  handle_response client.exception_class, client.read_feed(self)
end
client() click to toggle source
# File lib/fhir_client/ext/model.rb, line 57
def client
  FHIR::Model.client
end
client=(client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 61
def client=(client)
  FHIR::Model.client = client
end
conditional_create(model, params, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 102
def conditional_create(model, params, client = self.client)
  model = new(model) unless model.is_a?(self)
  handle_response client.exception_class, client.conditional_create(model, params)
end
create(model, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 97
def create(model, client = self.client)
  model = new(model) unless model.is_a?(self)
  handle_response client.exception_class, client.create(model)
end
partial_update(id, patchset, options = {}) click to toggle source
# File lib/fhir_client/ext/model.rb, line 107
def partial_update(id, patchset, options = {})
  handle_response client.exception_class, client.partial_update(self, id, patchset, options)
end
read(id, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 65
def read(id, client = self.client)
  handle_response client.exception_class, client.read(self, id)
end
read_with_summary(id, summary, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 69
def read_with_summary(id, summary, client = self.client)
  handle_response client.exception_class, client.read(self, id, client.default_format, summary)
end
resource_history(client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 77
def resource_history(client = self.client)
  handle_response client.exception_class, client.resource_history(self)
end
resource_history_as_of(last_update, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 81
def resource_history_as_of(last_update, client = self.client)
  handle_response client.exception_class, client.resource_history_as_of(self, last_update)
end
resource_instance_history(id, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 85
def resource_instance_history(id, client = self.client)
  handle_response client.exception_class, client.resource_instance_history(self, id)
end
resource_instance_history_as_of(id, last_update, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 89
def resource_instance_history_as_of(id, last_update, client = self.client)
  handle_response client.exception_class, client.resource_instance_history_as_of(self, id, last_update)
end
vread(id, version_id, client = self.client) click to toggle source
# File lib/fhir_client/ext/model.rb, line 73
def vread(id, version_id, client = self.client)
  handle_response client.exception_class, client.vread(self, id, version_id)
end

Private Instance Methods

handle_response(exception_class, response) click to toggle source
# File lib/fhir_client/ext/model.rb, line 117
def handle_response(exception_class, response)
  raise exception_class.new "Server returned #{response.code}.", response if response.code.between?(400, 599)
  response.resource
end