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)


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

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

#as_json(args) ⇒ Object



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

def as_json(args)
  self.to_h
end

#save(account_id:) ⇒ Object



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

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

#to_hObject



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