Class: CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client
- Defined in:
- lib/candidhealth/pre_encounter/appointments/v_1/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Adds an appointment.
-
#deactivate(id:, version:, request_options: nil) ⇒ Void
Sets an appointment as deactivated.
-
#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Gets an appointment.
-
#get_history(id:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>
Gets an appointment along with it’s full history.
-
#get_visits(page_token: nil, limit: nil, sort_field: nil, sort_direction: nil, filters: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::VisitsPage
Gets all Visits within a given time range.
- #initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client constructor
-
#scan(since:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>
Scans up to 100 appointment updates.
-
#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Updates an appointment.
Constructor Details
#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client
296 297 298 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 296 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::AsyncRequestClient (readonly)
292 293 294 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 292 def request_client @request_client end |
Instance Method Details
#create(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Adds an appointment. VersionConflictError is returned when the
placer_appointment_id is already in use.
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 341 def create(request:, request_options: nil) Async do 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: PreEncounter, request_options: )}/appointments/v1" end CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body) end end |
#deactivate(id:, version:, request_options: nil) ⇒ Void
Sets an appointment as deactivated. The path must contain the most recent
version to prevent race conditions. Deactivating historic versions is not
supported. Subsequent updates via PUT to the appointment will "reactivate" the
appointment and set the deactivated flag to false.
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 561 def deactivate(id:, version:, request_options: nil) Async do @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: PreEncounter, request_options: )}/appointments/v1/#{id}/#{version}" end end end |
#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Gets an appointment.
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 406 def get(id:, request_options: nil) Async do response = @request_client.conn.get 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: PreEncounter, request_options: )}/appointments/v1/#{id}" end CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body) end end |
#get_history(id:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>
Gets an appointment along with it’s full history. The return list is ordered by
version ascending.
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 432 def get_history(id:, request_options: nil) Async do response = @request_client.conn.get 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: PreEncounter, request_options: )}/appointments/v1/#{id}/history" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item) end end end |
#get_visits(page_token: nil, limit: nil, sort_field: nil, sort_direction: nil, filters: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::VisitsPage
Gets all Visits within a given time range. The return list is ordered by
start_time ascending.
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 372 def get_visits(page_token: nil, limit: nil, sort_field: nil, sort_direction: nil, filters: nil, request_options: nil) Async do response = @request_client.conn.get 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.params = { **(&.additional_query_parameters || {}), "page_token": page_token, "limit": limit, "sort_field": sort_field, "sort_direction": sort_direction, "filters": filters }.compact req.url "#{@request_client.get_url(environment: PreEncounter, request_options: )}/appointments/v1/visits" end CandidApiClient::PreEncounter::Appointments::V1::Types::VisitsPage.from_json(json_object: response.body) end end |
#scan(since:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>
Scans up to 100 appointment updates. The since query parameter is inclusive,
and the result list is ordered by updatedAt ascending.
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 527 def scan(since:, request_options: nil) Async do response = @request_client.conn.get 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.params = { **(&.additional_query_parameters || {}), "since": since }.compact req.url "#{@request_client.get_url(environment: PreEncounter, request_options: )}/appointments/v1/updates/scan" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item) end end end |
#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment
Updates an appointment. The path must contain the most recent version to
prevent race conditions. Updating historic versions is not supported.
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/candidhealth/pre_encounter/appointments/v_1/client.rb', line 500 def update(id:, version:, request:, request_options: nil) Async do response = @request_client.conn.put 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: PreEncounter, request_options: )}/appointments/v1/#{id}/#{version}" end CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body) end end |