Class: Candid::PreEncounter::Lists::V1::Client
- Inherits:
-
Object
- Object
- Candid::PreEncounter::Lists::V1::Client
- Defined in:
- lib/candid/pre_encounter/lists/v_1/client.rb
Instance Method Summary collapse
-
#get_appointment_list(request_options: {}, **params) ⇒ Candid::PreEncounter::Lists::V1::Types::AppointmentListPage
Searches for appointments that match the query parameters.
-
#get_patient_list(request_options: {}, **params) ⇒ Candid::PreEncounter::Lists::V1::Types::PatientListPage
Gets patients with dependent objects for patients that match the query parameters.
- #initialize(client:, base_url: nil, environment: nil) ⇒ void constructor
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
13 14 15 16 17 |
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 13 def initialize(client:, base_url: nil, environment: nil) @client = client @base_url = base_url @environment = environment end |
Instance Method Details
#get_appointment_list(request_options: {}, **params) ⇒ Candid::PreEncounter::Lists::V1::Types::AppointmentListPage
Searches for appointments that match the query parameters.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 91 def get_appointment_list(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[sort_field sort_direction limit page_token filters include_deactivated include_merged_patient_data] query_params = {} query_params["sort_field"] = params[:sort_field] if params.key?(:sort_field) query_params["sort_direction"] = params[:sort_direction] if params.key?(:sort_direction) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["page_token"] = params[:page_token] if params.key?(:page_token) query_params["filters"] = params[:filters] if params.key?(:filters) query_params["include_deactivated"] = params[:include_deactivated] if params.key?(:include_deactivated) query_params["include_merged_patient_data"] = params[:include_merged_patient_data] if params.key?(:include_merged_patient_data) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/lists/v1/appointment", query: query_params, request_options: ) 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.
38 39 40 41 42 43 44 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 70 71 |
# File 'lib/candid/pre_encounter/lists/v_1/client.rb', line 38 def get_patient_list(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[page_token limit sort_field sort_direction filters include_deactivated redirect_to_primary hide_alternatives] query_params = {} query_params["page_token"] = params[:page_token] if params.key?(:page_token) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["sort_field"] = params[:sort_field] if params.key?(:sort_field) query_params["sort_direction"] = params[:sort_direction] if params.key?(:sort_direction) query_params["filters"] = params[:filters] if params.key?(:filters) query_params["include_deactivated"] = params[:include_deactivated] if params.key?(:include_deactivated) query_params["redirect_to_primary"] = params[:redirect_to_primary] if params.key?(:redirect_to_primary) query_params["hide_alternatives"] = params[:hide_alternatives] if params.key?(:hide_alternatives) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:pre_encounter), method: "GET", path: "/lists/v1/patient", query: query_params, request_options: ) 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 |