Class: Luma::Patient
Constant Summary
collapse
- PATIENT_ENDPOINT =
'/api/patients'.freeze
Constants inherited
from Connection
Connection::DEFAULT_ENDPOINT
Instance Method Summary
collapse
-
#create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout) ⇒ Object
-
#get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout) ⇒ Object
-
#update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout) ⇒ Object
Methods inherited from Connection
#add_headers_and_body, #initialize, #request
Instance Method Details
#create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/luma/patient.rb', line 7
def create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
@body = body
self.add_headers_and_body if auth
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
end
|
#get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/luma/patient.rb', line 23
def get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout)
self.add_headers_and_body if auth
endpoint = "#{endpoint}/#{identifier}"
response = self.class.send(verb.to_s, endpoint, headers: @headers)
Luma::Models::PatientResponse.new(response: response)
end
|
#update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/luma/patient.rb', line 14
def update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
@body = body
self.add_headers_and_body if auth
endpoint = "#{endpoint}/#{identifier}"
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
end
|