Class: Updox::Models::AppointmentStatus

Inherits:
Model
  • Object
show all
Extended by:
Extensions::Exists
Defined in:
lib/updox/models/appointment_status.rb

Constant Summary collapse

LIST_ENDPOINT =
'/AppointmentStatusesGetByIds'.freeze
LIST_TYPE =
'appointmentStatuses'
LIST_NAME =
'statuses'

Constants inherited from Model

Model::ITEM_TYPE

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Class Method Summary collapse

Methods included from Extensions::Exists

exists?

Methods inherited from Model

#as_json, #error_message, from_response, request, #response_code, #response_message, #successful?

Class Method Details

.find(appointment_id, account_id:, cached_query: nil) ⇒ Object



20
21
22
23
24
# File 'lib/updox/models/appointment_status.rb', line 20

def self.find(appointment_id, account_id: , cached_query: nil)
  obj = cached_query || self.query([appointment_id], account_id: )

  obj.statuses.find {|status| appointment_id.to_s == status.external_appointment_id.to_s }
end

.query(appointment_ids, account_id:, active_only: false) ⇒ Object



26
27
28
# File 'lib/updox/models/appointment_status.rb', line 26

def self.query(appointment_ids, account_id: , active_only: false)
  request(endpoint: LIST_ENDPOINT, body: { appointmentIds: appointment_ids }, auth: {accountId: }, required_auths: Updox::Models::Auth::AUTH_ACCT)
end