Browse Source

Minor calling/data formatting bugs. Should refactor

master
Raphael Roberts 5 years ago
parent
commit
06d12f1442
  1. 9
      gapi/apis/calendar_api/calendar_api.py
  2. 4
      gapi/apis/calendar_api/models.py

9
gapi/apis/calendar_api/calendar_api.py

@ -76,8 +76,9 @@ class calendar_api(API):
page_token = calendar_list.get("nextPageToken")
return cl
def get_events(self, cal_id, **params):
def get_events(self, **params):
"""Return events with params"""
cal_id = params.pop("cal_id")
service = self.service
try:
cal_id = self.ids[cal_id]
@ -103,11 +104,11 @@ class calendar_api(API):
):
"""Returns events in between the given time range"""
if start_date is not None:
start_date = to_dateTime(start_date)
start_date = start_date.isoformat()
if end_date is not None:
end_date = to_dateTime(end_date)
end_date = end_date.isoformat()
self.get_events(self, cal_id=cal_id, timeMin=start_date, timeMax=end_date)
yield from self.get_events(cal_id=cal_id, timeMin=start_date, timeMax=end_date)
def get_event_by_id(self, cal_id, event_id):
"""Retrieves event from cal_id and event_id"""

4
gapi/apis/calendar_api/models.py

@ -151,7 +151,7 @@ class Calendar:
if calendar_id in api.ids.keys():
self.name = calendar_id
self.calendar_id = self.api.ids[self.name]
self.id = self.api.ids[self.name]
elif calendar_id in api.ids.values():
self.name = self.api.calendars[calendar_id]["summary"]
self.id = calendar_id
@ -168,7 +168,7 @@ class Calendar:
return (
Event(event_representation)
for event_representation in self.api.get_events_in_range(
self.cal_id, start, end
self.id, start, end
)
)

Loading…
Cancel
Save