Class: Updox::Models::Appointment

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

Constant Summary collapse

SYNC_ENDPOINT =
'/AppointmentsSync'.freeze
SYNC_LIST_TYPE =
'appointments'.freeze

Constants included from Extensions::Sync

Extensions::Sync::RECOMMENDED_BATCH_SIZE

Constants inherited from Model

Model::ITEM_TYPE, Model::LIST_NAME, Model::LIST_TYPE

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extensions::Sync

sync

Methods inherited from Model

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

Class Method Details

.exists?(appointment_id, account_id:, cached_query: nil) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/updox/models/appointment.rb', line 44

def self.exists?(appointment_id, account_id: , cached_query: nil)
  Updox::Models::AppointmentStatus.exists?(appointment_id, account_id: , cached_query: cached_query)
end

Instance Method Details

#save(account_id:) ⇒ Object



40
41
42
# File 'lib/updox/models/appointment.rb', line 40

def save(account_id: )
  self.class.sync([self], account_id: )
end

#to_hObject



32
33
34
35
36
37
38
# File 'lib/updox/models/appointment.rb', line 32

def to_h
  result = super.to_h

  result['date'] = result['date'].strftime(Updox::Models::DATETIME_FORMAT) if result['date'].respond_to?(:strftime)

  result
end