Class: Updox::Models::Appointment

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

Constant Summary collapse

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

Constants inherited from Model

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

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

Class Method Details

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

Returns:

  • (Boolean)


42
43
44
# File 'lib/updox/models/appointment.rb', line 42

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



38
39
40
# File 'lib/updox/models/appointment.rb', line 38

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

#to_hObject Also known as: as_json



29
30
31
32
33
34
35
# File 'lib/updox/models/appointment.rb', line 29

def to_h
  result = super.to_h

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

  result
end