Class: Candid::Encounters::V4::Client
- Inherits:
-
Object
- Object
- Candid::Encounters::V4::Client
- Defined in:
- lib/candid/encounters/v_4/client.rb
Instance Method Summary collapse
- #create(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
-
#create_from_pre_encounter_patient(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
Create an encounter from a pre-encounter patient and appointment.
-
#create_from_pre_encounter_patient_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
Create an encounter from a pre-encounter patient and appointment.
- #create_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
- #get(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
- #get_all(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::EncounterPage
- #initialize(client:) ⇒ Candid::Encounters::V4::Client constructor
- #update(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
- #update_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
Constructor Details
#initialize(client:) ⇒ Candid::Encounters::V4::Client
8 9 10 |
# File 'lib/candid/encounters/v_4/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/candid/encounters/v_4/client.rb', line 84 def create(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/encounters/v4", body: Candid::Encounters::V4::Types::EncounterCreate.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#create_from_pre_encounter_patient(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
Create an encounter from a pre-encounter patient and appointment. This endpoint is intended to be used by consumers who are managing patients and appointments in the pre-encounter service and is currently under development. Consumers who are not taking advantage of the pre-encounter service should use the standard create endpoint.
The endpoint will create an encounter from the provided fields, pulling information from the provided patient and appointment objects where applicable. In particular, the following fields are populated from the patient and appointment objects:
- Patient
- Referring Provider
- Subscriber Primary
- Subscriber Secondary
- Referral Number
- Responsible Party
- Guarantor
Utilizing this endpoint opts you into automatic updating of the encounter when the patient or appointment is updated, assuming the encounter has not already been submitted or adjudicated.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/candid/encounters/v_4/client.rb', line 162 def create_from_pre_encounter_patient(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/encounters/v4/create-from-pre-encounter", body: Candid::Encounters::V4::Types::EncounterCreateFromPreEncounter.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#create_from_pre_encounter_patient_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
Create an encounter from a pre-encounter patient and appointment. This endpoint is intended to be used by consumers who are managing patients and appointments in the pre-encounter service and is currently under development. Consumers who are not taking advantage of the pre-encounter service should use the standard create endpoint.
The endpoint will create an encounter from the provided fields, pulling information from the provided patient and appointment objects where applicable. In particular, the following fields are populated from the patient and appointment objects:
- Patient
- Referring Provider
- Subscriber Primary
- Subscriber Secondary
- Referral Number
- Responsible Party
- Guarantor
Utilizing this endpoint opts you into automatic updating of the encounter when the patient or appointment is updated, assuming the encounter has not already been submitted or adjudicated.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/candid/encounters/v_4/client.rb', line 123 def create_from_pre_encounter_patient_universal(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/encounters/v4/create-from-pre-encounter/universal", body: Candid::EncountersUniversal::Types::UniversalEncounterCreateFromPreEncounter.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#create_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/candid/encounters/v_4/client.rb', line 62 def create_universal(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/encounters/v4/universal", body: Candid::EncountersUniversal::Types::UniversalEncounterCreate.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#get(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/candid/encounters/v_4/client.rb', line 41 def get(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "GET", path: "/api/encounters/v4/#{params[:encounter_id]}" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#get_all(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::EncounterPage
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/candid/encounters/v_4/client.rb', line 13 def get_all(request_options: {}, **params) params = Candid::Internal::Types::Utils.symbolize_keys(params) _query_param_names = %i[limit claim_status sort page_token date_of_service_min date_of_service_max primary_payer_names search_term external_id diagnoses_updated_since tag_ids work_queue_id billable_status responsible_party owner_of_next_action patient_external_id] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "GET", path: "/api/encounters/v4", 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::Encounters::V4::Types::EncounterPage.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/candid/encounters/v_4/client.rb', line 206 def update(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "PATCH", path: "/api/encounters/v4/#{params[:encounter_id]}", body: Candid::Encounters::V4::Types::EncounterUpdate.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#update_universal(request_options: {}, **params) ⇒ Candid::Encounters::V4::Types::Encounter
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/candid/encounters/v_4/client.rb', line 184 def update_universal(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "PATCH", path: "/api/encounters/v4/#{params[:encounter_id]}/universal", body: Candid::EncountersUniversal::Types::UniversalEncounterUpdate.new(params).to_h ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::Encounters::V4::Types::Encounter.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |