Class: Luma::Patient

Inherits:
Connection show all
Defined in:
lib/luma/patient.rb

Constant Summary collapse

PATIENT_ENDPOINT =
'/api/patients'.freeze

Constants inherited from Connection

Connection::DEFAULT_ENDPOINT

Instance Method Summary collapse

Methods inherited from Connection

#add_header, #initialize, #luma_request, #request

Constructor Details

This class inherits a constructor from Luma::Connection

Instance Method Details

#create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout) ⇒ Object



7
8
9
# File 'lib/luma/patient.rb', line 7

def create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
  luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
end

#get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/luma/patient.rb', line 15

def get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout)
  self.add_header if auth

  endpoint = "#{endpoint}/#{identifier}"

  response = self.request(endpoint: endpoint, headers: @headers, auth: auth, verb: verb)
  Luma::Models::PatientResponse.new(response: response)
end

#update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout) ⇒ Object



11
12
13
# File 'lib/luma/patient.rb', line 11

def update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
  luma_request(auth: auth, body: body, endpoint: endpoint, identifier: identifier, verb: verb)
end