Class: CandidApiClient::PreEncounter::Notes::V1::AsyncV1Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/notes/v_1/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Notes::V1::AsyncV1Client

Parameters:



135
136
137
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 135

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



131
132
133
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 131

def request_client
  @request_client
end

Instance Method Details

#create(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Notes::V1::Types::Note

Adds a new note.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.notes.v_1.create(request: { value: "value" })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash

    • :value (String)

    • :author_email (String)

    • :author_name (String)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 175

def create(request:, request_options: nil)
  Async do
    response = @request_client.conn.post do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/notes/v1"
    end
    CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
  end
end

#deactivate(id:, version:, request_options: nil) ⇒ Void

Sets a note as deactivated. The path must contain the most recent version to

prevent races.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.notes.v_1.deactivate(id: "id", version: "version")

Parameters:

Returns:

  • (Void)


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 238

def deactivate(id:, version:, request_options: nil)
  Async do
    @request_client.conn.delete do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/notes/v1/#{id}/#{version}"
    end
  end
end

#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Notes::V1::Types::Note

Gets a note by NoteId.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.notes.v_1.get(id: "id")

Parameters:

Returns:



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 147

def get(id:, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/notes/v1/#{id}"
    end
    CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
  end
end

#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Notes::V1::Types::Note

Updates a note. The path must contain the most recent version to prevent races.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.notes.v_1.update(
  id: "id",
  version: "version",
  request: { value: "value" }
)

Parameters:

  • id (String)
  • version (String)
  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash

    • :value (String)

    • :author_email (String)

    • :author_name (String)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/candidhealth/pre_encounter/notes/v_1/client.rb', line 210

def update(id:, version:, request:, request_options: nil)
  Async do
    response = @request_client.conn.put do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/notes/v1/#{id}/#{version}"
    end
    CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
  end
end