Class: Updox::Models::Calendar
- Inherits:
-
Model
- Object
- Hashie::Trash
- Model
- Updox::Models::Calendar
show all
- Defined in:
- lib/updox/models/calendar.rb
Constant Summary
collapse
- SYNC_ENDPOINT =
'/CalendarsSync'.freeze
- LIST_ENDPOINT =
'/PracticeCalendarsRetrieve'.freeze
- LIST_TYPE =
'calendars'
- LIST_NAME =
LIST_TYPE
Constants inherited
from Model
Model::ITEM_TYPE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Model
#error_message, exists?, from_response, request, #response_code, #response_message, #successful?, sync
Class Method Details
.find(calendar_id, account_id:, cached_query: nil) ⇒ Object
29
30
31
32
33
|
# File 'lib/updox/models/calendar.rb', line 29
def self.find(calendar_id, account_id: , cached_query: nil)
obj = cached_query || self.query(account_id: account_id)
obj.calendars.find {|calendar| calendar_id.to_s == calendar.external_id.to_s }
end
|
.query(account_id:, active_only: false) ⇒ Object
35
36
37
|
# File 'lib/updox/models/calendar.rb', line 35
def self.query(account_id: , active_only: false)
request(endpoint: LIST_ENDPOINT, body: { activeOnly: active_only }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
end
|
Instance Method Details
#create(account_id:) ⇒ Object
25
26
27
|
# File 'lib/updox/models/calendar.rb', line 25
def create(account_id: )
self.class.request(endpoint: SYNC_ENDPOINT, body: self.to_h, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
end
|