Class: Candid::PreEncounter::Lists::V1::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candid/pre_encounter/lists/v_1/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Candid::PreEncounter::Lists::V1::Client



9
10
11
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

#get_appointment_list(request_options: {}, **params) ⇒ Candid::PreEncounter::Lists::V1::Types::AppointmentListPage

Searches for appointments that match the query parameters.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 45

def get_appointment_list(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_keys(params)
  _query_param_names = i[sort_field sort_direction limit page_token filters]
  _query = params.slice(*_query_param_names)
  params.except(*_query_param_names)

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/lists/v1/appointment",
    query: _query
  )
  begin
    _response = @client.send(_request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = _response.code.to_i
  if code.between?(200, 299)
    Candid::PreEncounter::Lists::V1::Types::AppointmentListPage.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end

#get_patient_list(request_options: {}, **params) ⇒ Candid::PreEncounter::Lists::V1::Types::PatientListPage

Gets patients with dependent objects for patients that match the query parameters.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 16

def get_patient_list(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_keys(params)
  _query_param_names = i[page_token limit sort_field sort_direction filters]
  _query = params.slice(*_query_param_names)
  params.except(*_query_param_names)

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/lists/v1/patient",
    query: _query
  )
  begin
    _response = @client.send(_request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = _response.code.to_i
  if code.between?(200, 299)
    Candid::PreEncounter::Lists::V1::Types::PatientListPage.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end