Class: Updox::Models::Appointment
- Inherits:
-
Model
- Object
- Hashie::Trash
- Model
- Updox::Models::Appointment
show all
- Defined in:
- lib/updox/models/appointment.rb
Constant Summary
collapse
- SYNC_ENDPOINT =
'/AppointmentsSync'.freeze
Constants inherited
from Model
Model::LIST_NAME, Model::LIST_TYPE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Model
from_response
Class Method Details
.sync(appointments, account_id:) ⇒ Object
39
40
41
|
# File 'lib/updox/models/appointment.rb', line 39
def self.sync(appointments, account_id: )
from_response(UpdoxClient.connection.request(endpoint: SYNC_ENDPOINT, body: { appointments: appointments.map(&:to_h) }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT), self)
end
|
Instance Method Details
#save(account_id:) ⇒ Object
35
36
37
|
# File 'lib/updox/models/appointment.rb', line 35
def save(account_id: )
self.class.sync([self], account_id: account_id)
end
|
#to_h ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/updox/models/appointment.rb', line 27
def to_h
result = super.to_h
result['date'] = result['date'].strftime(Updox::Models::DATETIME_FORMAT) if result['date'].respond_to?(:strftime)
result
end
|