Skip to content

Commit

Permalink
Move EVENTS_LIST_ORDER to EventsService
Browse files Browse the repository at this point in the history
closes #188
  • Loading branch information
kuzmoyev committed Sep 19, 2024
1 parent c334a9d commit 783264a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion gcsa/_services/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AuthenticatedService:
"""Handles authentication of the `GoogleCalendar`"""

_READ_WRITE_SCOPES = 'https://www.googleapis.com/auth/calendar'
_LIST_ORDERS = ("startTime", "updated")

def __init__(
self,
Expand Down
4 changes: 3 additions & 1 deletion gcsa/_services/events_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class SendUpdatesMode:
class EventsService(BaseService):
"""Event management methods of the `GoogleCalendar`"""

_EVENTS_LIST_ORDERS = ("startTime", "updated")

def _list_events(
self,
request_method: Callable,
Expand Down Expand Up @@ -174,7 +176,7 @@ def __getitem__(self, r):
if (
(time_min and not isinstance(time_min, (date, datetime)))
or (time_max and not isinstance(time_max, (date, datetime)))
or (order_by and (not isinstance(order_by, str) or order_by not in self._LIST_ORDERS))
or (order_by and (not isinstance(order_by, str) or order_by not in self._EVENTS_LIST_ORDERS))
):
raise ValueError('Calendar indexing is in the following format: time_min[:time_max[:order_by]],'
' where time_min and time_max are date/datetime objects'
Expand Down

0 comments on commit 783264a

Please sign in to comment.