Class: CandidApiClient::DiagnosesClient
- Inherits:
-
Object
- Object
- CandidApiClient::DiagnosesClient
- Defined in:
- lib/candidhealth/diagnoses/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(request:, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Creates a new diagnosis for an encounter.
-
#delete(diagnosis_id:, request_options: nil) ⇒ Void
Deletes the diagnosis record associated with the provided ‘diagnosis_id`.
- #initialize(request_client:) ⇒ CandidApiClient::DiagnosesClient constructor
-
#update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Updates the diagnosis record matching the provided ‘diagnosis_id`.
Constructor Details
#initialize(request_client:) ⇒ CandidApiClient::DiagnosesClient
16 17 18 |
# File 'lib/candidhealth/diagnoses/client.rb', line 16 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::RequestClient (readonly)
12 13 14 |
# File 'lib/candidhealth/diagnoses/client.rb', line 12 def request_client @request_client end |
Instance Method Details
#create(request:, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Creates a new diagnosis for an encounter
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/candidhealth/diagnoses/client.rb', line 32 def create(request:, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(request || {}), **(&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/diagnoses/v2" end CandidApiClient::Diagnoses::Types::Diagnosis.from_json(json_object: response.body) end |
#delete(diagnosis_id:, request_options: nil) ⇒ Void
Deletes the diagnosis record associated with the provided ‘diagnosis_id`
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/candidhealth/diagnoses/client.rb', line 104 def delete(diagnosis_id:, request_options: nil) @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/diagnoses/v2/#{diagnosis_id}" end end |
#update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Updates the diagnosis record matching the provided ‘diagnosis_id`
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/candidhealth/diagnoses/client.rb', line 75 def update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil) response = @request_client.conn.patch do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), name: name, code_type: code_type, code: code }.compact req.url "#{@request_client.get_url(environment: CandidApi, request_options: )}/api/diagnoses/v2/#{diagnosis_id}" end CandidApiClient::Diagnoses::Types::Diagnosis.from_json(json_object: response.body) end |